Hello all.
I try put a filter on the collection product.
So, I create 3 attrubute ancho,largo and ups.
I put this :
$_productCollection=Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*')
->addFieldToFilter('ancho', array('eq'=>0));
//(The 0 is the id option)
There show me the result 0, but if I remove the line ->addFieldToFilter('ancho', array('eq'=>0)); there show me all products. also I put getAncho there show me the number.
On the Catalog>attributes I put all "Yes" show the result,search,frontend and etc...
What is the problem or some have a solution? The version from magento is 1.9.2
Thanks!!
Solved! Go to Solution.
Thanks, is working.
Hello @elizondo82,
addFieldToFilter it should be addAttributeToFilter
Same result, show me nothing.
$_productCollection=Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*')
->addFieldToFilter('ancho', array('eq'=>0));
Yes, the type is drop-down, first I put type text, but later I remove and I put drop-down. same name attributecode "ancho"