Forums / Templates, Stylesheets, Page Layout / 'Continue shopping' link in shopping cart

'Continue shopping' link in shopping cart

Views: 7,766

Results 1 to 20 of 20
3 Jul 2008, 10:24 AM
#1
ed89 avatar

ed89

New Zenner

Join Date:
Mar 2007
Posts:
33
Plugin Contributions:
0

'Continue shopping' link in shopping cart

Hi,

Regarding the 'continue shopping' link in the shopping cart: What would be involved to make this link return you to the page of the category you were viewing before adding a product to the cart. A client has stated that it is confusing for users, and they would rather be returned to whatever category page they were previously viewing rather than the product they just added.

I understand this could be a problem as the continue shopping link also appears when you view the cart without adding anything.

Anyone know a way around this?

much appreciated

3 Jul 2008, 1:58 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 'Continue shopping' link in shopping cart

See if this list of fixes is of help to you for v1.3.8 ...
http://www.zen-cart.com/forum/showthread.php?p=559864#post559864

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Jul 2008, 2:55 PM
#3
ed89 avatar

ed89

New Zenner

Join Date:
Mar 2007
Posts:
33
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

Ajeh,

thanks for that, but is there any way I can make that function go back two pages?

In this instance, a person adds a product to the cart, and clicks the link which returns them to the product they just added.

What I require, is to make them go two steps back, which would return them to the category page they were viewing.

We aren't using EZpages or anything like that across the site so I can only see that the 'back' button is used in this case.

thanks again

3 Jul 2008, 3:29 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 'Continue shopping' link in shopping cart

At this time, there is not a simple method for this as you don't know did they come from the listing or a sidebox or what to get to the product _info page ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Jul 2008, 3:43 PM
#5
ed89 avatar

ed89

New Zenner

Join Date:
Mar 2007
Posts:
33
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

Ajeh,

maybe I haven't made it very clear, apologies.

It is only the 'continue shopping' link in the cart I would like to go two steps back, regardless if the person has just added a product or for example, gone to the contact page then to the basket.

is this possible?

3 Jul 2008, 5:05 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 'Continue shopping' link in shopping cart

There isn't a function to manage how many navigation links to go back ...

The function that handles that is:
zen_back_link

located in the functions_general.php file ...

Perhaps you can use the existing one to customize something for the Continued Shopping on the shopping_cart page ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Jul 2008, 5:23 PM
#7
snarg avatar

snarg

New Zenner

Join Date:
Feb 2008
Posts:
21
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

Just to verify, as it stands right now, there is no way to return a shopper to the category they last viewed when the 'Continue Shopping' button is pressed, correct?

I agree that returning them to the product they just purchased is annoying for some and confusing for many.

5 Jul 2008, 5:57 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 'Continue shopping' link in shopping cart

You can always change the logic to look for the master_categories_id of the product added and go to the listing with the right page loaded ... it just takes re-working the logic ...

However, if I came from New Listing or Featured Listing and went to product _info to add the product and then was brought back to the Category products listing on the page for that product ... what help was that to me, as a customer? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Jul 2008, 6:17 PM
#9
snarg avatar

snarg

New Zenner

Join Date:
Feb 2008
Posts:
21
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

Imagine you are on a site with ten categories, each category has 200 products. You have browsed through category '1' up to product number 57. You decide to add 57 to your cart. When you click 'Return to Shopping' you are returned to the product you just decided to purchase with no way to return to your previous location other then re-browsing the entire category again...

I would much rather have my customers returned to the product category, regardless of how they go to the product, then be returned to the product and thus be forced to re-browse the entire category to return to where they were before.

I hope the above scenario makes this problem clear.

Ajeh:

You can always change the logic to look for the master_categories_id of the product added and go to the listing with the right page loaded ... it just takes re-working the logic ...

As much as I would love to implement this solution, I know almost nothing about programming. I was happy just to get my cart working :)

5 Jul 2008, 6:59 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 'Continue shopping' link in shopping cart

I am saying it can work the way you want as described ...

I am cautioning you that when adding the product in any other way than coming form the product listing ... to the product _info ... hit add to cart ... go to shopping_cart ... click continue ... going to the product listing for the given category for the product and to the specific page on the pretense of "continuing from where you left off" will not always be "where you came from" ...

If you were panning through other listings then forcing the category listing could be a problem ...

However, you can always get something like this written and as you do not feel you wish to tackle this on your own, as it is not a simple slam dunk, then you may want to post in the commercial help wanted ...

There are also a could other ideas on this concept to give the customer a few other choices on where to go next from the cart ... but that would take a long time to break them all down etc etc. for someone else to write ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Jul 2008, 7:47 PM
#11
lightus avatar

lightus

New Zenner

Join Date:
Jul 2008
Posts:
8
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

