Determine type of product page the user is on

2019-08-11 13:58发布

问题:

I was looking at the answer here and it gets me 75% of the way there, however, is there a way to distinguish between a bundle product versus a simple product?

Determine if on product page programmatically in Magento

Running Magento 1.11

回答1:

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;
}


标签: magento