Enquire about WHAT product?

Here’s a little project I completed some time back but updated today. The essence of the project is to create a new osCommerce page that acts like the “contact_us” page but allows the person contacting to let the shopowner know precisely what he or she is interested in.

So, I made a copy of contact_us with some extra details (name, email, enquiry, location and then a chained selector system based on manufacturer, product and size). Think in terms of a shoe shop which sells a range of manufacturers and model of shoe.

What is a chained selector?

So, the person first selects the manufacturer, the second dropdown is then populated ONLY with the products from that manufacturer, the third dropdown is a size dropdown. Now the customer can fill out all the info and the shopowner can email them back to let them know where/how to purchase.

All pretty good and works well.

I then came up with the idea of showing the image of the product based on the inputs. So, when a person selects the info, an image of what they have chosen appears. Does that make sense?

Here’s a video in action;

Let me know what you think…

2.3.1 to 2.3.2 upgrade service

2.3.1 to 2.3.2 upgrade service

For those people who do not want to tak the chance of upgrading their shop(s), I install the new password reset functionality, and fully test it. It does not matter if your site is modified by addons or templates – I guarantee a fully working upgrade of the password functionality.

The service is going to be a “beer fee” of £20 per osCommerce install, payable by Paypal. If interested, email me on oscshops AT gmail DOT com

Please bear in mind that I require FTP access to your existing 2.3.1 shop, also that I will create an account at your shop (to test the new functionality). If your site runs multiple languages, you will need to translate for me.

Products to Specifications and Customers to Specifications

Earlier in the year I created a “products to specifications” system – it was created specifically for a Pet Shop where the site owner can say “this product is good for Rabbits, Guinea Pigs, hamsters” and so on. This can be done for an unlimited number of specifications on an unlimited number of products. So, 1 product is great for this and this, another is great for this and that, another is great for that and that. You get the idea, I’m sure. The Admin Area looks like this (product adding/editing page);

Fast forward 6 months, and it is now time to do another portion of the Specifications project. This portion is to allow the customers of the shop to tell the Shop Owner what animals they own. Once coded it will look something like this;

The available animals are the exact same as in the admin area. When the Shop Owner adds or removes animals, these options update. The Customer ticks the animals they have and this data is saved in a new Database table. When they acquire a new animal, they can easily update in the customer_account page.

What is the reason for knowing the animals a customer has? Anyone have any idea(s)?

Filtering and Sorting Specials

Late last night I came across an interesting post from Carine, where the need is for filtering and sorting of the special offers. I’m intrigued to see what Carine comes up with…

In the meantime, I decided to code up something very quick and dirty on the specials page only. I chose the easiest options and came up with a way to filter on;

– manufacturer
– % of the discount

and sort on;

– amount of the discount

In addition I wanted to ensure that selected sort/filter is maintained even if another sort/filter is chosen. In this way I can say (for example) “show me discounts above 25% on products by Microsoft, sorted from high to low”. This makes the specials very easy to find, and would be useful for those shops who have many special offers running at one time.

There’s no limit to how many filters/sorts can be run at one time, as all the filters/sorts do is change the SQL command that grabs the products from the database.

Here’s an example video, showing some sorting and filtering;

Some more examples (would just need a link added, and some extra SQL);

– filter specials to show all DVDs on special offer
– filter specials to show all DVDs only from Warner that are more than 50% discounted
– sort specials by original price

I’m sure that we can think of many more. And all are possible, why not?


A good idea by Carine, and useful for allow potential clients to drill down through your special offers to find what they are looking for faster. Which can only be a good thing.

Contact Form on search results?

The other day I wrote about my new “fuzzy search” which brings more power to the search function of osCommerce. My friend Paul asked about having a “contact form” on the search results page. My idea was to have a form show if the fuzzy search results show.

So, now the advanced_search_result.php page looks something like this;

Now the person searching has the ability to see “exact matches” as per usual osCommerce and “fuzzy matches” as per my update and a “form” to easily contact the Shop Owner. The form utilises the usual osCommerce structure, including error messages as appropriate and action_recorder.

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.

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”…

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.

Get Order Status without logging in…

A nice idea by a client of mine is to have the ability for a customer to insert their order number and email address into a form, which then shows their “order status”;

And the information is presented, without a new page load;

This idea is something that I have not seen done before. It took a fair bit of coding effort, but the end result is quite good. The client in question has quite a modified site which allows “guest checkout”, where an account is not set up for a customer, this means that there is no way for the customer to see the status of the order (which is normally done by logging into the account and viewing the order history).

With this modification, all customers (whether they have an account or not) can view the status of their order…

In action;

Add Math Protection to contact_us.php

This morning I was contacted to see about adding a question to osCommerce just like I have on this blog – where I ask a math question…I was going to suggest using Google recaptcha service, but the client did not want that.

And so…

Adding a question such as “what is 3+5” cuts down on automated bots spamming the heck out of you. A good place to implement this in contact_us.php, and the code changes are very simple.

The basis of the change is to create two random numbers, and ask the person contacting you to insert the total into an input field. The field is then checked to see if the answer is correct. If it is correct, then the contact email is sent to the shop owner. If the answer is incorrect, a “fail” message appears.

Step 1. Add the language defines to the language file.

We need two new defines, one for the “question” and one for the response if the question is incorrect.

(and any other languages you operate in your shop)


Step 2. Add the logic to the contact file.

Here we need to create two numbers, add them up and ask the question to the user. http://pastebin.com/L7zaX7Tr

And that is all there is to it. Try it out in your store if you wish.


In line 21 of the pastebin I used base64_encode to create a hidden “answer” variable which creates something to check the users answer against. In line 6 I decode it, and then in line 8 I check one against the other. I use base64 to “hide” the value of $a + $b from prying eyes.

My use of base64_encode and base64_decode is no more than that…if you are unsure of what I am doing in the code, I suggest to ask question to help yourself to understand more fully, or not use the code. The base64 code might (assuming you use “site monitor”) ring alarm bells. I guarantee that if you use my “math protection” code as is, there is nothing harmful in it.


A useful way to cut down on the spam that is sent via contact forms. You could also add this to any other form in a similar way (eg, create_account.php, tell_a_friend.php and so on).