Project for today 28 June 2012

Today and tomorrows project is to fix up a shop that a developer upgraded from 2.2 to 2.3.1. Lots of little things are broken and these all need to be put right. In addition the site owner has some other things that need attention which the developer could not handle.

In general, I need to fix the admin area as it has been templated, and the template used is very hard to look at. Also fix a problem in the product_attributes page. Whos_online does not display correctly so that needs attention. Emails are not working on create_account or contact_us. Security needs to be looked at (I can already see a couple of problems here). And a payment module is not working in the way that the shopowner requires.

And lastly a new function to allow the shopowner to set a minimum buy quantity on a per product basis. There are a couple of addons that can handle this, but I’ll make my own as it will be quicker.

All in all, the type of job that I enjoy. Solving lots of little problems, whilst being given a free hand to solve them in any way I want. Should be interesting.

osCmax – Fuzzy Search

The other day I coded up a “Fuzzy Search” function for osCommerce. One of my clients on osCmax wanted the same, so with a few changes (to accomodate the crap & outdated & bloated code in osCmax2.5.2) it is now done;

Searching for Matrix (did they mean Matrox ?);

Searching for Matrox (did they mean Matrix ?);

Searching for Matrex (did they mean Matrix or Matrox ?);

Making the Search Function more useful

Some time back I attempted to make the osCommerce native search function a little more useful by coming up with code to allow the search result to offer alternatives if the product being searched for cannot be found.

My idea was in case of mis-spellings. I gave up as I could not get much of anything to work well, without some major coding. Fast forward about 3 years to now…and a forum post gave me an idea to try…

How it is now

Go to and search for the DVD movie called “Beloved”. But deliberarely mis-spell as so; belovd

What is the result?

With my changes, the result would be like this

As you can see, the “Beloved” DVD is returned in a “recommendations” box, even though the search was mis-spelled. This allows the user to easier find what they are looking for.

Another example is the mis-spelling “matrex” – is the person looking for “The Matrix” or “Matrox G200”? Try it at the osCommerce Demo Search Page – no result!

And now watch the video showing the “belovd” search and the “matrEx” search;

I’m still working on the codebase, so if anyone has any input let me know. Should this “fuzzy” search also give results when an exact match IS found? Eg, if a search is made for Matrix, should the Matrox products also show in the search results?

Updated Video, based on Isa’s idea for similar searching

New Gallery style for osCommerce Product Page

One of my clients needed a way to present products in more of a gallery style, utilisinig a thumbnail and popup full size to fancybox. The usual way for showing a gallery (that is products with more than 1 image) is like this;

The thumbnails are auto created, and the user can rollover them to show the larger image (also auto created). The larger image can then be clicked on to get a full sized popup in fancybox. The thumbnails are not clickable.

The main problem here, that no one has been able to get around is to make the thumbnails clickable to bring up the fancybox.

Moving on…

So, the project was to enlarge the thumbnails so that they sit 4 in a row, and to entirely remove the larger image. Also make the thumbnails clickable to bring up the fancybox. A few lines of code later I had this working – now the product_info interface looks like this;

and these thumbnails are clickable to Fancybox (full size);

Groupon Payment Module for osCommerce

Was contacted late last night for an urgent task which was to create a payment module which has the ability to accept a Groupon Voucher and PIN code. Once I started thinking about it, I realised that a payment module is probably not what was required, and what is required is a discount module. But I was wrong. This client wants a payment module as the full cost of the product will be covered by the Groupon Voucher.

Pleased to say that I managed to deliver a working module before 9am this morning, as the clients groupon campaign starts today! Not at all ideal, but I live in the real world of ecommerce, and try to do my best for clients.

And so, to the module

At checkout_payment.php buyer is asked to choose between the enabled payment modules;

At checkout_confirmation.php buyer is asked to insert Groupon Voucher and PIN (assuming of course, the buyer selected Groupon as the payment method!);

The inserted data is then written to the Order History table, and shown in the Order page (admin);

Pretty nice. As this was very much a rush-job, this is quite basic. Plans for the future include on-the-fly checking of the inputted Voucher and PIN (based on reading a CSV file supplied by Groupon) and limiting the the Groupon payment method to those products defined as “buyable with Groupon”…

Project for today 13 June 2012

Todays project was pretty hardcore, as part of an overall larger project that is ongoing. Client sells a range of products that need to be treated in different ways (particularly for postage)…

In essence, the products are either “live” or “dry”. Think in terms of a product such as live Coral, or a dry product which could be fish food…hopefully that example makes it a bit clearer.

I needed to make a system so that the shopowner can attach a flag to each product to show whether they are live or dry. This was done in catgeries.php like so;

