Guest User

Untitled

a guest
Jun 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. {% assign collection = collections.all %}
  2. {% paginate collection.products by 100 %}
  3.  
  4. <div class="tab-container">
  5. <ul class="tabs">
  6. {% for product in collection.products %}
  7. {% if product.available %}
  8. <li class="tab-link current" data-tab="tab-{% increment%}"><img src="{{ variant.image | default: product.featured_image | img_url: 'small' }}" alt="{{ variant.title | escape }}" /></li>
  9. {%endif%}
  10. {%endfor%}
  11. </ul>
  12. </div>
  13.  
  14. <form class="product-form" action="/cart" method="post" enctype="multipart/form-data">
  15. {% if collection.products_count > 0 %}
  16. <body>
  17. <div>
  18. {% for product in collection.products %}
  19. {% if product.available %}
  20. <div id="tab-{% increment count%}" class="tab-content">
  21. {% for variant in product.variants %}
  22. {% if variant.available %}
  23. <tr class="{% cycle 'pure-table-odd', '' %}">
  24. <ul>
  25. <td>
  26. <a href="{{ variant.url | collection }}">
  27. {{ product.title }}{% unless variant.title contains 'Default' %} - {{ variant.title }}{% endunless %}{% unless variant.sku == blank %} - {{ variant.sku }}{% endunless %}
  28. </a>
  29. </td>
  30. <td>
  31. {{ variant.price | money }}
  32. </td>
  33. <td style="text-align:right;">
  34. <input name="updates[{{ variant.id }}]" onfocus="this.select()" class="quantity field" min="0" {% unless variant.inventory_management == blank or variant.inventory_policy == 'continue' %} max="{{ variant.inventory_quantity }}" {% endunless %} type="text" value="0" tabindex="1" />
  35. </td>
  36. </ul>
  37. {% endif %}
  38. {% endfor %}
  39. </div>
  40. {% endif %}
  41. </tr>
  42. {% endfor %}
  43. <div>
  44. <button class="btn btn--to-secondary btn--full product__add-to-cart-button" data-cart-submit type="submit" name="Add">
  45. <span class="primary-text" aria-hidden=false data-cart-primary-submit-text>
  46. Order
  47. </span>
  48. <span class="secondary-text" aria-hidden=true data-cart-secondary-submit-text>{{ 'products.product.view_cart' | t }}</span>
  49. </button>
  50. </div>
  51. </div>
  52. </div>
  53. </body>
  54. {% endif %}
  55.  
  56. </form>
  57. {% endpaginate %}
  58.  
  59. {% if collection.products_count > 0 %}
  60. <script>
  61. jQuery(function($) {
  62. $('table .quantity:first').focus();
  63. $('[max]').change(function() {
  64. var max = parseInt($(this).attr('max'), 10);
  65. var value = parseInt($(this).val(), 10) || 0;
  66. if (value > max) {
  67. alert('We only have ' + max + ' of this item in stock');
  68. $(this).val(max);
  69. }
  70. });
  71. });
  72. </script>
  73. {% endif %}
Add Comment
Please, Sign In to add comment