Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
- <script>
- if (typeof(Ecwid) == 'object') {
- Ecwid.OnAPILoaded.add(function() {
- // Redirect address. Change it to the URL of page where you want to redirect your customers.
- // You can use absolute or relative addresses, e.g. 'index.html', 'http://google.com'
- var continueShoppingRedirect = "https://www.ynsmedspa.com/shoppingcart.html#!/~/cart";
- // Delay (ms), which is necessary for the empty cart page to appear after onCartChange event firing
- var empty_cart_page_delay = 500;
- // Continue shopping buttons CSS selectors
- // (you can remove the ones that you don't want to change behavior for)
- var buttons = [
- '.ecwid-btn--checkout'
- ];
- // Pages (Ecwid.Page.type) where buttons should be customized
- // (you can remove the pages that you don't want to change the buttons on)
- var pages = [
- 'CART',
- 'SEARCH',
- 'ORDER_CONFIRMATION',
- 'ACCOUNT_SETTINGS',
- 'ORDERS',
- 'ADDRESS_BOOK'
- ];
- // This function find the continue shoppign button on the page and replace it with a customized one
- var replaceButton = function() {
- var buttonObject = jQuery(buttons.join()).filter(":not('.clone'):visible");
- if (buttonObject.length) {
- buttonObject.clone().addClass('clone').appendTo(buttonObject.parent()).click(function() {
- location.href = continueShoppingRedirect;
- });
- // Remove the original button
- buttonObject.remove();
- }
- }
- // Replace the button on page loading
- Ecwid.OnPageLoaded.add(function(page) {
- if (jQuery.inArray(page.type, pages) >= 0) {
- replaceButton();
- }
- });
- // Replace the button on the empty cart page after clearing the cart
- // (it doesn't fire onPageLoaded event)
- Ecwid.OnCartChanged.add(function(page) {
- setTimeout(replaceButton, empty_cart_page_delay);
- });
- });
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement