I have created a new product with a custom data attribute.
$product = Mage::getModel('catalog/product');
$product->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
$product->setName('name');
$product->setDescription('description');
$product->setPrice(1.24);
$product->setData('lid', 123);
$product->save
Now I want to query for this product using Mage::getModel('catalog/product').
How can I query for products with 'lid' 123?
How can I query for products where 'lid' exists aka not null?
================
Error log when performing query with addAttributeToFilter.
( ! ) Fatal error: Call to a member function getBackend() on boolean in /Users/asdf/Sites/magento19.dev/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816
Call Stack
# Time Memory Function Location
1 0.0002 249016 {main}( ) .../index.php:0
2 0.0024 514024 Mage::run( ) .../index.php:87
3 0.0085 1433456 Mage_Core_Model_App->run( ) .../Mage.php:684
4 0.0729 7141088 Mage_Core_Controller_Varien_Front->dispatch( ) .../App.php:354
5 0.0776 7404488 Mage_Core_Controller_Varien_Router_Standard->match( ) .../Front.php:172
6 0.0825 7941968 Mage_Core_Controller_Varien_Action->dispatch( ) .../Standard.php:250
7 0.1205 10859488 Asdf_Sync_Adminhtml_SyncbackendController->indexAction( ) .../Action.php:418
8 0.1535 13447744 Asdf_Sync_Adminhtml_SyncbackendController->performSync( ) .../SyncbackendController.php:18
9 0.1542 13504568 Asdf_Sync_Helper_Data->pushProducts( ) .../SyncbackendController.php:33
10 0.3723 17554640 Mage_Catalog_Model_Resource_Product_Collection->addAttributeToFilter( ) .../Data.php:67
11 0.3723 17555008 Mage_Eav_Model_Entity_Collection_Abstract->addAttributeToFilter( ) .../Collection.php:1438
12 0.3723 17555360 Mage_Eav_Model_Entity_Collection_Abstract->_getAttributeConditionSql( ) .../Abstract.php:321
13 0.3723 17555472 Mage_Eav_Model_Entity_Abstract->isAttributeStatic( ) .../Abstract.php:1379
lid
? – OSdave