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

#   Solved - Conditional Option based on option choice

##

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

Less More

- Posts: 86
- Thank you received: 11
-
-

10 years 11 months ago -  10 years 8 months ago [\#223786](#223786) by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")  *[Solved - Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#223786 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")* was created by *[simplecms](/forum/user/32423-simplecms "View simplecms's Profile")*

-- HikaShop version -- : HikaShop Business: 2.6.0
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.4.45

I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.

I have a pretty simple question. I've searched the forum but couldn't find another topic.

I have a product that has an option called Color/Mono with two options either Color or Mono.

What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?

Last edit: 10 years 8 months ago by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODgxMDI5LXNvbHZlZC1jb25kaXRpb25hbC1vcHRpb24tYmFzZWQtb24tb3B0aW9uLWNob2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

10 years 11 months ago [\#223790](#223790) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#223790 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Hi,

Instead of options, you could use custom fields of the table "item" that you can configure via the menu Display&gt;Custom fields.
In that case, the fields can be displayed/hidden based on others thanks to the "Display limited to" setting of each field.
The drawback is that the fields can't change the price of the product so if that's something you need you won't be able to use that method.
I tried to look at your website link you provided but I got a blank page.

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

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

Less More

- Posts: 86
- Thank you received: 11
-
-

10 years 8 months ago -  10 years 8 months ago [\#232397](#232397) by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")  Replied by *[simplecms](/forum/user/32423-simplecms "View simplecms's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232397 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Sorry for the long delay in replying. My client has been somewhat slow on getting this setup.

Yes I do need the conditional option to have a price unfortunately. What can I do to have that work?

Last edit: 10 years 8 months ago by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODgxMDI5LXNvbHZlZC1jb25kaXRpb25hbC1vcHRpb24tYmFzZWQtb24tb3B0aW9uLWNob2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

10 years 8 months ago [\#232400](#232400) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232400 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Hi,

Then you can keep using options and edit the file "option" of the view "product" via the menu Display&gt;Views and add custom javascript code to hide/display the second option based on the value selected in the first one.

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

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

Less More

- Posts: 86
- Thank you received: 11
-
-

10 years 8 months ago -  10 years 8 months ago [\#232506](#232506) by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")  Replied by *[simplecms](/forum/user/32423-simplecms "View simplecms's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232506 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

So I added this: Code:

function check() { var dropdown = document.getElementById("hikashop_product_option_0"); var current_value = dropdown.options[dropdown.selectedIndex].value; if (current_value == "5") { document.getElementById("hikashop_product_option_2").style.display = "block"; } else { document.getElementById("hikashop_product_option_2").style.display = "none"; } }

But I just dumped it in a random location within that file. It gave me an expected error. Can you guide me a little more to try and come up a working solution?

Last edit: 10 years 8 months ago by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODgxMDI5LXNvbHZlZC1jb25kaXRpb25hbC1vcHRpb24tYmFzZWQtb24tb3B0aW9uLWNob2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

10 years 8 months ago [\#232520](#232520) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232520 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Hi,

You can add it before the line:
function hikashopChangeOption(){
where you have the other javascript functions of that view file.

That way you won't have errors. Beware that the js code is enclosed in double quotes, so you should either escape them in your function code or use single quotes instead.

Then, after the line:
hikashopRefreshOptionPrice();
just add the line:
check();
in order to call your function when an option selection is changed.

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

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

Less More

- Posts: 86
- Thank you received: 11
-
-

10 years 8 months ago [\#232656](#232656) by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")  Replied by *[simplecms](/forum/user/32423-simplecms "View simplecms's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232656 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Done and works! Thank you so much for the help!

The only bummer is that there isn't a way to hide the entire &lt;tr&gt; for that element so the title span and row still are visible but the select box isn't so that will have to do.

Below is my new option file if anyone else wants to replicate it for themselves. Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.6.0 * @author hikashop.com * @copyright (C) 2010-2015 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;table class="hikashop_product_options_table"&gt; &lt;?php $old_show_discount = $this-&gt;params-&gt;get('show_discount'); $old_per_unit = $this-&gt;params-&gt;get('per_unit',1); $this-&gt;params-&gt;set('show_discount',0); $this-&gt;params-&gt;set('per_unit',0); $this-&gt;params-&gt;set('from_module','1'); $i=0; $js="var hikashop_options=Array();"; foreach($this-&gt;element-&gt;options as $optionElement) { ?&gt; &lt;tr&gt; &lt;?php $this-&gt;values = array(); $value = 0; $currency = hikashop_get('class.currency'); $map = 'hikashop_product_option['.$i.']'; $id = 'hikashop_product_option_'.$i; if(empty($optionElement-&gt;variants)){ if(!$optionElement-&gt;product_published &#124;&#124; (!$this-&gt;config-&gt;get('show_out_of_stock',1) &amp;&amp; $optionElement-&gt;product_quantity==0)) continue; $this-&gt;values[] = JHTML::_('select.option', 0,JText::_('HIKASHOP_NO')); $text = JText::_('HIKASHOP_YES'); $this-&gt;row =&amp; $optionElement; if(!empty($optionElement-&gt;prices) &amp;&amp; $this-&gt;params-&gt;get('show_price')){ $ok = null; $positive=1; foreach($optionElement-&gt;prices as $k =&gt; $price){ if(empty($price-&gt;price_min_quantity)){ $ok = $price; if($price-&gt;price_value&lt;0) $positive=false; break; } } if($this-&gt;params-&gt;get('price_with_tax')){ $price = $ok-&gt;price_value_with_tax; }else{ $price = $ok-&gt;price_value; } $text.=' ( '.($positive?'+ ':'').$this-&gt;currencyHelper-&gt;format($price,$ok-&gt;price_currency_id).' )'; $js.=" hikashop_options[".(int)$optionElement-&gt;product_id."]=".(float)str_replace(',','.',$price).";"; } $this-&gt;values[] = JHTML::_('select.option', $optionElement-&gt;product_id,$text); }else{ $defaultValue=array(); if(isset($optionElement-&gt;characteristics) &amp;&amp; is_array($optionElement-&gt;characteristics) &amp;&amp; count($optionElement-&gt;characteristics)){ foreach($optionElement-&gt;characteristics as $char){ $defaultValue[]=$char-&gt;characteristic_id; } } foreach($optionElement-&gt;variants as $variant){ if(!$variant-&gt;product_published &#124;&#124; (!$this-&gt;config-&gt;get('show_out_of_stock',1) &amp;&amp; empty($variant-&gt;product_quantity))) continue; if($variant-&gt;product_sale_start&gt;time()) continue; if($variant-&gt;product_sale_end!='' &amp;&amp; $variant-&gt;product_sale_end!='0' &amp;&amp; $variant-&gt;product_sale_end&lt;time()) continue; if(empty($variant-&gt;variant_name)){ if(empty($variant-&gt;characteristics_text)){ $text = $variant-&gt;product_name; }else{ $text = $variant-&gt;characteristics_text; } }else{ $text = $variant-&gt;variant_name; } $this-&gt;row =&amp; $variant; if(!empty($variant-&gt;prices) &amp;&amp; $this-&gt;params-&gt;get('show_price')){ $ok = null; $positive=1; foreach($variant-&gt;prices as $k =&gt; $price){ if(empty($price-&gt;price_min_quantity)){ $ok = $price; if($price-&gt;price_value&lt;0) $positive=false; break; } } if($this-&gt;params-&gt;get('price_with_tax')){ $price = $ok-&gt;price_value_with_tax; }else{ $price = $ok-&gt;price_value; } $text.=' ( '.($positive?'+ ':'').$this-&gt;currencyHelper-&gt;format($price,$ok-&gt;price_currency_id).' )'; $js.=" hikashop_options[".(int)$variant-&gt;product_id."]=".(float)str_replace(',','.',$price).";"; } if($defaultValue &amp;&amp; isset($variant-&gt;characteristics) &amp;&amp; is_array($variant-&gt;characteristics) &amp;&amp; count($variant-&gt;characteristics)){ $default = true; foreach($variant-&gt;characteristics as $char){ if(!in_array($char-&gt;characteristic_id,$defaultValue)){ $default = false; } } if($default){ $value = $variant-&gt;product_id; } } $this-&gt;values[] = JHTML::_('select.option', $variant-&gt;product_id,$text); } } if(!count($this-&gt;values)) continue; $html = JHTML::_('select.genericlist', $this-&gt;values, $map, 'class="inputbox" size="1" onchange="hikashopChangeOption();"', 'value', 'text', (int)$value, $id); if(!empty($optionElement-&gt;variants)){ $optionInfo =&amp; $optionElement-&gt;main; }else{ $optionInfo =&amp; $optionElement; } $options = ''; if(!empty($optionInfo-&gt;product_description) &#124;&#124; !empty($optionInfo-&gt;product_url)){ $options='&lt;img src="'.HIKASHOP_IMAGES.'info.png" alt="Information"/&gt;'; $description = ''; if(!empty($optionInfo-&gt;product_description)){ $description = $this-&gt;escape(strip_tags(JHTML::_('content.prepare',$optionInfo-&gt;product_description))); $options='&lt;span class="hikashop_option_info" title="'.$description.'"&gt;'.$options.'&lt;/span&gt;'; } if(!empty($optionInfo-&gt;product_url)){ if(empty($description)){ $description = $optionInfo-&gt;product_name; } $popup = hikashop_get('helper.popup'); $options = $popup-&gt;display( $options, $optionInfo-&gt;product_name, $optionInfo-&gt;product_url, 'hikashop_product option_'.$optionInfo-&gt;product_id.'_popup', 760, 480, '', '', 'link' ); } } $html = '&lt;span class="hikashop_option_name"&gt;'.$optionInfo-&gt;product_name.$options.'&lt;/span&gt;&lt;/td&gt;&lt;td&gt;' . $html; ?&gt; &lt;td&gt;&lt;?php echo $html; ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php $i++; } global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } $baseUrl = hikashop_completeLink('product&amp;task=price',true,true); if(strpos($baseUrl,'?') !== false) $baseUrl .= '&amp;'; else $baseUrl .= '?'; $js .= " function check() { var dropdown = document.getElementById('hikashop_product_option_0'); var current_value = dropdown.options[dropdown.selectedIndex].value; if (current_value == '5') { document.getElementById('hikashop_product_option_2').style.display = 'block'; } else { document.getElementById('hikashop_product_option_2').style.display = 'none'; } } function hikashopChangeOption(){ var j = 0; total_option_price = 0; while(true){ var option = document.getElementById('hikashop_product_option_'+j); if(!option){ break; } j++; var option_price = hikashop_options[option.value]; if(option_price){ total_option_price+=option_price; } } var arr = new Array(); arr = document.getElementsByName('hikashop_price_product'); for(var i = 0; i &lt; arr.length; i++){ var obj = document.getElementsByName('hikashop_price_product').item(i); var id_price = 'hikashop_price_product_' + obj.value; var id_price_with_options = 'hikashop_price_product_with_options_' + obj.value; var price = document.getElementById(id_price); var price_with_options = document.getElementById(id_price_with_options); if(price &amp;&amp; price_with_options){ price_with_options.value = parseFloat(price.value) + total_option_price; } } hikashopRefreshOptionPrice(); check(); } function hikashopRefreshOptionPrice(){ var price_div = document.getElementById('hikashop_product_id_main'); var inputs = price_div.getElementsByTagName('input'); if(inputs[0]){ var id_price_with_options = 'hikashop_price_product_with_options_' + inputs[0].value; var price_with_options = document.getElementById(id_price_with_options); if(price_with_options){ try{ new Ajax('".$baseUrl."price='+price_with_options.value+'".$url_itemid."', { method: 'get', onComplete: function(result) { var totalPrice = window.document.getElementById('hikashop_product_price_with_options_main'); if(totalPrice) totalPrice.innerHTML = result;}}).request(); }catch(err){ new Request({url:'".$baseUrl."price='+price_with_options.value+'".$url_itemid."', method: 'get', onComplete: function(result) { var totalPrice = window.document.getElementById('hikashop_product_price_with_options_main'); if(totalPrice) totalPrice.innerHTML = result;}}).send(); } } } } window.hikashop.ready( function() { hikashopChangeOption(); }); "; if(!HIKASHOP_PHP5) $doc =&amp; JFactory::getDocument(); else $doc = JFactory::getDocument(); $doc-&gt;addScriptDeclaration("\n&lt;!--\n".$js."\n//--&gt;\n"); $this-&gt;params-&gt;set('show_discount',$old_show_discount); $this-&gt;params-&gt;set('per_unit',$old_per_unit); $this-&gt;params-&gt;set('from_module',''); ?&gt; &lt;/table&gt;

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

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

Less More

- Posts: 86
- Thank you received: 11
-
-

10 years 8 months ago -  10 years 8 months ago [\#232667](#232667) by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")  Replied by *[simplecms](/forum/user/32423-simplecms "View simplecms's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232667 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Update - My client wanted only 1 of the options to be hidden NOT the entire select box. So this is what I've created:
Code:

function check() { var dropdown = document.getElementById('hikashop_product_option_0'); var current_value = dropdown.options[dropdown.selectedIndex].value; if (current_value == '4') { document.getElementById('hikashop_product_option_2').options[1].disabled=true; document.getElementById('hikashop_product_option_2').selectedIndex = '0'; } else { document.getElementById('hikashop_product_option_2').options[1].disabled=false; } }

But this does NOT update the "Price with options" if the user selects the option and then reverts back to the option that makes it disabled. How can I have the system reset the price?

Last edit: 10 years 8 months ago by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODgxMDI5LXNvbHZlZC1jb25kaXRpb25hbC1vcHRpb24tYmFzZWQtb24tb3B0aW9uLWNob2ljZT90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

10 years 8 months ago [\#232670](#232670) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232670 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Hi,

1.It would be easy to handle by adding a dynamic id to the tr tag &lt;tr&gt; in the same file and then hidding/displaying the tr based on that id in your javascript function.

2. try moving the call to the check function at the beginning of the hikashopChangeOption function.

The following user(s) said Thank You: [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")

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

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

Less More

- Posts: 86
- Thank you received: 11
-
-

10 years 8 months ago [\#232786](#232786) by [simplecms](/forum/user/32423-simplecms "View simplecms's Profile")  Replied by *[simplecms](/forum/user/32423-simplecms "View simplecms's Profile")* on topic *[Conditional Option based on option choice](/forum/32-content-creation/881029-solved-conditional-option-based-on-option-choice#232786 "-- HikaShop version -- : HikaShop Business: 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.4.45  I love Hikashop. Thank you for making a Joomla e-commerce platform that is so easy and fully configurable.  I have a pretty simple question. I've searched the forum but couldn't find another topic.  I have a product that has an option called Color/Mono with two options either Color or Mono.  What I want to do is have another conditional option that only displays when the user selects the Mono option from above. How can I achieve this?")*

Thank did it. Thank you very much!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODgxMDI5LXNvbHZlZC1jb25kaXRpb25hbC1vcHRpb24tYmFzZWQtb24tb3B0aW9uLWNob2ljZT90bXBsPW1hcmtkb3du) 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.120 seconds

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