Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. {% if product.tags contains "bis-hidden" %}
  2. <p class="out-of-stock">{{ settings.out-of-stock-message }}</p>
  3. {% else %}
  4. <div class="product-reorder">
  5. <h3>{{ settings.restock-notify-heading }}</h3>
  6. <p>{{ settings.restock-notify-message }}</p>
  7. <div class="restock-notify-form">
  8. <input type="email" id="notify_email"{% if customer.email != blank %} value="{{ customer.email }}"{% endif %}>
  9. <button id="notify_button">{{ settings.notify-me-button }}</button>
  10. </div>
  11. </div>
  12. {% endif %}
  13.  
  14. <script>
  15. var notificationCallback = function(data) {
  16. var msg = '';
  17. if (data.status == 'OK') {
  18. msg = data.message; // just show the success message
  19. } else { // it was an error
  20. for (var k in data.errors) { // collect all the error messages into a string
  21. msg += (k + " " + data.errors[k].join());
  22. }
  23. }
  24. alert(msg);
  25. }
  26. $('#notify_button').click(function(e) {
  27. e.preventDefault();
  28. var email = $('#notify_email').val(),
  29. productId = {{ product.id }}, // rendered by Liquid
  30. variantId = {{ product.variants.first.id }}; // rendered by Liquid
  31. BIS.create(email, variantId).then(notificationCallback); // create the notification
  32. })
  33. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement