The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.
 
 
Thread Tools Display Modes
  #1  
Old 10-23-2012, 04:32 PM
Snug Vest's Avatar
Snug Vest is offline
Member
 
Join Date: Sep 2012
Posts: 50
Default

Redirecting empty cart button to product page


Hi,

Is it possible to redirect the "Empty Cart" button on the Shopping Cart Page straight to the product page? So instead of getting the "Your Shopping Cart is empty" message with the continue shopping button, it just redirects you to the product page. We currently only have one product at the moment.

Thanks
  #2  
Old 10-24-2012, 12:49 PM
Matt Ecwid's Avatar
Matt Ecwid Matt Ecwid is offline
Ecwid Team
 
Join Date: Oct 2011
Posts: 4,947
Default

Quote:
Originally Posted by squeezeease7 View Post
Hi,

Is it possible to redirect the "Empty Cart" button on the Shopping Cart Page straight to the product page? So instead of getting the "Your Shopping Cart is empty" message with the continue shopping button, it just redirects you to the product page. We currently only have one product at the moment.

Thanks
Hello,

Can you please further explain why you need this?

Currently, you don't have the minicart widget on your store page, I guess it's because you simply don't need it - the cart page automatically opens when the product is added to the acrt. So a customer won't see any link to the cart until they add the product to the cart. Thus, if I get it right, the situation when a customer sees the empty cart page is not going to happen. Please let me know if I missed something.
__________________
Matt K
Ecwid Team

Ecwid Guide for Beginners

Ecwid Help Center

Ecwid video tutorials
  #3  
Old 10-24-2012, 09:07 PM
Snug Vest's Avatar
Snug Vest Snug Vest is offline
Member
 
Join Date: Sep 2012
Posts: 50
Default

Hi Makfruit,

Yes, that's right once the customer clicks on the "Empty Cart" button, instead of seeing the Empty Cart page, I want it to redirect to the product page.

Does this help? Or should I need to explain more?

Thanks
  #4  
Old 10-26-2012, 09:30 AM
Matt Ecwid's Avatar
Matt Ecwid Matt Ecwid is offline
Ecwid Team
 
Join Date: Oct 2011
Posts: 4,947
Default

Quote:
Originally Posted by squeezeease7 View Post
Hi Makfruit,

Yes, that's right once the customer clicks on the "Empty Cart" button, instead of seeing the Empty Cart page, I want it to redirect to the product page.

Does this help? Or should I need to explain more?

Thanks
Hello,

I see, thank you.

There is currently no built-in option in Ecwid that allows redirecting customers from the empty cart page, unfortunately. However, it can be achieved by means of a custom Javascript modification. With the help of Ecwid JS API, it is possible to track page changes in the store. Then, by checking the cart contents or by detecting a specific HTML elements on the cart page, it is possible for a custom script to detect the empty cart page and redirect a customer to some other page.
__________________
Matt K
Ecwid Team

Ecwid Guide for Beginners

Ecwid Help Center

Ecwid video tutorials
  #5  
Old 10-26-2012, 08:19 PM
Snug Vest's Avatar
Snug Vest Snug Vest is offline
Member
 
Join Date: Sep 2012
Posts: 50
Default

Ahh ok,

Umm would this be the right code to activate the redirection of the "empty cart" button? And how would you connect this code to the "empty cart" button itself?
Quote:
<script type="text/javascript" src="//app.ecwid.com/script.js?1560040" charset="utf-8"></script>
<script>
Ecwid.OnPageLoaded.add(function(page) {
if (page.type === 'CART_CLEAR') {
window.location="http://squeezease.com/shop/#ecwid:category=3627860&mode=product&product=15429 537";
}
});
</script>
I'm still new to javascript.

Thanks for all the help!

Last edited by squeezeease7; 10-26-2012 at 08:21 PM.
  #6  
Old 10-29-2012, 04:25 PM
Matt Ecwid's Avatar
Matt Ecwid Matt Ecwid is offline
Ecwid Team
 