You could try something like this in your functions_general.php file, function "zen_back_link()" at around line 994.

replace:

$link = '<a href="' . zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']) . '">';

with:

$temp_string = explode("&", zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')));
if (substr($temp_string[0], 0, 5) == 'cPath') {
  $link = '<a href="http://www.yourdomainname.com/index.php?main_page=index&' . $temp_string[0] . '">';
} else {
  $link = '<a href="' . zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']) . '">';
}

This is what I wrote to accomplish the task... basically if there is a "cPath" at the start of the $_SESSION['navigation']->path[$back]['get'] variable, I return to it, otherwise it continues as normal. Replace "yourdomainname.com" with your domain obviously. There is a better way to put the website name in there, but I was lazy :-P. Maybe I'll go do that now...

Make sure you test extensively, I run a simple website with most things disabled, no sidebars, etc.

Hope that helps. Use at your own risk, make backups, etc. :-)

Lightus

20 Jul 2009, 5:56 PM
#12
javaman avatar

javaman

New Zenner

Join Date:
Jul 2009
Posts:
7
Plugin Contributions:
1

Re: 'Continue shopping' link in shopping cart

This worked for me. Brings me back to the point where I was in the listing:
replace(line 994ish):

$link = '<a href="' . zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']) . '">';

with:

      $temp_string = zen_array_to_string($_SESSION['navigation']->path[0]['get'], array('action'));
      $temp_string2 = explode("&", $temp_string);
      if (substr($temp_string2[0], 0, 5) == 'cPath') {
        $link = '<a href="http://'.$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF].'?main_page=index&' . $temp_string . '">';
      } else {
        $link = '<a href="' . zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']) . '">';
      }
30 Sep 2010, 12:21 AM
#13
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

Anyone here that can help me get this code working for 1.3.9? I get PHP Parse error: syntax error, unexpected T_ELSE in /includes/functions/functions_general.php on line 1016.

Thanks :smile:

30 Sep 2010, 12:50 PM
#14
fragageddon avatar

fragageddon

New Zenner

Join Date:
Jul 2010
Posts:
79
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

Nevermind.

16 Nov 2010, 3:52 AM
#15
gqq0404 avatar

gqq0404

New Zenner

Join Date:
Jul 2009
Posts:
9
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

I replace the code lightus suggested but it just broke.
javaman code didn't break but doesn't work either.

Does any one solve this problem? Or simply can't do it?

27 Feb 2011, 8:12 PM
#16
luciano9876 avatar

luciano9876

New Zenner

Join Date:
Jan 2011
Posts:
26
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

For me it seems work, I am using 1.3.9h
I am using the javaman mod, but I had to change something to it, otherwise I was connected to http://mysite/<a href

here it is (javaman's code with a little mod):

$temp_string = zen_array_to_string($_SESSION['navigation']->path[0]['get'], array('action'));
      $temp_string2 = explode("&", $temp_string);
      if (substr($temp_string2[0], 0, 5) == 'cPath') {
        $link = 'http://'.$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF].'?main_page=index&' . $temp_string;
      } else {
        $link = zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']);
      }
27 Feb 2011, 8:35 PM
#17
luciano9876 avatar

luciano9876

New Zenner

Join Date:
Jan 2011
Posts:
26
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

PS: Thanks for the solution, Javaman! :clap:

22 Mar 2011, 7:55 PM
#18
luciano9876 avatar

luciano9876

New Zenner

Join Date:
Jan 2011
Posts:
26
Plugin Contributions:
0

Re: 'Continue shopping' link in shopping cart

minor update

$temp_string = zen_array_to_string($_SESSION['navigation']->path[0]['get'], array('action'));
      $temp_string2 = explode("&", $temp_string);
      if (substr($temp_string2[0], 0, 5) == 'cPath') {
        $link = 'http://'.$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF].'?main_page=index&' . $temp_string;
      } else {
        $link = zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']);
      }

(changed & by & in the link)

12 Jul 2017, 3:39 PM
#19
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: 'Continue shopping' link in shopping cart

luciano9876:

minor update

$temp_string = zen_array_to_string($_SESSION['navigation']->path[0]['get'], array('action'));
$temp_string2 = explode("&", $temp_string);
if (substr($temp_string2[0], 0, 5) == 'cPath') {
$link = 'http://'.$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF].'?main_page=index&' . $temp_string;
} else {
$link = zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']);
}

> 
> (changed & by & in the link)

How would I get this working on 1.5.5e please?

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

19 Jul 2017, 4:18 AM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 'Continue shopping' link in shopping cart

Nick1973:

How would I get this working on 1.5.5e please?
Given that the code is pretty much the same, you'd make the same change, but the code change is at line 1033.

(I've not tested it, but that's where the code has moved to, and if the change worked "before", the same change should work in v155 too.)

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.