Yesterday I wrote code to pull out a collection of products. This code worked fine, but today the code doo snot works, nothing has changed, I donβt understand why it will not work.
This is what I encoded
$collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('MPN') ->addAttributeToSelect('JAN') ->addAttributeToSelect('UPC') ->addFieldToFilter(array( array('attribute'=>'type_id','eq'=>'simple') )) ->setPage(1,10); $collection->load(); foreach($collection as $item) { echo print_r($item->getdata()); }
Yesterday, I was able to see a list of products in which my MPN, JAN, and UPC were (these are special attributes in the backend). Today they do not load at all. This is strange, damn it, I think maybe my understanding of collections is not as good as I thought.
Any help would be greatly appreciated.
EDIT:
A magento cache update showed that everything was working again. Does this mean that the cache is sometimes used in the collection, is it possible to somehow write code so that it does not use the cache?
source share