Skip to main content
additional code adjustments found later
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60

EDIT:

A slight adjustment is needed in the code above, to make this work in magento EE 1.13 (possibly EE1.14/CE 1.8/1.9 ?)

the call to parent(); in the code above must be changed to parent(this.currentStep);

EDIT:

A slight adjustment is needed in the code above, to make this work in magento EE 1.13 (possibly EE1.14/CE 1.8/1.9 ?)

the call to parent(); in the code above must be changed to parent(this.currentStep);

updated code block, adding functionality
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60
document.observe("dom:loaded", function() {
    Object.extend(Validation, {
        isVisible : function(elm) {
             if ($(elm).tagName == 'SELECT') {
                if ($(elm.id.replace(new RegExp('-', 'g'), '_')+'_chosen' + '_chosen') != undefined) {
                   // need to be careful of payment types, as they may not be selected
                   // so we do not want to validate the children.
                   // determine the parent ul element of this select is display none, and if so,
                   // do not validate it.
                   var parentUL = elm.up('ul');
                   if(typeof parentUL  != 'undefined' && parentUL.style.display == 'none')
                   {
                       return true;false;
                   }
                   return true;
               }
            }
            return this._isVisible(elm);
        },
        _isVisible : function(elm) {
            while (elm.tagName != 'BODY') {
                if (!$(elm).visible()) return false;
                elm = elm.parentNode;
            }
            return true;
        },
        insertAdvice : function(elm, advice){
            if($(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen') != undefined) {
                var container = $(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen');
            } else {
                var container = $(elm).up('.field-row');
            }
            if(container){
                Element.insert(container, {after: advice});
            } else if (elm.up('td.value')) {
                elm.up('td.value').insert({bottom: advice});
            } else if (elm.advaiceContainer && $(elm.advaiceContainer)) {
                $(elm.advaiceContainer).update(advice);
            }
            else {
                switch (elm.type.toLowerCase()) {
                    case 'checkbox':
                    case 'radio':
                        var p = elm.parentNode;
                        if(p) {
                            Element.insert(p, {'bottom': advice});
                        } else {
                            Element.insert(elm, {'after': advice});
                        }
                        break;
                    default:
                        Element.insert(elm, {'after': advice});
                }
            }
        }

    });

    jQuery("select").chosen(
        {
            disable_search_threshold: 10,
            no_results_text: "Sorry, nothing found!",
            width: "100%",
            inherit_select_classes: true

        });

    jQuery("select").chosen().change( function(e){
        Validation.validate(e.target);
    });
});
document.observe("dom:loaded", function() {
    Object.extend(Validation, {
        isVisible : function(elm) {
            if($(elm).tagName == 'SELECT') {
                if($(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen') != undefined) {
                   return true;
                }
            }
            return this._isVisible(elm);
        },
        _isVisible : function(elm) {
            while (elm.tagName != 'BODY') {
                if (!$(elm).visible()) return false;
                elm = elm.parentNode;
            }
            return true;
        },
        insertAdvice : function(elm, advice){
            if($(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen') != undefined) {
                var container = $(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen');
            } else {
                var container = $(elm).up('.field-row');
            }
            if(container){
                Element.insert(container, {after: advice});
            } else if (elm.up('td.value')) {
                elm.up('td.value').insert({bottom: advice});
            } else if (elm.advaiceContainer && $(elm.advaiceContainer)) {
                $(elm.advaiceContainer).update(advice);
            }
            else {
                switch (elm.type.toLowerCase()) {
                    case 'checkbox':
                    case 'radio':
                        var p = elm.parentNode;
                        if(p) {
                            Element.insert(p, {'bottom': advice});
                        } else {
                            Element.insert(elm, {'after': advice});
                        }
                        break;
                    default:
                        Element.insert(elm, {'after': advice});
                }
            }
        }

    });

    jQuery("select").chosen(
        {
            disable_search_threshold: 10,
            no_results_text: "Sorry, nothing found!",
            width: "100%",
            inherit_select_classes: true

        });

    jQuery("select").chosen().change( function(e){
        Validation.validate(e.target);
    });
});
document.observe("dom:loaded", function() {
    Object.extend(Validation, {
        isVisible : function(elm) {
             if ($(elm).tagName == 'SELECT') {
               if ($(elm.id.replace(new RegExp('-', 'g'), '_') + '_chosen') != undefined) {
                   // need to be careful of payment types, as they may not be selected
                   // so we do not want to validate the children.
                   // determine the parent ul element of this select is display none, and if so,
                   // do not validate it.
                   var parentUL = elm.up('ul');
                   if(typeof parentUL  != 'undefined' && parentUL.style.display == 'none')
                   {
                       return false;
                   }
                   return true;
               }
            }
            return this._isVisible(elm);
        },
        _isVisible : function(elm) {
            while (elm.tagName != 'BODY') {
                if (!$(elm).visible()) return false;
                elm = elm.parentNode;
            }
            return true;
        },
        insertAdvice : function(elm, advice){
            if($(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen') != undefined) {
                var container = $(elm.id.replace(new RegExp('-', 'g'),'_')+'_chosen');
            } else {
                var container = $(elm).up('.field-row');
            }
            if(container){
                Element.insert(container, {after: advice});
            } else if (elm.up('td.value')) {
                elm.up('td.value').insert({bottom: advice});
            } else if (elm.advaiceContainer && $(elm.advaiceContainer)) {
                $(elm.advaiceContainer).update(advice);
            }
            else {
                switch (elm.type.toLowerCase()) {
                    case 'checkbox':
                    case 'radio':
                        var p = elm.parentNode;
                        if(p) {
                            Element.insert(p, {'bottom': advice});
                        } else {
                            Element.insert(elm, {'after': advice});
                        }
                        break;
                    default:
                        Element.insert(elm, {'after': advice});
                }
            }
        }

    });

    jQuery("select").chosen(
        {
            disable_search_threshold: 10,
            no_results_text: "Sorry, nothing found!",
            width: "100%",
            inherit_select_classes: true

        });

    jQuery("select").chosen().change( function(e){
        Validation.validate(e.target);
    });
});
added 107 characters in body
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60
if(typeof Checkout  != 'undefined')
    {
    Checkout.prototype.reloadProgressBlock = Checkout.prototype.reloadProgressBlock.wrap(function (parent) {
            jQuery("select").chosen(
                {
                    disable_search_threshold: 10,
                    no_results_text: "Sorry, nothing found!",
                    width: "84%",
                    inherit_select_classes: true
    
                });
            parent();
    
        });
}
Checkout.prototype.reloadProgressBlock = Checkout.prototype.reloadProgressBlock.wrap(function (parent) {
        jQuery("select").chosen(
            {
                disable_search_threshold: 10,
                no_results_text: "Sorry, nothing found!",
                width: "84%",
                inherit_select_classes: true

            });
        parent();

    });
if(typeof Checkout  != 'undefined')
    {
    Checkout.prototype.reloadProgressBlock = Checkout.prototype.reloadProgressBlock.wrap(function (parent) {
            jQuery("select").chosen(
                {
                    disable_search_threshold: 10,
                    no_results_text: "Sorry, nothing found!",
                    width: "84%",
                    inherit_select_classes: true
    
                });
            parent();
    
        });
}
added 779 characters in body
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60
Loading
remove console.log in code
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60
Loading
added image
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60
Loading
Source Link
ProxiBlue
  • 9.9k
  • 3
  • 34
  • 60
Loading