Created
November 25, 2013 17:29
-
-
Save msmithstubbs/7645100 to your computer and use it in GitHub Desktop.
Product page form for Radiance theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| var BISSubmit = function(attr) { | |
| var showResponse = function(data) { | |
| var msg = ''; | |
| if (data.status == 'Error') { | |
| for (var k in data.errors) { | |
| msg += data.errors[k].join(); | |
| } | |
| } else { | |
| msg = data.message; | |
| } | |
| alert(msg); | |
| }, | |
| variantId = $('[name=id]').val(); | |
| if (BISPopover) { | |
| BISPopover.create(BIS.$('#bis-email', attr.form).value, variantId) | |
| .then(showResponse); | |
| } | |
| }, | |
| variantId = function() { $('[name=id]').val(); }; | |
| $(function() { | |
| $('.variants').on('change', 'select', function(e) { | |
| var variantId = $('[name=id]').val(); | |
| if (typeof BISPopover != 'undefined' && BISPopover._variantsById[variantId]) { | |
| $('.bis-form').toggle(BISPopover._variantsById[variantId].inventory_quantity < 1); | |
| } | |
| }); | |
| }); | |
| </script> | |
| <style> | |
| .bis-form { | |
| clear: both; | |
| margin: 1em 0; | |
| {% if product.available %} | |
| display: none; | |
| {% endif %} | |
| } | |
| </style> | |
| <form class="bis-form" onsubmit="BISSubmit({ form: this }); return false;"> | |
| <p>Enter your email address to receive a notification when this is available to order.</p> | |
| <input type="email" id="bis-email" name="email" class="search-input" value="" placeholder="Email address"> | |
| <input class="btn" type="submit" name="bis-notify" value="Notify Me"> | |
| </form> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#product-header(around line 50), and add the following lineIt should look like this: