October 23, 2013

Magento Product price in Custom Option on Product View Page

Go to app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
Go to line around 60.

Just replace the foreach loop with following code.

//Code for foreach loop
foreach ($_option->getValues() as $_value) {
                $priceStr = $this->_formatPrice(array(
                    'is_percent'    => ($_value->getPriceType() == 'percent'),
                    'pricing_value' => $_value->getPrice(($_value->getPriceType() == 'percent'))
                ), false);
                
                $pro_price = $this->helper('core')->currencyByStore($this->getProduct()->getPrice(),$store,false);                
                
                $select->addOption(
                    $_value->getOptionTypeId(),
                    $_value->getTitle() . ' ( '.$pro_price.' ) ' . $priceStr . '',
                    array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false))
                );
            }

No comments:

Post a Comment

Thank you very much for your comment.
Your message has been successfully sent out to author of this blog.