Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

george@piccexcellence.com on "Return to Previous Page from Shopping Cart"

$
0
0

I am having a problem getting back to the correct page once I "view cart". We use the Zen shopping cart. I have tried setting Session variables and also setting a returnPage cookie. In each case the page id is incremented and I am returned to the wrong page. Seems like Zen really screws around with SESSION variables so I can't get them back the way they were set to start with.

Setting a cookie:

$dateToExpire = time() + 720;

	$page_id     = get_queried_object_id();
	$return_page =  "http://www.myserver.com/?p=" . $page_id;

	setcookie("ReturnPage", $return_page,$dateToExpire, "/", "myserver.com");

This is executed each time a page that contains a purchasable item is accessed so I can grab the page id, slap it in a cookie and retrieve it later when coming back from the shopping cart. My problem is $page_id keeps getting incremented between returning from the shopping cart and recovering the COOKIE value.

any thoughts would be appreciated.

G.


Viewing all articles
Browse latest Browse all 8245

Trending Articles