Organizational Research By

Surprising Reserch Topic

Experts Most Trusted 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->addAttributeToSelect('short_description');
$collection->addFieldToFilter('SKU',array('like' => array('%EBOOK%')));
$collection->load();
var_dump($collection->getData());


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 11, 2015 by nimisha.jagtap
0 votes
3 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...