0

我的 list.phtml 中有这个自定义代码,用于在产品数量变为 0 时显示图像:

    <?php $stock_count = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
if ($stock_count <1) {

    echo '<span style="position:relative;top:-230px;float:right;"><img src="http://www.mysite.com/images/ico_outofstock.png" border=0></span>';


} 
?>

问题是,如果产品是可配置的,它仍然会显示缺货图像。
我需要的是添加类似

if($_product->isConfigurable()) { 

到上面的代码,所以outofstock图像将只显示简单的产品。
谢谢

4

0 回答 0