How can i get the product type(simplee,configurable/grouped ...) using product sku or id, i have loaded product collection and from that trying to prict type by
$_product->getTypeId()
But its not printing the product type. Please help me
Thanks
I think $_product->getTypeId()
should work. If it doesn't then try $_product->getResource()->getTypeId()
I got product type following way in phtml file
$product=Mage::getModel('catalog/product')->load($product_id);
$productType=$product->getTypeID();
//Simple Product
if($productType == 'simple')
{
echo "Simple Product";
}
//Configurable Product
if($productType == 'configurable')
{
echo "Configurable Product";
}
did you know that you can see whats inside an object by just performing print_r($_product->getData())
Here's another tip.
If you are iterating though Cart Items, then use the getProductType() for the product type information. For example -
foreach( $cartItems as $item ){
if($item->getProductType() == "configurable") {