Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Custom Options +$10.00 in Magento 1.7

Tags:

magento

Hello I am using magento 1.7. I have configurable product and simple products both have custom options... I want to remove the +$10.00 next to the option Example: custom option: Large +$5.00 I would like it to appear as Large... I still want the price to update on the product's view page. I tried editing the js/varien/product.js commenting out the str+ but didn't work

//str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')';
            } else {
                //str+= ' ' + this.formatPrice(price, true);
            }
        }
        return str;
    },
formatPrice: function(price, showSign){
    var str = '';
    price = parseFloat(price);
    if(showSign){
        if(price<0){
            //str+= '-';
            price = -price;
        }
        else{
            //str+= '+';
        }
like image 817
ryanb4614 Avatar asked Nov 20 '12 12:11

ryanb4614


3 Answers

You'll want to look into Mage_Catalog_Block_Product_View_Options_Abstract::_formatPrice() [link].

It's not possible to rewrite this method using the framework. As the display logic which uses this method potentially touches many areas, I would look into a CSS-based solution. While this may appear hackish, it's likely cleaner than trying to extend each subclass to handle your logic. The following would work for the default theme:

#product-options-wrapper span.price-notice,
#product-options-wrapper span.price { display:none } 
like image 56
benmarks Avatar answered Oct 27 '22 09:10

benmarks


Using the comment from user "R.S" above I was able to fix this issue for my website. Here is a screenshot from my website showing the fix works http://tinypic.com/r/5pexz4/5

Find the file

/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php

Go to lines 70 - 74

$select->addOption(
                $_value->getOptionTypeId(),
                $_value->getTitle() . ' ' . $priceStr . '',
                array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false))
            );

Remove this code from line 72

. ' ' . $priceStr . ''

OR comment out the code

$_value->getTitle() /*. ' ' . $priceStr . ''*/,

be sure to leave the "," at the end of the statement. My code now looks like this and works fine.

$select->addOption(
                $_value->getOptionTypeId(),
                $_value->getTitle() /*. ' ' . $priceStr . ''*/,
                array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false))
            );

I hope this helps you and other who are looking for the same fix!

like image 43
Matt Avatar answered Oct 27 '22 11:10

Matt


Add this JavaScript to template/catalog/product/view.phtml

<script>    
// Override formatting in "js/varien/configurable.js"
Product.Config.prototype.formatPrice = Product.Config.prototype.formatPrice.wrap(
      function(parentMethod, price, showSign){ return ''; }
);
</script>

Or you could create a new JS file with the above code and include it via local.xml in a block for the product detail and product review pages.

like image 20
Justin Avatar answered Oct 27 '22 09:10

Justin