Pre Exam Test Practice
Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
adding attributes to collection requests in magento
adding attributes to collection requests in magento ¬†using -'php,magento'
I hope someone can help me puzzle this one out. I'm trying to load some data out of a Magento catalog model using a collection. The code looks like this:
$model = Mage::getModel('catalog/product');
$collection = $model->getCollection();
$collection->addFieldToFilter('SKU',array('like' => array('%EBOOK%')));
This produces a dump of objects with all the fields in the flat catalog product table, but not the field that I have requested with the $collection->addAttributeToSelect() method. No matter what field I specify with this method (even '*'), I cannot get the collection to return anything other than its standard set of fields. I also can't unset any fields using $collection->removeFieldFromSelect(NULL) which is supposed to work.
Am I doing something stupid/wrong/both?
Thanks in advance.
Oct 11, 2015
to add a comment.
Related Hot Questions
Government Jobs Opening