Magento 1.7 – Custom Options & Simple Configurable Products Fix

Magento 1.7 Price Reset to 0.00Those who recently upgraded their Magento store to Magento 1.7 may have encountered the issue of the product price resetting to zero when choosing a custom option. This error can occur due to several reasons, especially on custom themes and happens both on configurable products' custom options and that of simple products.

Price Resetting to 0.00 when Custom Option Clicked

Some Facts about the error: [list]
  • The error is JavaScript related and occurs due to html block conflicts
  • The price change error is dynamic, hence the price is accurate when checking out
  • It occurs on any custom option types, including drop-downs, multiple select, radio buttons and checkboxes
  • The issue also occurs on simple products associated with configurable products, group and bundled products
  • [/list]

    For those who do not find the solution via the below fixes, we have implemented advanced modifications or used alternative methods that we will be publishing either for manual implementation or possibly as an extension. To get notified, feel free to register and/or subscribe:

    Fix Price Resetting on Magento 1.7

    If you are not using a Magento plugin for your custom options, the error would be likely theme related. If you are just starting your Magento development, I recommend using the Magento plugin Simple Configurable Products. If you intend to use the plugin or already use it, you can skip to the Simple Configurable Product Custom Options Fix. Otherwise, Here are some possible solutions to fix the custom options error on your custom theme (remember to backup files you overwrite):

    1. Updating catalog/products/view .phtml files
    2. If your base theme files are updated, you can use them to update your custom theme files by moving options.phtml, price.phtml and other theme files:

      Move the files from /app/design/frontend/base/default/template/catalog/product/view/ to /app/design/frontend/default/[yourtheme]/template/catalog/product/view/

      Some custom themes may not have the files in your product/view/ folder, yet adding them will still make Magento prioritize them if the files exist. Consider transferring the .XML files from the /layout folder as well.

    3. Editing the price_clone.phtml block
    4. Should the above option not work for you, you can also edit the price_clone.phtml block in two ways. Note that this method will only make the bottom price-block not change. So if you use custom options that change prices, or only use the top price block, this option may not be suitable.

      Via template file:

      Find your price_clone.phtml block in the product/view/ folder and find the following line:

      <?php echo $this->getPriceHtml($_product, false, '_clone') ?>
      and Replace with:
      <?php echo $this->getPriceHtml($_product, false) ?>
      Via local xml file:

      For those who prefer editing their xml layout files, they can deactivate the block instead in catalog.xml. In catalog.xml, find the bottom.phtml block:

      <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
      <label>Bottom Block Options Wrapper</label>
      <action method="insert"><block>product.tierprices</block></action>
      <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
      <action method="append"><block>product.info.addtocart</block></action>
      <action method="append"><block>product.info.addto</block></action>
      </block>
      And replace the highlighted line (241) with:
      <block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data" template="catalog/product/view/type/default.phtml"/>
    5. Editing the product.js file
    6. If the above methods don't work or if you're looking for a more orthodox solution, you can change the JavaScript files themselves to work according to your theme. For this part, a well explained post has been posted here.

    The last method should resolve the custom options issue and allow dynamically updating the price upon switching of options. If those don't fix the error then the issue would be theme or plugin related, which brings us to the SCP plugin fix.

    Fix Simple Configurable Products Custom Options Pricing

    Magento 1.7 Simple Configurable ProductsSCP is a great plugin for configurable products, which is why it's been supported by the community ever since it was deprecated. Since the last Magento update, there have been more issues than just the custom options, specifically related to the Product / Price Indexing, which I will cover on the next post.

    First, confirm that the following are true:
    • You installed the most recent SCP extension on your Magento 1.7.x site.
    • Assure that the plugin works, other than the error and indexing issues (if those occur). So when you checkout, the price of the custom option is active, or if its a configurable product, that the simple product price shows up.
    • Although this is optional, I advise to copy over the plugin files from the base folder into your active template folder, if it isn't already.

    Next, you will edit the plugins scpoptions.phtml file, which requires 4 small changes to fix the custom options. Open the file app/design/frontend/default/[your_theme]/template/catalog/product/view/scpoptions.phtml and make the changes to the following lines, simply by adding .price in the parseFloat:

    if (this.config[optionId]) {
                        if (element.type == 'checkbox' || element.type == 'radio') {
                            if (element.checked) {
                                if (config[optionId][element.getValue()]) {
    				price += parseFloat(config[optionId][element.getValue()].price);
                                }
                            }
                        } else if(element.hasClassName('datetime-picker') &amp;&amp; !skipIds.include(optionId)) {
                            dateSelected = true;
                            $$('.product-custom-option[id^="options_' + optionId + '"]').each(function(dt){
                                if (dt.getValue() == '') {
                                    dateSelected = false;
                                }
                            });
                            if (dateSelected) {
    			    price += parseFloat(this.config[optionId].price);
                                skipIds[optionId] = optionId;
                            }
                        } else if(element.type == 'select-one' || element.type == 'select-multiple') {
                            if (element.options) {
                                $A(element.options).each(function(selectOption){
                                    if (selectOption.selected) {
                                        if (this.config[optionId][selectOption.value]) {
    					price += parseFloat(this.config[optionId][selectOption.value].price);
                                        }
                                    }
                                });
                            }
                        } else {
                            if (element.getValue().strip() != '') {
                                price += parseFloat(this.config[optionId].price);
                            }
                        }
                    }
                });

    After adding the .price to the highlighted lines, you can upload and replace the original which should resolve the custom options issue. Make sure to clear your cache before testing.

    Continue to references and other errors on the next page.

    Other Errors

    If you just started using Simple Configurable Products on your Magento install, you may encounter other unrelated issues, such as the re-indexing of flat products and prices. You can find most fixes to any of these issues from this SPC pull request on github. But the ones I found most important are:

    Feel free to point out mistakes or better solutions for this fix or comment any questions.
    I'm a developer at Maximus Business.
    • Leandro
      Thanks! i love this plugin and with this fixes now is working like a charm

      Said on Oct 13, 2012 by Leandro - Reply
    • alvaroesc
      Hi, thank you for those fixes, it helped me a lot. But now I have a little problem wiht custom options in configurable product (CP). If I choose a custom option of CP, it works fine until the moment I select a simple product (color, for example). In that moment, price come back to ignore the custom option of CP. And if I add to cart the article, it still ignore price of custom option of CP and the custom options doesnt show up neither in the product name. I can solve it adding the custom options in each simple product associated, but it is a lot of time, and the custom options doesnt show up until a simple product is chosed. ¿Do you know how can I fix it? Maybe making the custom options of CP are before than choose a simple product...but I dont know hot to do it neither. Best regards.

      Said on Oct 19, 2012 by alvaroesc - Reply
      • Avatar of Maximilian
        Maximilian Rutheactive 1 week, 1 day ago
        By using the Simple Configurable Products plugin, your configurable products will automatically go by the price of the simple products you assign it to, as well as its custom options. So make sure that the custom options of the CP is actually a Simple Product, and that any custom options are attached to that. Also make sure that you are using the second method of the above methods: Fix for Simple Configurable Products Price Reset

        Said on Oct 20, 2012 by Maximilian Ruthe - Reply
    • Vishal
      Thanks! it is working for me

      Said on Oct 26, 2012 by Vishal - Reply
    • Jorge
      Hi, thanks for your blog about SCP.... I'm having an issue with SCP, everything works fine except that when I select an item configured with the same options as a previous selected item that is already in Cart, this last item goes to the same row in the Cart and the image and SKU from the previous item is updated with the image and SKU from the new added item and the quantity on that row just increments by the number you put in the box when adding to the Cart... But in the other hand, when you do the same with Wishlist everything goes right, even when you move these items to the Cart, they go to different rows/lines.... Hope I had explain myself Thanks in advance

      Said on Nov 12, 2012 by Jorge - Reply
    • Ryan
      Hello. Thank you for your help. Everything is working until I add a custom option it adds to the cart correctly but the price updates as $0.00 on the product page. I am adding the custom option to the simple product for the configurable product like instructed. Please advise.

      Said on Nov 14, 2012 by Ryan - Reply
    • Jagesh
      Hi, How to calculate percentage based price from total price or from final price instead of using base price. For eg : Base price: $0 Size A: +$20 Color X: +10% Magento's calculation: 10 % of base price 0 = 0. Total price 20. Desired calculation: 10 % of base price AND size price = 10 % of 20. Total price 22. i dont know how to modify this and get proper results Please help

      Said on Nov 15, 2012 by Jagesh - Reply
      • Trupti
        Hi, I also want same functionality which you want. I want to calculate percentage based price from total price instead of base price for configurable product. Please help me.

        Said on Apr 1, 2013 by Trupti - Reply
    • Dheeraj
      my magento price of 10 kg is 39.99 and 4 kg is 19.99 but now show 40.79 in place of 39.99 show 20.99 in place of 19.99 Please give me solution

      Said on Nov 25, 2012 by Dheeraj - Reply
    • 3po
      I have tried nearly all fork version's from SCP, have setup a fresh magento installation and installed only SCP, but at all SCP version's it is not possible to edit configurable products after add to cart? If the customer click the product edit link in the Shopping cart, the follow message show "Cannot configure product." Have anybody the same issue?

      Said on Dec 13, 2012 by 3po - Reply
      • Gijs
        Hi 3po, I have exactly the same problem, very strange. When adding a configurable product to the cart, the "Edit" option for that product is not showing. Did you already find a solution? I hope or someone else can help me with this!

        Said on Sep 5, 2013 by Gijs - Reply
    • Daniel
      Hi, thanks for the fixes. Just a question, the title, price, description and additional information only changes if you are using the default theme. The title and price changes with other themes, but the description and additional information does not change. Can I get some help please? Thanks.

      Said on Jan 21, 2013 by Daniel - Reply
    • carlos
      Hi, Thank you for the fix. You saved my life!

      Said on Jan 21, 2013 by carlos - Reply
    • barnabas
      Hello Matt, great extension by the way. However, when I add a configurable product to a my cart, it displays the Simple product but not the configurable product even though in settings I have set show configurable product. My debugging so far. With SCP module not activated, $_POST Data below Array( product => 8 //product_id of configurable product related_product => super_attribute=> Array( 139 => 15, 140 => 18 ) qty => 1 ) But with SCP activated Array( product => 6 //product_id of selected simple product related_product => super_attribute=> Array( 139 => 15, 140 => 18 ) qty => 1, cpid => 8 ) Also checked the db Table 'sales_flat_quote_item' , the just the simple product is inserted in the table, the parent_item_id is set to NULL. Without SCP set, you line are inserted in the db Table. First the configurable and then the id used to insert the configurable as the parent_item_id field. Any solutions

      Said on Feb 22, 2013 by barnabas - Reply
    • Merk
      Great post and very well explanation. Its clear to understand and very help full to all magento developer. Thanks for sharing such a great knowledge with us.

      Said on Feb 26, 2013 by Merk - Reply
    • Ayya
      Please can you help me how to display the Options in admin Order page and currently I am using magento 1.7.0.2 and scp extension, I checked the table ( sales_flat_order_item ) in DB and it is storing only simple product not configurable product. I hope if the 2nd record will store and it will display!

      Said on Mar 16, 2013 by Ayya - Reply
    • Steve
      I'm having a real problem with 1.7.0.2 CE. I've tried everything that has been said but I'm still getting a "There was a problem with reindexing process." error. I don't suppose anyone can help?

      Said on Apr 16, 2013 by Steve - Reply
    • Vimal
      Hello, Here is the good example for get simple product id at the configure product detail page at the time of selction of dropdown in magento. http://www.webslike.com/Thread-How-to-get-simple-product-id-on-configuarable-product-detail-page-in-Magento

      Said on Jun 21, 2013 by Vimal - Reply
    • Sameer
      Hello, Thank you for the solution, now I can see updated price in product view. But I am having a different problem. My configurable product's custom option's price doesn't get added to the cart sub total. Do you know why this could be? Thanks

      Said on Jul 4, 2013 by Sameer - Reply
    • Robin T
      Hello, your solution work great, but is there anyone encountering the same problem with te lightbox not working, after the product image refreshes to the chosen color of one of the simple products? Hopefully someone can help me i'm struggeling with this problem for one week already. Thanx,

      Said on Aug 13, 2013 by Robin T - Reply
    • kingshuk
      You save my life.. :D....I need to submit my project today...and after installing SCP i suddenly notice that custom options price is getting 0.After lot of browsing i found your code and it worked perfectly...thanks bro

      Said on Nov 17, 2013 by kingshuk - Reply
    • nitin
      Hello, In my magento 1.7.0.2, suddenly for downloadable products, checkbox options disappeared. Please sort out this issue. I installed another template, those options are appearing then in new template. I doubt it may be template issue. But am using Magento default template. Please Help. Regards,

      Said on Dec 18, 2013 by nitin - Reply
    • Badrish
      Thanks for this saving my time. But here is an error with this I Used your code and now it is not going to zero but still not adding the price of custom option to main price see the URL : see the URL

      Said on Feb 27, 2014 by Badrish - Reply
    • Jungle
      My magento version is 1.8.0, this fix code also works. Very helpful thanks!

      Said on Apr 13, 2014 by Jungle - Reply
    • Surf
      Your the best!!

      Said on May 6, 2014 by Surf - Reply
    • Jan
      I'm using this plugin on EE 1.12.0.0 and I'm having an issue with some items for $0. We have found that Magento didn't charge any cost for some items in some orders. I'm not sure if that would related to the plugin or something else. It's very random issue and other items or either order orders look fine. Does anybody has the same problem? Thanks

      Said on May 13, 2014 by Jan - Reply
    • NItin
      I want to get custom option detail at wishlist page. Please help. Thanks

      Said on Jun 17, 2014 by NItin - Reply
    • Andrew
      This worked great for me with SCP, after my CE 1.5.1.0 to 1.8.1.0 upgrade. Thanks!

      Said on Jun 19, 2014 by Andrew - Reply

    Leave a Reply

    Please feel free to give us your feedback and comment below. Please keep in mind that comments are moderated. Your email address will not be published. Required fields are marked *


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>