Esempio n. 1
0
    protected function _afterToHtml($html)
    {
        $html = str_replace('__*__', ' <span class="required">*</span>', $html);
        if (version_compare(Mage::getVersion(), '1.4.1.1', '<=')) {
            $html .= '<script type="text/javascript">
AdminOrder.prototype.productGridAddSelected = function(area){
        if(this.productGridShowButton) Element.show(this.productGridShowButton);
        var data = {};
        data["add_products"] = this.gridProducts.toJSON();
        data["reset_shipping"] = 1;
        this.gridProducts = $H({});
        this.hideArea("search");
        this.loadArea(["search", "items", "shipping_method", "totals", "giftmessage","billing_method", "form_account"], true, data);
    };
    
AdminOrder.prototype.removeQuoteItem = function(id){
        this.loadArea(["items", "shipping_method", "totals", "billing_method", "form_account"], true,
            {remove_item:id, from:"quote",reset_shipping: true});
    };

AdminOrder.prototype.moveQuoteItem = function(id, to){
        this.loadArea(["sidebar_"+to, "items", "shipping_method", "totals", "billing_method", "form_account"], this.getAreaId("items"),
            {move_item:id, to:to, reset_shipping: true});
    };
    
AdminOrder.prototype.sidebarApplyChanges = function(){
        if($(this.getAreaId("sidebar"))){
            var data  = {};
            var elems = $(this.getAreaId("sidebar")).select("input");
            for(var i=0; i<elems.length; i++){
                if(elems[i].getValue()){
                    data[elems[i].name] = elems[i].getValue();
                }
            }
            data.reset_shipping = true;
            this.loadArea(["sidebar", "items", "shipping_method", "billing_method","totals", "giftmessage", "form_account"], true, data);
        }
    };

AdminOrder.prototype.itemsUpdate = function(){
        var info = $("order-items_grid").select("input", "select", "textarea");
        var data = {};
        for(var i=0; i<info.length; i++){
            if(!info[i].disabled && (info[i].type != "checkbox" || info[i].checked)) {
                data[info[i].name] = info[i].getValue();
            }
        }
        data.reset_shipping = true;
        data.update_items = true;
        this.orderItemChanged = false;
        this.loadArea(["sidebar", "items", "shipping_method", "billing_method","totals", "giftmessage", "form_account"], true, data);
    };
    
</script>
';
        } else {
            $html .= '<script type="text/javascript">
		
AdminOrder.prototype.prepareArea = function(area){
        if(typeof(area) != "object")
		{
		    return area;
		}

        area[area.size()] = "form_account";
        if (this.giftMessageDataChanged) {
            return area.without("giftmessage");
        }
        
        return area;
    };
</script>
';
        }
        return parent::_afterToHtml($html);
    }