Join Date: Oct 2011
Posts: 4,947
Default

Quote:
Originally Posted by squeezeease7 View Post
Ahh ok,

Umm would this be the right code to activate the redirection of the "empty cart" button? And how would you connect this code to the "empty cart" button itself?

I'm still new to javascript.

Thanks for all the help!
Hi,

The code looks good. However, I've discovered that the 'CART_TYPE' value for empty cart does not currently work ('CART' is returned instead). I've reported the issue to our developers, they will fix it.

In the meantime, you can use the following code:
Code:
<script>
Ecwid.OnPageLoaded.add(function(page) {
  if (jQuery('.ecwid-productBrowser-cart-emptyCartPanel').length > 0) {
    window.location = 'Here goes the URL';
  }
});
</script>
It will check if the page contains the empty cart message and redirect customer to the specified URL.

Please note the script require jQuery so you'll need to include jQuery library somewhere on your page (if you haven't yet) with this code:
Code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
__________________
Matt K
Ecwid Team

Ecwid Guide for Beginners

Ecwid Help Center

Ecwid video tutorials
  #7  
Old 10-29-2012, 08:40 PM
Snug Vest's Avatar
Snug Vest Snug Vest is offline
Member
 
Join Date: Sep 2012
Posts: 50
Default

Hi,

I added the code but it seems like it doesn't work. When I press the "Empty Cart" the page redirects me to the main product page url instead of the individual product url (that I copied and pasted into the place where you noted). As well do I add the jquery file inside my header.php file or do I place it where I placed all of my ecwid code?
  #8  
Old 10-30-2012, 06:00 AM
Matt Ecwid's Avatar
Matt Ecwid Matt Ecwid is offline
Ecwid Team
 
Join Date: Oct 2011
Posts: 4,947
Default

Quote:
Originally Posted by squeezeease7 View Post
Hi,

I added the code but it seems like it doesn't work. When I press the "Empty Cart" the page redirects me to the main product page url instead of the individual product url (that I copied and pasted into the place where you noted). As well do I add the jquery file inside my header.php file or do I place it where I placed all of my ecwid code?
It doesn't work because you placed the modification code before Ecwid integration code. The custom code should be placed after the integration code. By the way, you can inspect the code and check whether it works or produces some errors yourself - you'll need to inspect Javascript errors on your store page. How to do it in Chrome:
- Open you store page.
- Click the wrench icon on the browser toolbar. Select Tools → Javascript console. The console will appear in the bottom of the page.
- In the console, filter listed messages by means of 'Errors' label so that only error messages will be displayed. This screenshot illustrates it: http://d.pr/i/fV4I .

As to jQuery lib, it should be linked before the modification code. In your case, however, it is not needed at all - the page already has it.
__________________
Matt K
Ecwid Team

Ecwid Guide for Beginners

Ecwid Help Center

Ecwid video tutorials
  #9  
Old 10-31-2012, 05:28 AM
Snug Vest's Avatar
Snug Vest Snug Vest is offline
Member
 
Join Date: Sep 2012
Posts: 50
Default

I have another quick question regarding the code. If I want to change the linkage of the "Continue Shopping" button on the shopping cart page (and I want it to link back to the single product that I was on before) do I change the code that you provided me before but like this?

<script>
Ecwid.OnPageLoaded.add(function(page) {
if (jQuery('.ecwid-productBrowser-cart-continueShoppingButton').length > 0) {
window.location = 'Here goes the URL';
}
});
</script>

Thanks
  #10  
Old 10-31-2012, 07:37 PM
Snug Vest's Avatar
Snug Vest Snug Vest is offline
Member
 
Join Date: Sep 2012
Posts: 50
Default

I was able to fix my problem but now once I click on the "Continue Shopping" button on the Empty Cart Page, it delays for a couple of minutes showing the grid of products (so far we only have one product, so it's showing that single product) and then goes to that single product page. Is there a way to make load a bit faster?
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Tags
empty cart, redirecting, redirecting page

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:51 PM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.