我在这里看到了答案,它让我有75%的方式,然而,有没有办法区分捆绑产品和简单产品?
Determine if on product page programmatically in Magento
运行Magento 1.11
答案 0 :(得分:3)
switch ($product->getTypeId()) {
case Mage_Catalog_Model_Product_Type::TYPE_SIMPLE:
//...
break;
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
//...
break;
case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
//...
break;
case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
//...
break;
case Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL:
//...
break;
}