Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function replaceDropDowns() {
- jQuery('.product_attribute_option_link').remove();
- jQuery('#selected_combination').text('');
- jQuery(".super-attribute-select").each(function() {
- var drop_down = jQuery(this);
- drop_down.hide();
- drop_down.find("option[value!='']").each(function() {
- var option = jQuery(this);
- jQuery("<a>", {
- text: option.text(),
- href: '#',
- class: 'product_attribute_option_link',
- 'data-id': drop_down.attr('id'),
- 'data-name': drop_down.attr('name'),
- 'data-value': option.val(),
- 'data-label': option.text(),
- click: function() {
- drop_down.val(option.val());
- var obj = drop_down.get();
- Event.observe(obj[0],'change',function(){});
- fireEvent(obj[0],'change');
- replaceDropDowns();
- var selected_combination = [];
- jQuery(".super-attribute-select").each(function() {
- if(jQuery(this).val()) {
- jQuery(".product_attribute_option_link[data-value="+jQuery(this).val()+"]").addClass('product_attribute_option_link_selected');
- selected_combination.push(jQuery(this).find("option:selected").text());
- }
- });
- jQuery.each(selected_combination, function(index, selection) {
- jQuery('#selected_combination').append(selection);
- if(index+1 < selected_combination.length)
- jQuery('#selected_combination').append(" - ");
- })
- return false;
- }
- }).appendTo(drop_down.parent());
- })
- });
- }
- jQuery(function() {
- replaceDropDowns();
- });
Add Comment
Please, Sign In to add comment