Find the local.xml in local \magentoappetclocal.xml <pre class="brush:xml"> <config>…
May 9, 2015
Magento: 显示所有子库存 Show inventory of simple product of configurable products
//$_product = $this->getProduct() foreach ($_product->getTypeInstance(true)->getUsedProducts ( null, $_product) as $simple) { $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($simple)->getQty(); $sizename = $simple->getResource()->getAttribute('size')->getFrontend()->getValue($simple); echo $simple->getName()." with size $sizename (".$simple->getSize().") have a stock of $stock"; echo '<br/>'; }
来源:http://stackoverflow.com/a/25652768/602382