Magento – Update product custom option price on product price change

custom-optionsmagento-1.9price

Background

Currently I have a product with a few custom options and all are radio buttons. Each of the rows in the options are priced based on percentage. On the frontend everything is displayed as you would expect:

  1. The custom options prices are based off of the price defined in the product.
  2. When you select one of the options it adds the price of the option and the base price.

I have an extension installed called Custom Math Pricing (https://www.micosolutions.com/custom-math-pricing) with this extension I am updating the product price on the frontend based on numbers entered in a custom option (text field type) which goes through a formula I created in the extension.

My problem

When the product price is updated on the frontend the custom option's (radio buttons) prices are not.

What I'm expecting

When the product price changes the custom options prices with percentage pricing should recalculate percentage based off of the new product price. For example, if the initial product price is $1.00 and the custom option price is 90% then the custom option price is $0.90. When the product price updates to $10.00 the custom option price being at 90% should now show $9.00 instead of staying $0.90(the price based off of the initial price).

Questions

  1. Am I able to see the custom option row percentage on the frontend?
  2. Is there a frontend javascript class that I can use to update the custom option price on the frontend or do I need to create this?

Best Answer

go to app/design/frontend/theme_package/theme/layout/catalog.xml

in below action

<catalog_product_view>
</catalog_product_view>

add this code

<reference name="head">
            <action method="addJs"><script>varien/product.js</script></action>
            <action method="addJs"><script>varien/product_options.js</script></action>
            <action method="addJs"><script>varien/configurable.js</script></action>

</reference>
Related Topic