2016-07-30 5 views
0

各商品の横にあるマイコレクションのページ(例: - example.com/collections/collection-name)にカートに追加ボタンがあります。 20ページの商品がページにある場合は、それぞれの商品の隣に20カートに入れるボタンを追加したいと考えています。Shopify:ショッピングカートに入れるボタンは、ページの最後の商品のみを追加します。

私は次のように製品card.liquid編集:

 <select name="product-form-{{ product.variants.first.id }}" id="product-form-{{ product.variants.first.id }}" class="product-form__variants"> 
     {% for variant in product.variants %} 
      <option {% if variant == current_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}" {% unless variant.available %} disabled="disabled" {% endunless %}> 
      {% if variant.available %} 
       {{ variant.title }} - {{ variant.price | money_with_currency }} 
      {% else %} 
       {{ variant.title }} - {{ 'products.product.sold_out' | t }} 
      {% endif %} 
      </option> 
     {% endfor %} 
     </select> 
     <div class="product-form__item product-form__item--quantity"> 
     <label for="Quantity">{{ 'products.product.quantity' | t }}</label> 
     <input type="number" id="Quantity-{{ product.variants.first.id }}" name="quantity" value="1" min="1" class="product-form__input"> 
     </div> 
     <div class="product-form__item product-form__item--submit"> 
     <button name="add" class="btn btn--full product-form__cart-submit"> 
      <span id="AddToCartText-{{ product.variants.first.id }}">{{ 'products.product.add_to_cart' | t }}</span> 
     </button> 
     </div> 
    </form> 

を問題は、私がクリックしたときに、ページ上の第一製品にカートに最後の製品を追加していることですページ上の「カート」がカートに追加されます。

カートに追加するための既存のonclickイベントは、ページ上の最後の製品IDを見つけてカートに追加しますか?私はVentureテーマを使用しています。

私には何が欠けていますか?

答えて

0

フォームの開封はどこですか? 最初の選択の前にそれがあるはずです。

関連する問題