window.tcart && (!window.tcart.promocode || !window.tcart.prodamount_discountsum) ) { inputObjError.type.push('promocode'); } break; case 'deliveryreq': inputObjError.type.push('deliveryreq'); break; case 'unauthorized_order': inputObjError.type.push('unauthorized_order'); break; default: break; } if (minLength > 0 && value.length && value.length < minLength) { inputObjError.type.push('minlength'); } if (maxLength > 0 && value.length && value.length > maxLength) { inputObjError.type.push('maxlength'); } } if (inputObjError.type && inputObjError.type.length) { arrError[arrError.length] = inputObjError; } } /* validation in cart for minimum order cost and minimum items quantity */ if (dataFormCart === 'y') { var isMinOrderSetted = window.tcart_minorder > 0; var isMinQuantitySetted = window.tcart_mincntorder > 0; if (isMinOrderSetted) { var prodAmount; if (window.tcart.prodamount_withdiscount > 0) { prodAmount = window.tcart.prodamount_withdiscount; } else if ( typeof window.tcart.prodamount_withdyndiscount !== 'undefined' && window.t_cart__discounts && window.t_cart__discounts.length > 0 ) { prodAmount = window.tcart.prodamount_withdyndiscount; } else if ( typeof window.tcart.prodamount_withdiscount !== 'undefined' && window.tcart.promocode && window.tcart.promocode.message === 'OK' ) { prodAmount = window.tcart.prodamount_withdiscount; } else { prodAmount = window.tcart.prodamount; } if (prodAmount < window.tcart_minorder) { var prodAmountObjError = {}; prodAmountObjError.obj = {}; prodAmountObjError.type = []; prodAmountObjError.type.push('minorder'); arrError.push(prodAmountObjError); } } if (isMinQuantitySetted && window.tcart.total < window.tcart_mincntorder) { var objError = {}; objError.obj = {}; objError.type = []; objError.type.push('minquantity'); arrError.push(objError); } } if (isEmptyValue && !arrError.length && inputs.length) { arrError = [ { obj: 'none', type: ['emptyfill'], }, ]; } return arrError;