2017-04-02 23 views
0

我正在開發一個商店,我試圖添加的產品是一個分組產品,我在前端做了一些設計和配置。然後,我添加了樣品分組產品,當我點擊「添加到購物車」時,出現「請指定產品數量」的消息。分組產品不會被添加到購物車,並且有一條消息「請指定產品的數量」。

請詳見網站(對不起該網站是在泰國,但你可以嘗試增加各產品的數量,然後單擊添加到購物車 - 粉紅色的按鈕)

http://www.preciosathailand.com/eyeline-0001.html

這是PHP代碼我做了配置

<?php if ($_hasAssociatedProducts): ?> 
<?php foreach ($_associatedProducts as $_item): ?> 
    <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?> 
    <tr> 
     <td width="80%"><span class="product-<?php echo $_item->getId() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></span></td> 
     <?php if ($this->getCanShowProductPrice($_product)): ?> 
     <td class="a-right"> 
      <?php if ($this->getCanShowProductPrice($_item)): ?> 
      <?php echo $this->getPriceHtml($_item, true) ?> 
      <?php echo $this->getTierPriceHtml($_item) ?> 
      <?php endif; ?> 
     </td> 
     <?php endif; ?> 
     <?php if ($_product->isSaleable()): ?> 
     <td class="a-center" width="20%"> 
     <?php if ($_item->isSaleable()) : ?> 
      <div class="qty-tools"> 
       <div class="minus-qty minus-<?php echo $_item->getId() ?>"><a class="click-to-minus" id="minus-<?php echo $_item->getId() ?>" href="#" data-id-p="<?php echo $_item->getId() ?>">-</a></div> 
       <div class="input-qty-wrapper"> 
       <input type="text" name="super_group[<?php echo $_item->getId() ?>]" data-qty-product-id="<?php echo $_item->getId() ?>" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" /> 
       </div> 
       <div class="plus-qty plus-<?php echo $_item->getId() ?>"><a class="click-to-plus" href="#" id="plus-<?php echo $_item->getId() ?>" data-id-p="<?php echo $_item->getId() ?>">+</a></div> 
      </div> 
     <?php else: ?> 
      <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p> 
     <?php endif; ?> 
     </td> 
     <?php endif; ?> 
    </tr> 
<?php endforeach; ?> 
<?php else: ?> 
    <tr> 
     <td colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>"><?php echo $this->__('No options of this product are available.') ?></td> 
    </tr> 
<?php endif; ?> 

這是我做的jQuery。

jQuery(document).ready(function(){ 

    jQuery('.click-to-minus').click(function(){ 


     var IDInput = jQuery(this).data('id-p'); 
     var CurrentVal = jQuery('input[name="super_group['+IDInput+']"]').val(); 
     var minusedVal = CurrentVal-1; 

     jQuery('input#'+IDInput).val(minusedVal); 

    }); 


    jQuery('.click-to-plus').click(function(){ 

     var pIDInput = jQuery(this).data('id-p'); 
     var CurrentPlusVal = jQuery('input[name="super_group['+pIDInput+']"]').val(); 
     /* if (CountPlus == 0){ 

      var plusedVal = 1; 

     }else{ 
      jQuery('input#'+pIDInput).val(''); 
      var plusedVal = CurrentPlusVal+1; 
     }*/ 

     var plusedVal = +CurrentPlusVal+1; 
     jQuery('input[data-qty-product-id="'+pIDInput+'"]').val(plusedVal); 


    }); 


}); 

我做錯了什麼嗎?

回答

0

您是否試圖對可配置產品進行分組,然後您應該知道magento不允許它。

你可以檢查這個答案here

相關問題