I've been searching much of the forum to get dependent attributes working on my store. I have achieved this somewhat by using the Flexible Attributes plugin and modifying a single template file with some jQuery code.
First install flexible attributes http://www.zen-cart.com/downloads.php?do=file&id=1030
This will give each attribute unique ID's that you can turn off and on via jQuery in YOUR_TEMPLATE/tpl_modules_attributes.php file.
Obviously you'll need to load jQuery in your website for it to work. I'm sure that'll be mentioned somewhere else in the forum.
Sample of hiding multiple attributes based on certain attributes selection shown below.
Not only can you hide other attributes, but you can show/hide any other HTML element you place on your page based on attribute selection.
For example:
Dropdown Menu1 - Product 1, Product 2, Product 3
Dropdown Menu2 - Containing options for Product 1
Dropdown Menu3 - Containing options for Product 2
Dropdown Menu4 - Containing options for Product 3
Enter the below into YOUR_TEMPLATE/tpl_modules_attributes.php
You will need to customise the code to accommodate all of your attribute options.
It worked for me at: http://www.stickythings.co.uk/round-.../25mm-diameterCode:<script> $(document).ready( function() { $('#attrib-1').bind('change', function (e) { if( $('#attrib-1').val() == 3) { $('#wAttrib-2').hide(); $('#wAttrib-3').hide(); $('#wAttrib-4').show(); } else{ $('#wAttrib-3').hide(); $('#wAttrib-4').hide(); } }); }); </script>
PS: You may also need to hide the attributes you don't require on page load via CSS.
I'm no expert and completely self-taught, so if anyone can contribute to this, feel free! :-)Code:#wAttrib-3 {display:none}


Reply With Quote
