如果自定义选项下拉列表中的0数量隐藏在magento的产品页面中

时间:2017-02-22 06:35:38

标签: magento-1.9

此产品已在magento后端库存.... enter image description here 如果自定义选项下拉列表中的0数量隐藏在magento的产品页面中 enter image description here

此代码: - 尝试但不工作

<?php
                $product_id = $this->getProduct()->getId();

                $productCollection = Mage::getModel("catalog/product")->load($product_id);

                foreach ($productCollection->getOptions() as $value) {

                    $values = $value->getValues();
                    foreach ($values as $values) {
                        //print_r($values->getData());
                        echo $values->getQty();
                        if($values=="0")
                        {

                        }
                        }
                    $i++;
                }
                ?>

1 个答案:

答案 0 :(得分:0)

            $product_id = $this->getProduct()->getId();
            $productCollection = Mage::getModel("catalog/product")->load($product_id);
            foreach ($productCollection->getOptions() as $value) {
                $values = $value->getValues();
                foreach ($values as $value) {
                    echo $value->getQty();
                    if($value->getQty() == '0')
                    {

                    }
                    }
                $i++;
            }