[Skip to main content](#vessel-content)

#   activate options-selectbox by jQuery

##

- **[squareweb](/forum/user/29471-squareweb "View squareweb's Profile")**
- [![squareweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29471-squareweb "View squareweb's Profile") Topic Author
- [ Offline](/forum/user/29471-squareweb)

Less More

- Posts: 68
- Thank you received: 2
-
-

12 years 4 months ago [\#163229](#163229) by [squareweb](/forum/user/29471-squareweb "View squareweb's Profile")  *[activate options-selectbox by jQuery](/forum/31-development/869555-activate-options-selectbox-by-jquery#163229 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : latest -- Joomla version -- : latest -- PHP version -- : 5.4 -- Browser(s) name and version -- : XXXXX x.x.x -- Error-message(debug-mod must be tuned on) -- :NA  Hi,  I'm building a custom product-configurator. Each product contains a select box. When activating the select box the price is re-calculated. This works fine.  Problem:  I've created a button which should trigger the original select box. I can change the value of the hikashop-original-checkbox, no problem here (see jQuery code below).  Te problem is how to activate (which) js-code(event) in this way that the product-price is re-calculated in cart and onscreen.  I guess something like: jQuery('#hikashop&#95;product&#95;option&#95;0').val(76).trigger('change'); // set the option-value of select box based on my button-click.  hikashopRefreshOptionPrice(); // recalculate price (this is not working???)  I guess I'm missing some js/php include code?  Hope you can help me with this one.  Thanks in advance  Mark")* was created by *[squareweb](/forum/user/29471-squareweb "View squareweb's Profile")*

-- url of the page with the problem -- : [ mywebsite.com/mypage](http://mywebsite.com/mypage)
-- HikaShop version -- : latest
-- Joomla version -- : latest
-- PHP version -- : 5.4
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- :NA

Hi,

I'm building a custom product-configurator.
Each product contains a select box. When activating the select box the price is re-calculated.
This works fine.

Problem:

I've created a button which should trigger the original select box. I can change the value of the hikashop-original-checkbox, no problem here (see jQuery code below).

Te problem is how to activate (which) js-code(event) in this way that the product-price is re-calculated in cart and onscreen.

I guess something like:
jQuery('#hikashop_product_option_0').val(76).trigger('change'); // set the option-value of select box based on my button-click.

hikashopRefreshOptionPrice(); // recalculate price (**this is not working???)**

I guess I'm missing some js/php include code?

Hope you can help me with this one.

Thanks in advance

Mark

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2OTU1NS1hY3RpdmF0ZS1vcHRpb25zLXNlbGVjdGJveC1ieS1qcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

12 years 4 months ago [\#163242](#163242) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[activate options-selectbox by jQuery](/forum/31-development/869555-activate-options-selectbox-by-jquery#163242 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : latest -- Joomla version -- : latest -- PHP version -- : 5.4 -- Browser(s) name and version -- : XXXXX x.x.x -- Error-message(debug-mod must be tuned on) -- :NA  Hi,  I'm building a custom product-configurator. Each product contains a select box. When activating the select box the price is re-calculated. This works fine.  Problem:  I've created a button which should trigger the original select box. I can change the value of the hikashop-original-checkbox, no problem here (see jQuery code below).  Te problem is how to activate (which) js-code(event) in this way that the product-price is re-calculated in cart and onscreen.  I guess something like: jQuery('#hikashop&#95;product&#95;option&#95;0').val(76).trigger('change'); // set the option-value of select box based on my button-click.  hikashopRefreshOptionPrice(); // recalculate price (this is not working???)  I guess I'm missing some js/php include code?  Hope you can help me with this one.  Thanks in advance  Mark")*

Hi,

It's the function hikashopChangeOption() that you need to call. The function hikashopRefreshOptionPrice() will only do the display of the new price while the hikashopChangeOption() function does both the recalculation and the display of the new price.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2OTU1NS1hY3RpdmF0ZS1vcHRpb25zLXNlbGVjdGJveC1ieS1qcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[squareweb](/forum/user/29471-squareweb "View squareweb's Profile")**
- [![squareweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29471-squareweb "View squareweb's Profile") Topic Author
- [ Offline](/forum/user/29471-squareweb)

Less More

- Posts: 68
- Thank you received: 2
-
-

12 years 4 months ago [\#163336](#163336) by [squareweb](/forum/user/29471-squareweb "View squareweb's Profile")  Replied by *[squareweb](/forum/user/29471-squareweb "View squareweb's Profile")* on topic *[activate options-selectbox by jQuery](/forum/31-development/869555-activate-options-selectbox-by-jquery#163336 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : latest -- Joomla version -- : latest -- PHP version -- : 5.4 -- Browser(s) name and version -- : XXXXX x.x.x -- Error-message(debug-mod must be tuned on) -- :NA  Hi,  I'm building a custom product-configurator. Each product contains a select box. When activating the select box the price is re-calculated. This works fine.  Problem:  I've created a button which should trigger the original select box. I can change the value of the hikashop-original-checkbox, no problem here (see jQuery code below).  Te problem is how to activate (which) js-code(event) in this way that the product-price is re-calculated in cart and onscreen.  I guess something like: jQuery('#hikashop&#95;product&#95;option&#95;0').val(76).trigger('change'); // set the option-value of select box based on my button-click.  hikashopRefreshOptionPrice(); // recalculate price (this is not working???)  I guess I'm missing some js/php include code?  Hope you can help me with this one.  Thanks in advance  Mark")*

Thanks Nicolas,

I've tried this before but this is not working. I guess this has to do with scoping?
I've included my jQuery-code in a separate js-file in which I call your function (after page loaded).
Do I have to load some specific js-file or functions before I can call them?

Your function is not showing any result.

Hope you can help me further.
Thanks in advance

See below code snippet:

// toggle with / without custom text
jQuery('#hikashop_product_option_0').on('change', function() {
set_text_jn(jQuery(this).val());
jQuery('#hikashop_product_option_0').val(76).trigger('change');
hikashopChangeOption(); // call update option price-function
});

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2OTU1NS1hY3RpdmF0ZS1vcHRpb25zLXNlbGVjdGJveC1ieS1qcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

12 years 4 months ago [\#163460](#163460) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[activate options-selectbox by jQuery](/forum/31-development/869555-activate-options-selectbox-by-jquery#163460 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : latest -- Joomla version -- : latest -- PHP version -- : 5.4 -- Browser(s) name and version -- : XXXXX x.x.x -- Error-message(debug-mod must be tuned on) -- :NA  Hi,  I'm building a custom product-configurator. Each product contains a select box. When activating the select box the price is re-calculated. This works fine.  Problem:  I've created a button which should trigger the original select box. I can change the value of the hikashop-original-checkbox, no problem here (see jQuery code below).  Te problem is how to activate (which) js-code(event) in this way that the product-price is re-calculated in cart and onscreen.  I guess something like: jQuery('#hikashop&#95;product&#95;option&#95;0').val(76).trigger('change'); // set the option-value of select box based on my button-click.  hikashopRefreshOptionPrice(); // recalculate price (this is not working???)  I guess I'm missing some js/php include code?  Hope you can help me with this one.  Thanks in advance  Mark")*

Hi,

I don't see why it wouldn't work unless some of the HTML that the function expect to be there has been removed/altered.
The function is global and can be called from anywhere.

Did you get any error message ?
If you give a link to the page we can have a look at what you did.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2OTU1NS1hY3RpdmF0ZS1vcHRpb25zLXNlbGVjdGJveC1ieS1qcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[squareweb](/forum/user/29471-squareweb "View squareweb's Profile")**
- [![squareweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29471-squareweb "View squareweb's Profile") Topic Author
- [ Offline](/forum/user/29471-squareweb)

Less More

- Posts: 68
- Thank you received: 2
-
-

12 years 4 months ago -  12 years 4 months ago [\#163480](#163480) by [squareweb](/forum/user/29471-squareweb "View squareweb's Profile")  Replied by *[squareweb](/forum/user/29471-squareweb "View squareweb's Profile")* on topic *[activate options-selectbox by jQuery](/forum/31-development/869555-activate-options-selectbox-by-jquery#163480 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : latest -- Joomla version -- : latest -- PHP version -- : 5.4 -- Browser(s) name and version -- : XXXXX x.x.x -- Error-message(debug-mod must be tuned on) -- :NA  Hi,  I'm building a custom product-configurator. Each product contains a select box. When activating the select box the price is re-calculated. This works fine.  Problem:  I've created a button which should trigger the original select box. I can change the value of the hikashop-original-checkbox, no problem here (see jQuery code below).  Te problem is how to activate (which) js-code(event) in this way that the product-price is re-calculated in cart and onscreen.  I guess something like: jQuery('#hikashop&#95;product&#95;option&#95;0').val(76).trigger('change'); // set the option-value of select box based on my button-click.  hikashopRefreshOptionPrice(); // recalculate price (this is not working???)  I guess I'm missing some js/php include code?  Hope you can help me with this one.  Thanks in advance  Mark")*

Nicolas, you're right, my bad.
I'd forgotten to trigger the change-event.......

It works fine now.

Thanks again.

Mark

Last edit: 12 years 4 months ago by [squareweb](/forum/user/29471-squareweb "View squareweb's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2OTU1NS1hY3RpdmF0ZS1vcHRpb25zLXNlbGVjdGJveC1ieS1qcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.047 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
