Advertisement
Guest User

Untitled

a guest
May 4th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1.  
  2. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
  3. <script>
  4. if (typeof(Ecwid) == 'object') {
  5. Ecwid.OnAPILoaded.add(function() {
  6. // Redirect address. Change it to the URL of page where you want to redirect your customers.
  7. // You can use absolute or relative addresses, e.g. 'index.html', 'http://google.com'
  8. var continueShoppingRedirect = "https://www.ynsmedspa.com/shoppingcart.html#!/~/cart";
  9. // Delay (ms), which is necessary for the empty cart page to appear after onCartChange event firing
  10. var empty_cart_page_delay = 500;
  11. // Continue shopping buttons CSS selectors
  12. // (you can remove the ones that you don't want to change behavior for)
  13. var buttons = [
  14. '.ecwid-btn--checkout'
  15. ];
  16. // Pages (Ecwid.Page.type) where buttons should be customized
  17. // (you can remove the pages that you don't want to change the buttons on)
  18. var pages = [
  19. 'CART',
  20. 'SEARCH',
  21. 'ORDER_CONFIRMATION',
  22. 'ACCOUNT_SETTINGS',
  23. 'ORDERS',
  24. 'ADDRESS_BOOK'
  25. ];
  26.  
  27. // This function find the continue shoppign button on the page and replace it with a customized one
  28. var replaceButton = function() {
  29. var buttonObject = jQuery(buttons.join()).filter(":not('.clone'):visible");
  30. if (buttonObject.length) {
  31. buttonObject.clone().addClass('clone').appendTo(buttonObject.parent()).click(function() {
  32. location.href = continueShoppingRedirect;
  33. });
  34. // Remove the original button
  35. buttonObject.remove();
  36. }
  37. }
  38. // Replace the button on page loading
  39. Ecwid.OnPageLoaded.add(function(page) {
  40. if (jQuery.inArray(page.type, pages) >= 0) {
  41. replaceButton();
  42. }
  43. });
  44. // Replace the button on the empty cart page after clearing the cart
  45. // (it doesn't fire onPageLoaded event)
  46. Ecwid.OnCartChanged.add(function(page) {
  47. setTimeout(replaceButton, empty_cart_page_delay);
  48. });
  49. });
  50. }
  51. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement