2016-07-30 4 views
0
hinzu

Ich möchte die Schaltfläche In den Warenkorb auf meiner Sammlungsseite (zB - example.com/collections/collection-name) neben jedem Produkt haben. Also, wenn ich 20 Produkte auf der Seite habe, möchte ich 20 In den Warenkorb-Buttons neben ihrem jeweiligen Produkt haben.Shopify: In den Warenkorb hinzufügen Button auf der Seite Sammlungen fügt nur das letzte Produkt auf Seite

I edited Produkt-card.liquid mit den folgenden:

 <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> 

Das Problem ist, dass, wenn ich den Warenkorb auf dem ersten Produkt auf der Seite klicken Sie auf Hinzufügen, das letzte Produkt auf der Seite wird zum Warenkorb hinzugefügt.

Gibt es ein bestehendes Onclick-Ereignis für den Warenkorb, die die letzte Produkt-ID auf der Seite findet und fügt hinzu, dass in die Warenkorb gelegt? Ich verwende das Venture-Thema.

Was fehlt mir?

Antwort

0

Wo ist die Form Öffnung? Es sollte vor der ersten Auswahl dort sein.