trigger events for product option change

  • Posts: 19
  • Thank you received: 0
8 years 2 months ago #249400

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2
-- PHP version -- : 5.4.45
-- Browser(s) name and version -- : chrome 52.0.2743.116 m

Hi,
im developing a plugin that will recalculate product price in the front end based on a certain percentage taken from product option change,
(since product option doesn't have an option to use %)

example:

product name:
"custom business card print"

product variations:
1. amount (100,200,300....)
2. lamination (yes, no)

product options:
1.paper type:
a. normal (price $0) ( total price + 0%)
b. special (price $0) ( total price + 20%)
c. recycled (price $0) ( total price + 35%
d. metal (price $0) ( total price + 70%

challenge:

recalculate total product price on product option change event .

looking for the event trigger that happens after product option change. does this exist ?
if not, what should i do :
1. to catch such an event
2. what function can i use to get current total price, change it and update it on the product page (just like it happens when variations or product options are changed)

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 2 months ago #249403

Hi,

You can edit the file "option" of the view "product" via the menu Display>Views.
There, you can modify the javascript code to add your own code and recalculate the product price based on your needs.
You'll see in the javascript code there, the total price calculated is in price_with_options.value

Please Log in or Create an account to join the conversation.

  • Posts: 19
  • Thank you received: 0
8 years 2 months ago #249468

Thanks very much.

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum