I need to get a collection listing all products with a promotion, but I'm getting this error:

Fatal error: Call to a member function getBackend() on boolean 

I tried those 2 solutions, but still getting the same error:

First try:

$collection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->addAttributeToFilter('promotion', 1);

Second try:

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('promotion', 1);

How can I solve that and get the list with only promotional products? Thanks in advance.


I solved changing my line to:

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('special_price', array('notnull' => true));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.