public function run()
{
$products = Mage::getModel('catalog/product')
->getCollection()
->addFinalPrice()
->addAttributeToSelect('name')
Mage::getSingleton('core/resource_iterator')
->walk($products->getSelect()->limit(10), array(array($this, 'getLine')));
}
public function getLine($args)
{
var_dump($args['row']);
}
No meu getLine()
método, não recebo, name
mas addFinalPrice()
funciona:
array(16) {
["entity_id"]=>
string(2) "61"
["entity_type_id"]=>
string(1) "4"
["attribute_set_id"]=>
string(2) "10"
["type_id"]=>
string(6) "simple"
["sku"]=>
string(15) "50-F01010001-03"
["has_options"]=>
string(1) "0"
["required_options"]=>
string(1) "0"
["created_at"]=>
string(19) "2011-07-05 18:30:48"
["updated_at"]=>
string(19) "2014-09-04 07:34:21"
["indexed_price"]=>
string(7) "14.5000"
["price"]=>
string(7) "14.5000"
["final_price"]=>
string(7) "14.5000"
["minimal_price"]=>
string(7) "14.5000"
["min_price"]=>
string(7) "14.5000"
["max_price"]=>
string(7) "14.5000"
["tier_price"]=>
NULL
}
Mesmo problema com image
, price
e todos os outros atributos.
fonte
ini_set('memory_limit','512M');
.Você deve usar o segundo parâmetro
'inner'
assim:Consulte: /programming/24614533/magento-collection-iterator-cannot-get-additional-attribute
fonte
addAttributeToSelect('*')