Php Magento产品网格。将可配置产品数量显示为关联简单产品的总和
我试图让Magento在产品网格中显示可配置产品的库存。显然,可配置产品没有数量,所以我的意思是我想修改产品数量的显示方式,类似于:Php Magento产品网格。将可配置产品数量显示为关联简单产品的总和,php,magento,magento-1.5,Php,Magento,Magento 1.5,我试图让Magento在产品网格中显示可配置产品的库存。显然,可配置产品没有数量,所以我的意思是我想修改产品数量的显示方式,类似于: if (product != configurable) {qty = do what it normally does} else {get collection of associated products. qty = sum of qty of that collection;} 我发现了几个与数量相关的控制器,比如Block/Catalog/Pr
if (product != configurable)
{qty = do what it normally does}
else
{get collection of associated products.
qty = sum of qty of that collection;}
我发现了几个与数量相关的控制器,比如Block/Catalog/Product/grid.php
protected function _prepareCollection()
{
$collection = $this->getCollection();
if($queryString = $this->getQueryStr()) {
$collection = Mage::Helper('enhancedgrid')
->getSearchCollection($queryString, $this->getRequest());
}
if(!$collection) {
$collection = Mage::getModel('catalog/product')->getCollection();
}
$store = $this->_getStore();
$collection
->joinField('qty',
'cataloginventory/stock_item',
'qty',
'product_id=entity_id',
'{{table}}.stock_id=1',
'left');
$collection->addAttributeToSelect('sku');
但我一直没能在这上面找到任何地方
如果这一切都不可能——只需添加“库存可用性”结果就足够了
编辑:^这将不起作用,因为可配置产品“有库存”,但所有关联产品都“缺货”
谢谢+你有没有用过这个?