Recently Viewed infoBox in 2.3.1

By | January 5, 2011

I needed to code up a feature for a client which tracks a visitor “product_info.php” page views to basically show them what they recently viewed. I have to say that although I never thought about it, this is quite handy to have, as I have often been on the point of buying, looked at something else, then forgotten what product I was about to buy.

So, as the client is on 2.3.1 and we all know that there are barely any well written contributions for it, I decided to hack up an older contribution from kymation (Jim Keebaugh) who I know writes code in a very decent way…his contribution is here (5 Nov 2008 download).

The parts I used were the changes in product_info.php and logoff.php, this gives enough information to build an array of product IDs that have been visited. The array of product IDs is stored as part of the browsing session.

I then created a new infoBox to take that array and build up a gallery of recently viewed products. It looks like this;

I particularly made the images quite small in order to fit 4 in a row. The images are also linked to their respective product pages.

If there is nothing in the array (or, in plain english, the person viewing your site has not looked at any products) then this box does not show at all, no point in showing a box that has no contents!

I’m still fine-tuning the system, but overall, it seems to be solid.

Give me your views on it, please. Can it be changed to make it better, more interesting? I did think about changing the code showing the images to make it more like a fade in and out type effect, but then thought “whats the point” – after all this is a navigation history so everything needs to be seen at the same time.

5 thoughts on “Recently Viewed infoBox in 2.3.1

  1. Michael

    I Think its a great feature to have – especially if you have a lot of products in your store. I’m looking forward to the final version.
    About improve – i Think instead of the traditional box – maybe integrate this in the product view main content area, and not left/right column

  2. Xpajun

    I think I would still like to have the original idea of loading all the “just viewed” into a page with buy it now buttons and a short description – it’s a kind of comparison page really – your smaller pics are neater though

    The next question will be where to put all these extra boxes…

  3. Gary Post author

    Michael – you mean more like a module such as the “also_purchased” module? That is certainly doable, and would not take much coding.

    Juls – making a whole page from this would also be just as easy. Perhaps it can be linked from a “see all my history” link underneath the images in the infoBox.

    Also for both of your idea it would be very possible to include more information such as “buy button”, “description”, “price” etc.

  4. Eric_K

    I agree, this is a very useful feature that I’ve installed on several osC2.2 sites. It works well as a right column box, displaying the product thumb, name, price and More button. The box heading “Recently Viewed >>” links to recently_viewed.php that displays product thumbs, name, Add to Cart, price and options if available.

    This will be a great add-on for osc2.3.

Leave a Reply

Your email address will not be published.