A more challenging task is to get the options and values that are applicable to a particular configurable product. This can solved using the following code:
Open app/design/frontend/yourpackage/yourtheme/template/catalog/product/view.phtml
and copy and paste this code
<?php $cProduct = Mage::getModel('catalog/product')->load($_product->getId());
//check if product is a configurable type or not
if ($cProduct->getData('type_id') == "configurable")
{
//get the configurable data from the product
$config = $cProduct->getTypeInstance(true);
//loop through the attributes
foreach($config->getConfigurableAttributesAsArray($cProduct) as $attributes)
{
?>
<dl>
<dt><label class="required"><em>*</em><?php echo $attributes["label"]; ?></label></dt>
<dd>
<div class="input-box">
<select name="super_attribute[<?php echo $attributes['attribute_id'] ?>]" id="attribute<?php echo $attributes['attribute_id'] ?>">
<?php
foreach($attributes["values"] as $values)
{
echo "<option>".$values["label"]."</option>";
}
?>
</select>
</div>
</dd>
</dl>
<?php
}
}?>
THANKS !!
ReplyDeleteHi,
ReplyDeleteCan I get product option list data on header.phtml file or any other file, where I wanted. Becuase since few days I am struggliing with that, aprart fom options_lists.ptml I am not able to get those data, please suggest.
any help wld b greatly appreciated.
Hi Vivek,
DeletePlease read this http://magebug.blogspot.in/2016/03/magento-techniques-to-show-configurable.html
Hi,
ReplyDeleteThanks for post but i want to show options on custom popup window, and after select first option accordingly second appear (like product page), then need to add cart with selected option from there. Please suggest for the same.
Regards,
Saurabh
Hi Saurabh,
DeleteRead this http://magebug.blogspot.in/2016/03/magento-techniques-to-show-configurable.html
Thank you.
ReplyDeletehi how to change price for the option selected
ReplyDeletethanks
Hi Vellai Durai,
DeleteRead this http://magebug.blogspot.in/2016/03/magento-techniques-to-show-configurable.html
Thanks for the best blog.it was very useful for me.keep sharing such ideas in the future as well.this was actually what i was looking for,and i am glad to came here!
ReplyDeletemagento development company in bangalore
Magento 2 Configurable Product Wholesale Display supports showing all associated products in a grid table view which allows wholesale customers to order and add all chosen items to cart at once.
ReplyDeleteCheck it here: https://bsscommerce.com/configurable-product-wholesale-display-for-magento-2.html
Very much informative. Keep sharing such blogs.
ReplyDeleteMagento support and maintenance agency