I am hoping someone can help me here since the CS Cart team is too busy to help me. On all my product detail pages, I have a Return button that brings the user from the product back to the list. CS-Cart supplied me this code, but they didn't take into account if the category was split up over several pages of products. So what happens is if the user is on page three of the product listing pages and clicks to view a product, the Return button brings the user back to the top of page 1, losing their space. In theory, they should return to the page they left off and at the position on the page of the product (or in the least to the page they left off).
This in effect returns the customer to the previously loaded page and only within your site (ie. will not return the customer back to a search engine results page).
Mixing ajax pagination with history may not give the desired results. I.e. this might take them back to the home page since the last “loaded” page was the 1st page of the category listing.
First, thank you so much for replying. I really appreciate your help.
Tbirnseth, thanks for the mod to the code, but I need it to be dynamic. The “&page=1” brings it back to page 1, as it says. So if I'm on page 5, click into a product, I need it to return to page 5 (and preferably to the location of the product within the listing).
StellarBytes - yeah, I thought of that too, except the problem is if they arrive at the product not from the product listing page. Thanks for the thought though!!
No sorry, the code I was and AM using did go to the first page correctly. It wasn't until I set the products page to display a certain amount at a time that I ran into this issue (it was previously set to show all products in the category at once). I want it to dynamically return to the page the product it's listed on. So if I click from product listing page 5 into the product detail view, I want to click a button to return to the list, but at the spot I left off. It keeps kicking me back to page one, resulting in having to remember which page I was on to keep going through the list. Sorry if I wasn't clear. Does that make sense now?
So, in regards to your reply, I'm not sure what you mean when you say do the math on the $smart.request.page… I hate to ask you to explain, but if you had a moment I would love to understand how that applies.
No way to do it from where you are without capturing the 'reffering url' and then parsing it out for the button.
Sorry, but I don't have time to figure it out right now but the jist is that you're going to want to capture
$smarty.server.HTTP_REFERRER and use that as the URL for your link. Though without investigation, that could result taking you back to page 1 also since they do pagination via ajax requests…
Ah, I see. OK, this is indeed way over my head. Would you happen to know how other people work around this issue? It seems to be a bit of a flaw in the navigation of the system, no? Just curious your thoughts on this…
Thank you so much for taking the time to try to help me - I really do appreciate it.
No way to do it from where you are without capturing the 'reffering url' and then parsing it out for the button.
Sorry, but I don't have time to figure it out right now but the jist is that you're going to want to capture
$smarty.server.HTTP_REFERRER and use that as the URL for your link. Though without investigation, that could result taking you back to page 1 also since they do pagination via ajax requests…
Is there anybody that might be able to help me? I'm trying to figure out how to incorporate the $smarty.server.HTTP_REFERRER as Tbirnseth recommended, but it's failing each time as my smarty capabilities are next to none…