I know this has been answered, but I wanted to elaborate for anyone who is still having trouble with this, especially since it seems like no one (other than the OP) has taken into consideration he is using Volusion.
So, for the first answer, I want to point out that No, Don't need PHP to do this, and since this is a volusion issue, you definitely don't want to try to solve it in PHP, since their servers do not support PHP...
The other answer is definitely on the right track, except I'd like to point out that volusion already provides this functionality and already stores the info in a cookie so there isn't any reason to create your own.
I'd suggest doing so in JavaScript; However, before you go and try to custom code a solution, check out this link:
Volusion's "My Recent History Widget" - Displaying A Customers Recently Viewed Products
You could manipulate this functionality using JavaScript and do a client side change of where that is placed on the page, and/or change the actual html code they insert into your page for it.
Or if you want to do it with a more customized solution, Please read the following:
Volusions Software Cookies; Including Functionality Cookies
Functionality Cookies
These cookies are used for some of the more enhanced features available with Volusion. You can disable these features to prevent these cookies from being stored on customers’ browsers.
History50 – This cookie stores the ProductIDs of the last items viewed by a customer on your store. This cookie is used to control the My Recent History functionality, which can be set to appear at the bottom of all product pages as your customers browse your site..."
In order to access the cookie information using JavaScript you can use a code such as:
function getCookie(name) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
}
To Explain the above code for those of you that might be beginners
- Assign the cookie name as a parameter (cname)
- Create a variable (name) and include what you want to search for (cname + "=")
- Split document.cookie on semicolons into an array and call this ca (ca = document.cookie.split(';')).
- Loop through the array you just created (i = 0; i < ca.length ; i++)
- Read out each value (c=ca[i])
- If the cookie is found, it will return the value of it.
- If it's not, it will return "" (null)
You'll want to put that script in the section of your page...
And later on when you want to actually use the data, you'll want to use something along the lines of this:
var x = getCookie("cookiename")
if (x) {
[do whatever you want with x here]
}
Obviously this is not the exact code you will use to create your custom recently viewed products widget, but, it will give you the concepts you need in order to do so.
Some quick google searches on "use cookies in JavaScript" will return more information than you could ever use.