Live products = 1
Dry products = 0

I then added a small amount of code to the shopping_cart.php class file to count the number of live products. Any cart_contents with (live > 0) hold at least 1 live product. Any with (live = 0) hold all dry products.

So far, so good. Next, I needed to put a message in the shopping_cart.php main file, as so;

Dry products get a similar message;

As you can see, live (or mixed) orders are limited to UK shipping, so a tiny piece of code in each shipping module (basically the count of the “live” products) turns the module on and off appropriately.

The project for today turned out pretty good, I am pleased with it. It was slightly more complicated than I have made out in the blog post, as the client also needed live (or mixed) orders (remember, postage UK only) to only be sent by courier, whereas dry orders to be sent by Royal Mail (option of recorded delivery OR special delivery). Orders abroad can only be dry, so live or mixed orders (going abroad) get a message at the checkout_shipping.php page;

You can see how it is getting more complicated!

The Buying Funnel

A bit of a conversation yesterday in the comments of my last post, which hopefully sparked something off in readers of the blog…

As shopowners, we surely exist to sell products. Nothing more and nothing less. If that is the case, then I pose a question to you all;

What are you doing to ensure that your customers buy a product from you?

Shop Owners who run osCommerce seem pre-occupied with the checkout system. Reducing it from 5 clicks to 1 click and so on, in order to save the customer 30 seconds pressing next a couple of times. I have not seen many shop owners concerned about the buying funnel.

The Buying Funnel

What is it? It’s the process of directing a potential buyer to the product they are looking for or alternatives to that product. It happens as soon as they reach your site and ends when they press the button to enter the checkout pages.

How can you direct a potential buyer to a product?

It can be as simple as a “featured product” on your homepage. This is a simple modification that most stores have.

What about if a buyer is actually looking at a product? Then what we have (in stock osCommerce) is “customers who bought this product, also bought…” which is useful to a degree, but can come up with “interesting” combinations. If some customer in the past has bought a mincemeat machine and a dog from you, you can assume that they are not going to mince the dog – but the “also purchased” module does not know this. It needs to be placed elsewhere, I’ll come up with an idea for this later on in this post.

On the product page

Let’s agree that if a potential buyer is looking at a product, then the likelihood is that they are thinking of buying the product or a close alternative. Therefore, link similar products – the “turbo” version or the “lite” version of the same product for example. On the product page, the idea is to link similar products.

Once they have found the product they want, they press “buy”. Next the buyer is directed to the shopping_cart page, or they stay on the product_info page (depends upon how you have it set up in your admin area). In either case, whichever redirected page, we now use the also_purchased module to show products that are complementary to the product just bought

The whole idea is to give the buyer alternative ideas, but not to confuse them with too many choices. Think about YOUR site and what you can do to create a buying funnel.

Project for Today 11 June 2012

Todays project is a “to do” list of small changes on a clients site. These range from simple 2 minute things such as changing some language defines to larger modifications like adding (my version of) SEO Meta Tags / Description.

In all, it’s about a days work and will be good to revisit a shop that has been successfully selling using 2.3.1 since it was ported over. There is nothing I like more than being given a list of changes to make on a store and being told to “make it happen” – given carte blanche to do those changes as I see fit (which is always the best way to have changes done) means the shop ends up with the absolute best code available and the shopowners end up very happy.

This shops owners have some excellent ideas about what they need and are somewhere near the forefront of cutting edge. It was for this shop that I created the Pinterest module for osCommerce, and this has worked stunningly well for them.

Related Products in osCommerce

My next project (which is to be done at some point before the end of the coming weekend) is to implement a system of “related products”. There are loads of already made addons that can relate one product to another and so on…

But none of them are good enough to put into my clients site. So I determined to code a “related products” module that better fits the needs of the Site Owner.


Each product needs the ability to be related to a small number of any products, in 3 categories;

  • “Worse” products. These are products that are similar to the product being looked at, but may be less expensive.
  • “Better” products. The inverse of the above.
  • “Related” products. Products that have a very close alternative, but don’t really class as “worse” or “better”.

Special handling of the better/worse products

If a product (blue widget) has a better version (blue turbo widget), and this is assigned, then also assigned must be the blue widget as a “worse” product than the turbo widget. Hope that makes sense ?

A fairly straightforward system, that won’t take very long to code up

The general idea is to (somewhat) replicate the 2.3.1 larger images system and add 3 more similarly coded pieces to categories.php to add the relationships between products. In the shop side, I will then create three new modules based on products_id, and grab the “better”, “worse” and “related” products and show them in appropriate places.

I’ll update the post over the weekend as I get bits and pieces of this coded up.