如何在产品网格中添加自定义 SQL 调用。
这是我到目前为止所拥有的:
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('sku')
->addAttributeToSelect('name')
->addAttributeToSelect('attribute_set_id')
->addAttributeToSelect('type_id');
$collection->joinField(
'quantity_in_stock',
'advancedinventory',
'quantity_in_stock',
'product_id=entity_id',
'advancedinventory.place_id=1',
'inner'
);
$this->addColumn('quantity_in_stock',
array(
'header'=> Mage::helper('catalog')->__('Custom Column'),
'width' => '80px',
'type' => 'number',
'index' => 'quantity_in_stock'
));
但这似乎不起作用,我需要从表advancedinventory
中获取product_id
该实体的 id 并且place_id
始终等于 1 的值。
任何人都可以提供任何帮助吗?