Frage

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.

War es hilfreich?

Lösung

I solved changing my line to:

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('special_price', array('notnull' => true));
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top