【发布时间】:2014-06-30 09:15:48
【问题描述】:
如何在产品网格中添加自定义 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。
任何人都可以提供任何帮助吗?
【问题讨论】:
标签: php sql magento zend-framework2 magento-1.9