-
Add Script to Footer scripts
1.1 Open the Footer scripts editor: Store Manager ==> Store front ==> Footer scripts
1.2 Add script above to footer editor and save.
1.3 Edit footer links content.- To edit footer link content. In footer link custom js you find:
java const links = [{}]
and edit text and link. Do not alter the structure.
- To edit footer link content. In footer link custom js you find:
-
Add code in the product-list.html
2.1 Open theme editor: Store Manager ==> Store front ==> Current Theme ==> Advanced ==> Edit Theme Files.
2.2 In here you browser follow the path bellow: templates -> components -> products -> options -> product-list.html- Open product-list.html file and insert code behind param id="attribute_productlist_0_{{id}}" in line:37 insert this code:
javadata-product-id="{{data}}"
The code look like:
value="0" id="attribute_productlist_0_{{id}}" data-product-id="{{data}}" // this is the code inserted checked="{{#if defaultValue '==' 0}}checked{{/if}}" required>
- Chooes Save & apply file.
- Open product-list.html file and insert code behind param id="attribute_productlist_0_{{id}}" in line:37 insert this code:
-
Open any product detail have product pick list and check it.
Forked from duonghoangdung/scalesoutlet#50962-addToCart.js
Last active
October 31, 2019 08:25
-
-
Save tvlgiao/501275919138fe3929c1ccde3ac5c956 to your computer and use it in GitHub Desktop.
This file contains 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> | |
(function(jQuery) { | |
function main() { | |
var $ = jQuery || window.$; | |
$('#form-action-addToCart').on('click', function(event) { | |
var $form = $('form[data-cart-item-add]'); | |
var form = $form.get(0); | |
if (form.checkValidity && !form.checkValidity()) { | |
return; | |
} | |
var $input = $form.find('input[id^=attribute_productlist_]'); | |
if ($input.length === 0) { | |
return; | |
} | |
var found = false; | |
$input.each(function(i, el) { | |
var $el = $(el); | |
if ($el.prop('checked') && $el.attr('value') !== '0' && $el.data('productId')) { | |
event.preventDefault(); | |
found = true; | |
$.ajax('/cart.php?action=add&product_id=' + $el.data('productId'), { | |
success: function() { | |
$form.trigger('submit'); | |
} | |
}); | |
} | |
}); | |
if (found) { | |
$input.each(function(i, el) { | |
var $el = $(el); | |
if ($el.attr('value') !== '0') { | |
$el.prop('checked', false); | |
} else { | |
$el.prop('checked', true); | |
} | |
}); | |
} | |
}); | |
} | |
if (typeof jQuery == 'undefined') { | |
var script = document.getElementById('jquery_50962'); | |
if (!script) { | |
script = document.createElement('script'); | |
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js'; | |
script.defer = true; | |
script.id = 'jquery_50962'; | |
document.head.appendChild(script); | |
} | |
script.addEventListener('load', function() { | |
setTimeout(main, 1000); | |
}); | |
} else { | |
setTimeout(main, 1000); | |
} | |
})(window.jQuerySupermarket || window.jQuery || jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment