Turn ordering off when on holiday?

Had a few requests for “turn ordering off when I’m on holiday” and yesterday managed to find the time to put it together.

Needs

1. Ability in admin to turn off the checkout system, or leave it open
2. Ability in admin to set up a “we will be back on {date} message” and other “info” messages
3. Show an obvious message in the header of the shop
4. Show an obvious message in the header of the admin area

In less time than it would have taken to find a suitable existing addon, amend it appropriately and install, I made a new modification – with a few database entries, 1 block of code in admin/includes/template_top.php, 1 block of code in both stylesheets, and 1 block of code in includes/template_top.php.

Here is how it looks;

20130328-1

and

20130328-2

So, the admin can choose between 3 options;

a. Checkout = open. Checkout is as normal, no messages show.
b. Checkout = closed. Checkout is closed, those trying to checkout are redirected to shopping_cart page.
c. Checkout = partial. Checkout is as normal, but messages do show.

All in all, a nice little modification that has very little weight of code, so is easy to install on any osCommerce shop, even highly modified templates.

Previous and Next Links in Product Info Page

Someone messaged me with the need for a “previous” and “next” link in product_info.php, which links to the previous and next product within the same category.

Needs

1. If there is only 1 product in the category: do not show next link, do not show previous link
2. If the viewer is looking at the 1st product in the category: do not show previous link
3. If the viewer is looking at the last product in the category: do not show next link
4. For previous and next links, show the product name

There are a couple of contributions that can do some of this [1] [2]. Both of these are coded poorly, so it is time to come up with something new.

A. Grab the other products in the category being looked at.
B. Pass these into an array
C. Use array functions to grab the array entries either side of the current item
D. Pass those entries into jqueryui buttons and mine the products name

It ended up like this

20130327-1

And in action

Need something similar? Email me, and you can have this for a beer fee.

Currencies as Icons in 2.3.x

Almost exactly 5 years ago I posted about using icons for currency selection. The question still comes up fairly regularly in the osCommerce forum.

So, here’s how to do it in 2.3.x – you’re going to end up with something like this:

20130325_1

You need to make a “currency” icon for each currency that you have. In a standard installation of osCommerce, this is EURO’s [ EUR ] and US Dollars [ USD ]. Save them into the /images/icons/ directory as .png files like so; EUR.png USD.png

Next up open up /includes/modules/boxes/bm_currencies.php

Step 1: create a variable holder

$currencies_string = NULL;

this line of code needs to be placed in the execute() function, right underneath the line that starts global $PHP_SELF …

Step 2: create the variable

Here we need to loop through the available currencies and output them as an image. Code; http://pastebin.com/6D8ewzsn

This should be added underneath this line of code: reset($currencies->currencies);

Step 3: Change the $data to output the $currencies_string

http://pastebin.com/iSu4tVDB

Done. Refresh your page and you should see your currencies box as images. Of course, I could make this into a better addon allowing you to associate an image with a currency from within the admin area, but that’s for another day if someone wants it badly enough.

In action

Latest osCommerce 2.3.3 Theme – Penny

This theme changes around 10 core osCommerce files so is easy to install even onthe most modified of sites. Have a look at the demo.

It is a 1 column design, so there is lots of available space on every page for promoting your products. It has a horizontal menu (with dropdowns), along with a much nicer footer area. Of course, the “new products” module is also updated.

The cost of this template? Just £16 (approx $25), and you could even get it for free by purchasing the “design oscommerce” ebook. If you would like to see my other templates I’ve recently built head over to choices page.