Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Product Options Conditional Logic Rate Topic   - - - - -

 
  • CartBooster
  • Senior Member
  • Members
  • Join Date: 25-Jun 06
  • 234 posts

Posted 16 April 2018 - 09:37 AM #1

Hi,

 

Trying to to create some conditional logic on some global options fields, but am having some difficulty.

 

Its essentially a SHOW / HIDE conditional logic that only shows a text field if the customer selects yes.

 

I've removed the product ID from the DOM product options TPL so that the same code can be used globally on the website 

 

So basically when the page loads, #opt_76 is set to hide

 

When "option_3599" is set to "17022",  then #opt_76 is set to show

When "option_3599" is set to "17021",  then #opt_76 is set to hide again

 

 

// HIDE ENGRAVING TEXT MEDALS - ID 
$('#opt_76').hide(); // INITIAL SET TO HIDE
 
$.ceEvent('on', 'ce.ajaxdone', function(data) {
    // alert('Ajax done');
 
    $(function() {
 
 
      $('#option_3599').change(
        function(){
          if($('#option_3599').val() == '17022')  {
              $('#opt_76').show(); // SET TO YES SHOW
          };
      });
 
      $('#option_3599').change(
        function(){
          if($('#option_3599').val() == '17021')  {
              $('#opt_76').hide(); // SET TO NO HIDE
          } 
      });
  });
 
 
});

 

Its seems a global show is kicking in from the Ajax call,

 

Any ideas on how to get this to work?

 

Or are there any better solutions to get this to work?

 

Thanks

 

 

Stephen


www.cartbooster.ie


 

Posted 19 April 2018 - 12:12 PM #2

I'm also looking for an option like this. If you choose option x hide option y.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17112 posts

Posted 19 April 2018 - 01:00 PM #3

If you do not find ready to use solution, we will be glad to develop it for your store.


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.

 
  • CartBooster
  • Senior Member
  • Members
  • Join Date: 25-Jun 06
  • 234 posts

Posted 19 April 2018 - 06:38 PM #4

Ballpark figure to give us the correct way to execute this piece of jquery? I can do the rest

www.cartbooster.ie


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17112 posts

Posted 20 April 2018 - 05:10 AM #5

I suggest you to use hooks in the fn_gather_additional_product_data function since it is called on page load and after each option change


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.