I have a custom attribute called parent_sku, I setted it to yes
in Product Listing
from the backend menu, and almost all the products have a value in this attribute.
I tried:
$subCollection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect(array('id','parent_sku'))
->addAttributeToFilter('parent_sku', array('eq' => $parent_sku));
I also tried (I know it is the same):
$subCollection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect(array('id','parent_sku'))
->addAttributeToFilter('parent_sku', $parent_sku));
$parent_sku has a valid value, that is the same of the value that have some of the products in parent_sku attribute.
But I get always $subCollection empty.
count($subCollection) // this is always zero
Best Answer
Try this: