Showing posts with label configurable. Show all posts
Showing posts with label configurable. Show all posts

Monday, September 19, 2011

How to get configurable products attributes / super attributes details in magento?

   $productId = $_product->getId();
   $product=Mage::getModel("catalog/product")->load($prodcutId);
 
    /**
     * Get Configurable Type Product Instace and get Configurable attributes collection
     */
    $configurableAttributeCollection=$product->getTypeInstance()->getConfigurableAttributes();
 
    /**
     * Use the collection to get the desired values of attribute
     */
    foreach($configurableAttributeCollection as $attribute){
        echo "Attr-Code:".$attribute->getProductAttribute()->getAttributeCode()."
"; echo "Attr-Label:".$attribute->getProductAttribute()->getFrontend()->getLabel()."
"; echo "Attr-Id:".$attribute->getProductAttribute()->getId()."
"; }

Monday, September 12, 2011

Configurable products options are empty after moving my cart side bar to header?

I have explained Moving Cart from Right Sidebar to Header in this tutorial. After moving my cart to header I have noticed configurable options are not shown up in header. To display configurable product options do the following.

Edit your "template/checkout/cart/sidebar/default.phtml" file.
Find the line if ($_options = $this->getOptionList()):

Replace with the following
$_product = Mage::getModel('catalog/product')->load($this->getProduct()->getId());
$config = new Mage_Catalog_Helper_Product_Configuration();  
if ($_options = $config->getConfigurableOptions($_item)): 
Thats it. You are done.