Date and Time Choosing Project

Quoted a new client the other day for an install of the Date/Time chooser for deliveries, but with some added extras, namely;

Rule 1. Deliveries can only be selected from Tuesday to Saturday.
This took a small function to exclude sundays and mondays from the datepicker display.

Rule 2. Delivery slots are available only from 11am to 2pm
Subject to rule 1 days, and in 15 minute slots; 11, 11.15, 11.30 and so on. Fairly straightforward.

Rule 3. Delivery days can be booked upto 6 months in advance.
Again, straightforward.

Rule 4. Delivery slot can only be booked for the next day if ordering before 8pm the day before.
If after 8pm, the earliest delivery is the day after next (subject to rule 1). 1 line of PHP deals with this.

Rule5. Time is to be determined based on New York time. The server is located in Texas.
1 line of PHP solves this.

So, I made it…

As I had some time free today, I coded this mod whilst waiting on the client to decide whether or not to accept my quotation.

The modification turned out very well, and is using a minimum of code for all the necessary calculations, mainly HTML (php) for the layout, a couple of lines of PHP code to ensure stability of New York timings and a few lines of javascript to power the whole thing.


osCommerce is probably not the best tool to use for taking orders (this modification is for a restaurant), but it can be made to act in any way needed, with some coding finesse.

CSV Manifest Import to update Orders

Completed this past week a CSV (Comma Separated Values file) import facility which scans through a CSV line by line and updates the order_status_history to add the postage tracking number and sends an email to the buyer to let them know their order has been shipped. The CSV is produced by the dropshipper, so I had to;

1. add in an upload facility to grab the Manifest CSV (for this I used uploadify)
2. bespoke code to scan through each line of the CSV to see if the order ID has 3 letters attached to it (these 3 letters are the dropship code to say “shipped”).
3. if any line with those 3 letters are found, then grab the contents of another cell (tracking number) and insert into the order_history.
4. send email to the customer to let him know his package is on the way and his tracking number

The CSV could contain many shipped items and many not-yet-shipped orders. So all this had to be done on a multiple basis. This meant a foreach loop to update the DB and send the email.

My client now can update ALL the new shipped orders in one shot, rather than have to manually scan each Manifest, find the order, edit it, copy/paste the tracking number and so on. This takes the workload down from perhaps 30 to 60 minutes per day to just a few seconds!


All in all, a very interesting project, and one which will be of immense value to the site owner long term. By saving a minimum of 30 minutes per day, that’s 3 working weeks over the course of a year – 3 weeks in which the site owner can concentrate on other important things such as customer service, SEO, finding new products or whatever.

Template Monster template – project complete

Had a potential client contact me who had purchased a Template Monster osCommerce template. “oh no”, thought I. The client had some good ideas to try to make the template less like a template and more to their own design.

The majority of changes took place in the header and footer files (including the template_* files) and I soon came to realise that the 2.3.1 templates from Template Monster are coded just as badly as the older 2.2 templates. Absolutely horrible.

All in all, we did some quite cool things, such as HTML5 image swapping menu, nicer cart in header, search box in header, newsletter sign up in footer, better “guest” welcome messages in header, paypal logo in footer, social icons in footer, new breadcrumb layout and other cosmetic changes to better reflect the company ethos.

A very nice project, and I am quite happy to have recoded quite some portion of the TM code, bringing the template from something that many sites could use, to something that only this particular site will have.

osCom 3.0.2 is available

osCommerce Online Merchant v3.0.2 is out! Not announced at the osCommerce forum, only on Twitter – seems that the osCommerce forum is not used anymore for announcements.

I took the time to install it – it’s very similar in looks and feel to 3.0.1. It is still unusable in real life use (as important modules are still missing). But it is forward movement for osCommerce, which is a good thing.

How to Install

Firstly you need a server that has the following as an absolute minimum;

  • PHP 5.3.0 or greater
  • MySQL (PDO)
  • OpenSSL
  • Phar

Also, recommended are;

  • Curl
  • GD Library
  • HTTP
  • SQLite (PDO)
  • Zlib

In PHP, you need the following settings ON; file_uploads and the following settings OFF; magic_quotes, register_globals, session.auto_start, session_use_trans_sid.

If you have all that ready to go, then the install is simple

Step 1; Create an empty database

Step 2; Follow the installation procedure (this is a series of pages asking for information, it’s very simple to follow.

If anyone wants a more in-depth post on how to install, let me know.


Pointless to make a public release of this – it is unusable for 99.9% of shopowners at this point. Developers are not being informed as to upcoming changes – changes are introduced in older osCommerce and then not being carried over (a typical example is 960 grid system introduced in 2.3.1).

Release to developers and interested others as a beta. This would immediately solve the problem of new osC users wanting to download the “latest greatest” then finding it to be unusable.

Lastly, GPL…

Is osCommerce still GPL? The answer appears to be a sort-of “no”. It is licensed BSD, under a Modified BSD License. I’m not sure what the implication of that is/will be.

Saved Cart? Returning Customer?

I have two clients in particular who come up with really good ideas for their shops. These shops, I believe, will eventually be the standard by which all other osCommerce shops will be measured, they are that good.

One of these shops deals with repeat customers a lot, so the owner came up with the idea of somehow finding a way to see if the customer (when logging in to check out with a new order) has a “merged” cart.

What is a “merged” cart?

osCommerce has a standard function whereby if customers do not complete checkout, then their cart is saved for the next time they login. If they come back later on in the day, or in the future, the cart that was saved is presented to them. It looks like this on log out;

Then, when they log back in, the cart contents are available. If in the meantime (without logging in), they add other items in the cart, and THEN log in, this new cart and the old (saved) cart are merged! Sometimes this is undesirable as the customer may have changed their mind or somesuch, and it is hard for the customer to spot until they get to the checkout_confirmation page! So, a solution is needed to combat this…

With a little new code in login.php and a little bit of code in shopping_cart.php it is possible to redirect the user to the shopping_cart and give a nice message explaining the merged cart and allow them to ensure that the order is OK.

The login.php change determines whether the cart is “merged” and the shopping_cart.php change shows a message;

Pretty nice, obviously if no “merge” occured then the message would not be shown.


A good way to bring attention to a potential problem before the client gets all the way through your checkout to find out his/her order is not correct!