You already purchased this item…

By | July 19, 2010

In some shopping sites, I think it’s a good idea to show people the items they’ve already purchased. In osCommerce, this is standard and is known as the “perviously purchased” infoBox.

Which is good enough for most stores – but what if your store sells products that are very cheap and people might accidentally buy again (I’m thinking maybe a DVD or Book store – after a few months I can barely remember what I’ve read or watched!)…

I haven’t found any site that shows the buyer if they have already purchased the product within the product_info page, so I set out to try to find one. The closest I could find was this “freelancer” job from;

We are currently running OsCommerce and would like to add the ability for a logged in customer to see items that they previously purchased with us. The key screens will be the product_info.php which displays the product detail information, search pages, shopping cart page and the confirm order page. The reason for this modification is that we have many customers that come back often and buy films and they would like to know if they had already purchased the film so that they do not have to send it back. Basically each fo the above screens need to display a message “* Previously Purchased Item” in red so they know thye had already bought that item from us.

After less than 15 minutes work, here is what I came up with;

Which shows the buyer that they have already bought the product using the following code;

[php]clubosc_previously_purchased($products_id, ‘tr’)[/php]

Note that in my function, the “tr” signifies that the “you’ve already bought” message should be wrapped in table tags to suit the markup of the product_info page.

Obviously if they are looking at a product that they have not previously purchased, then the message does not show at all.

I then took it a step further, and added almost the same code (though notice there is no “tr” this time, so instead the function shows an image!


to the product_listing module, but this time used an image to show if the product was previously purchased (the small exclamation mark image, obviously as the shop owner you’d let buyers know that any product with this image means they have already purchased it);

A ncie little mod, that should come in handy for many stores. If anyone wants to commercially sponsor a code clean-up and contribution, please do email me.

Fuinny isn’t it, that this blog post took me longer to compise than I spent actually making this basic modification of osCommerce!

Leave a Reply

Your email address will not be published.