Goal: Retrieve a collection of products that have a certain attribute
Here's what I'm trying:
public function Hydrate($attribute)
{
$this->id = Mage::helper('myHelper')->CamelCase($attribute->getFrontendLabel());
$this->name = $attribute->getFrontendLabel();
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->addFieldToFilter($attribute->getAttributeCode(),array('like' => '%%'))
->load();
foreach ($products as $product)
{
array_push($this->collection,Mage::getModel('myModels/Json_Product')->Hydrate($product));
}
return Mage::helper('myHelper')->ConvertToJson($this);
}
It's working. However, I was just wondering if that addFieldToFilter() is going to have any repercussions that I can't currently see?
Magento 1.9.x