2

I have added custom option in product as selectbox. Its showing fine on frontend but in select box + sign its showing. Is there a way to remove + Sign Symobl

Select Box here

Select Box options are

-- Please Select --

400x600x300 + Rs1,992.00

450x600x300 + Rs2,121.00

I have change js/varien/configurable.js changed this line

var str = '';
    price = parseFloat(price);
    if(showSign){
        if(price<0){
            str+= '-';
            price = -price;
        }
        else{
            str+= '+'; **to**
            str+= ' '; 
        }
    }

But it's not working.

1 Answer 1

3

The "+" sign indicates that there is an additional charge for the custom option in addition to the product price.

If you set a price to the custom option, the "+" sign will appear together with the price. This is actually a good thing indicating your customers that there is an extra price for the option.

Here's how to find out, where the "+" sign comes from and how to change it:

First: Enable template hints form the backend and add Block names:

  • System > Configuration > Developer > Debug > Template Path Hints
  • System > Configuration > Developer > Debug > Add Block Names

From there you can see, that the template frontend\base\default\template\catalog\product\view\options\type\select.phtml with its block Mage_Catalog_Block_Product_View_Options_Type_Select is used.

In the Template, the getValuesHtml() method is called from the block.

The getValuesHtml() method contains a call to _formatPrice():

foreach ($_option->getValues() as $_value) {
                $priceStr = $this->_formatPrice(array(
                    'is_percent'    => ($_value->getPriceType() == 'percent'),
                    'pricing_value' => $_value->getPrice(($_value->getPriceType() == 'percent'))
                ), false);
}

_formatPrice() is a function of Mage_Catalog_Block_Product_View_Options_Abstract where the "+" sign is set:

protected function _formatPrice($value, $flag=true)     {
    ...
        $sign = '+';
    ...
}

How to change it:

Please do not edit core files (PHP or JavaScript) of your Magento installation.

The best way would be to declare a new block (in a base-module you have or a new one), for example YourNamespace_YourModule_Product_View_Options_Type_Select which extends from Mage_Catalog_Block_Product_View_Options_Type_Select where you override the protected _formatPrice() function.

You will then need to change the block in your local.xml:

<block type="catalog/product_view" ...>
...
<action method="addOptionRenderer">
<type>select</type>
<block>yourmodule/product_view_options_type_select</block>
<template>catalog/product/view/options/type/select.phtml</template>
</action>
...
</block>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.