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.

asked Oct 19, 2015 by kotmus2002
0 votes
1 view

Related Hot Questions

1 Answer

0 votes
answered Oct 19, 2015 by mannumits1