2012-10-14 7 views
1

누구든지 제공 할 수있는 도움에 감사드립니다. magento의 사용자 정의 옵션 필드가 'required'로 설정된 경우 장바구니에 추가하지 않고 사용자에게 옵션을 선택하도록 요청합니다. 그러나 관리자가 필요한 옵션을 선택 취소하면 작동합니다. 나는이 문제가 어쩌면 설정 제품에 영향을 미쳤으므로 필요한 옵션을 사용하지 않는 다른 해결책을 찾고 싶다고 생각한다.Magento custom options 'required'오류

젠토 1.6을 사용하여

당신에게

답변

0

감사 당신은 검증 소유 productAddToCartForm.submit (이) 카트 버튼 트리거에 추가

를 만들 수

<button type="button" title="Add to Cart" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span>Add to Cart</span></span></button> 

그런 다음 다시 쓸 수있다 자신의 제품 addAddToCartForm.submit()

var productAddToCartForm = new VarienForm('product_addtocart_form'); 
productAddToCartForm.submit = function(button, url) { 

    // do your custom validation here 
    // eg. if (this.validator.validate() && customValidate()) 
    if (this.validator.validate()) { 

      var form = this.form; 
      var oldUrl = form.action; 

      if (url) { 
       form.action = url; 
      } 
      var e = null; 
      try { 
       this.form.submit(); 
      } catch (e) { 
      } 
      this.form.action = oldUrl; 
      if (e) { 
       throw e; 
      } 

      if (button && button != 'undefined') { 
       button.disabled = true; 
      } 
    }   
    else{ 
     productOptionError(); 
    } 
}.bind(productAddToCartForm);