I figured it out here is the link for reference
http://royalsat.com/index.php?main_p...roducts_id=103
I wanted the attributes to change on selection of the drop down box ( 6 months, 12 months)
So i figured out a way with jquery to hide the 6 months attributes and show the the 12 month and the other way around.
Then i ran into a problem when someone chooses packages for 6 months then changes to 12 then all the packaged from 6 and 12 month will be added to the cart and that is a really big problem.
So i had to figure out a way to uncheck the checkboxes once they change the months package and i did but the check boxes where not getting unchecked when u see them but the values where unchecked. So after a bit of digging i also figured out i had to change the classes from checked to unchecked.
//Unchecks Checkbox values but not the visual effect so users will get confused
Code:
$(":checkbox").prop( "checked" , false );
-----------------------------------------------------------------------------------------------------------
// Changes the class to unchecked so users see its unchecked
Code:
$('.icheckbox_minimal').removeClass('checked');
Now there was a another problem the radio buttons on the last grouped attributes are required. Now i have all the radio buttons for the 6 month and the 12 month in one group so if he has changed to 12 month and did not choose a radio then the package for the 6 month will be added witch is also a big problem so i had to figure out a hack for that as well.
So what i did was on value change of the 6 and 12 month it will unchecks all radios and change the class style to unchecked as well but now with this on. Customers are no longer required to choose one witch i thought was weird zen cart will not give any errors that one radio is required it will proceed normally.
//Unchecks all radios
Code:
$(":radio").prop( "checked" , false );
//Changes the radio button class to unchecked
Code:
$('.iradio_minimal').removeClass('checked');
So the fix for the required radio problem was to manually have the code choose the the lowest priced attribute one drop down box value change.
when 6 months was chosen it will run these commands to insure the correct radio button was chosen
// Checks Defualt radio Box for 6 month package
Code:
document.getElementById('attrib-4-16').checked = true; // Checks Default OSN box
// Changes checked radio button class to checked so user can see
Code:
$('.iradio_minimal #attrib-4-16').parent().addClass("checked");
This was my solution I am sorry for my bad grammer but i am at work and i dont have much time before the boss comes back I wanted to share this with the community and if someone needs a custom job like this on their zencart let me know I wont charge much ;)
Bookmarks