Does someone know how to check if a product is configurable ?
I want my configurable products to say 'From:' in front of the price on the product list page.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityDoes someone know how to check if a product is configurable ?
I want my configurable products to say 'From:' in front of the price on the product list page.
From the question it is not clear for which version you want to check still I am adding answer,
For M2
you can check like this,
if($product->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE){
echo "product is configurable";
}
Where $product
is \Magento\Catalog\Model\Product
object
For M1
you can check like this,
if($product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE){
echo "product is configurable";
}
Where $product
is Mage_Catalog_Model_Product
object
For configurable product check product type ID using simple code.
if($_product->getTypeId() == 'configurable'){
echo 'This is a configurable product';
}else{
echo 'This is not a configurable product';
}
Thanks
For M1
you can use:
/* Mage_Catalog_Model_Product */
if ($product->isConfigurable()) {
...
}