Now you can add a simple line of code to your store design (anywhere on your store's graphical interface) that will list the last few products visited by a customer (you can easily set how many are shown). By default, the last 10 products viewed in the storefront are listed.
The feature uses a harmless cookie on the customer's computer, so recently viewed products are shown even if the customer leaves the store and comes back a few days later.
An intuitive “Clear List” link allows the customer to instantly clear the list.
To add the “Recently Viewed Products” widget to your ProductCart-powered store, simply add this line of code in the location where you want the products to be shown. Typically, it is added in left- or right-side column. Depending on how your store has been designed, the code will be added to either “pc/header.asp” or “pc/footer.asp”.
<!--#include file="smallRecentProducts.asp"-->
To confirm that the feature is working properly, visit any product details page. The list of previously visited product should now list that product.
The list of products recently viewed by a customer is saved to a harmless cookie on the customer's computer system. The cookie is called “pcfront_visitedPrds”. This means that the list of products will be saved even when the browser is closed. Customers can instantly clear the list by using the “Clear List” link.
The “Recently Viewed Products” widget is included in ProductCart v3.1 and above. It should be compatible with all ProductCart v3 stores. So if you don't have it, you can download it here (updated on 10.21.08).
To change the number of products to show in the list, follow the instructions below. By default, the last 10 products viewed by the customer are shown.
'// The maximum products to show MaxProducts=10
The ID of the DIV that displays recent products is “recentprds”. So you can easily style it by adding a new style definition to ProductCart's main storefront stylesheet (“pc/pcStorefront.css”). For example, you could add something like this to pcStorefront.css:
#recentprds { background-color: #F7F7F7; color: #666666; font-family: Arial, Helvetica, sans-serif; font-size: 9px; }
You can add the AJAX product preview to Recently Viewed Products by replacing the existing link to the product details page with the following code:
<a href="viewPrd.asp?idproduct=<%=tmpVPrdArr(0,tmpIndex)%>" <%if scStoreUseToolTip="1" then%>onmouseover="javascript:document.getPrd.idproduct.value='<%=tmpVPrdArr(0,tmpIndex)%>'; sav_callxml='1'; return runXML1('prd_<%=tmpVPrdArr(0,tmpIndex)%>');" onmouseout="javascript:sav_callxml=''; hidetip();"<%end if%>><%=ClearHTMLTags2(tmpVPrdArr(1,tmpIndex),0)%></a>
If the “Clear List” feature is not working the reason is probably that you moved smallRecentProducts.asp to another folder (e.g. to the root of the web site), but did not change the references to the ASP page that performs the task of clearing the list. Specifically, you will have to edit the two lines of smallRecentProducts.asp that reference clearViewedPrdsList.asp.
For example, in the sample code below, the two lines of code were edited to account for the fact that the file was moved 2 directories up. Here the “productcart” folder had been renamed “store”, so the path to the file clearViewedPrdsList.asp becomes “store/pc/clearViewedPrdsList.asp”.
<iframe id="clearViewedPrdListCookie" src="store/pc/clearViewedPrdsList.asp" frameborder="0" width="0" height="0"> </iframe> <script> function ClearViewedPrdList() { document.getElementById('recentprds').style.display='none'; document.getElementById('clearViewedPrdListCookie').src="store/pc/clearViewedPrdsList.asp?action=clear"; } </script>