Too bad no one seems interested in this thread![]()
Too bad no one seems interested in this thread![]()
Ok--here's a solution that works for me...
the other 'fix' here, wasn't a fix at all, I've got a complex site with many category levels.... etc.
Ok, here's the code I started with in the file: tpl_shopping_cart_default.php
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div>
Now, here's what I changed it to:
<div class="buttonRow back"><a href="<?php echo zen_href_link(FILENAME_DEFAULT, "cPath=$cPath"); ?>"><?php echo zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT); ?></a></div>
Works perfectly for me, gets right back to the category of the last product I added to the cart.
Turns out this is a halfway solution. It only works if someone uses the "add to cart button". If they view the product listing first, it does not work.
Here's a good question I think: how can I make sure the $cpath variable gets loaded if someone is adding to cart from a product listing?
Blah, blah, blah...ignore everything else I wrote (unless you have a proper PHP solution, then cough it up!)
Ok--the only solution I can come up with, is just a simple javascript back. If the user has javascript disabled, then oh well.
Nothing else works 100% or even 60% properly for me.
You can see the old version of the button link above, here's the new version:
<div class="buttonRow back"><a onclick="javascript:history.go(-1)"><?php echo zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT); ?></a></div>
Notice.. I didn't include <a href="...
The reason is, I think it looks a bit sloppy, so I just buried the function inside an onclick function.
If I clean up my store URLs, I might do this to a lot of buttons if I'm too lazy to fix internal links...
Sneaky, sneaky, sneaky...
Just want to say thank you! I never had time to do it earlier but I have this installed on all carts I maintain. This is a must! What good is it if you put something in your cart and after you want to go back shopping and you get bounced to the home page? Most likely I would like to continue where I left off shopping. Right?
Its like at the brick and mortar store they would send you back to the door every time you put something in the shopping basket!
Feature should be standard behavior.![]()
Live and learn... the Zen way.
I haven't tested it completely, and I've got way too much extra code to verify it works on a "normal" site, but it looks like the problem is in
"includes/functions/functions_general.php"
around lines 992 and 1010, there is
if (sizeof($_SESSION['navigation']->path)-2 > 0) {
I changed this to be
if (sizeof($_SESSION['navigation']->path)> 1) {
and then the continue shopping button took me back to the page I was looking at when I added the product to the cart....
Your results may vary.. but it's something to try....
I just wanted to say that when I added Adelante's code to the site I'm working on, it broke my product listing index pages.
In case it happens to anyone else, it's because of the comments. Session data truly must be the FIRST thing that shows up on a page. Stuff that is commented out is okay, BUT he's using HTML comments, not PHP. Therefore HTML is showing up before the session data - and breaking the pages.
To fix it, just replace his original code with this:
note how now the comments are within the PHP tags - so the session data is *still* first in line. It works like a charm now.Code:<?php // reset the session variable unset($_SESSION["last_category_visited"]); // change the variable from "last category visited" to "current product category number" session_start(); $_SESSION["last_category_visited"] = $current_category_id; ?>
Bookmarks