Delivery Time in osCommerce

The other day, I was asked about the possibility of including a time selection field in the shipping page of an osCommerce site. A typical example would be a delivery service such as a flower shop.

This is very alike my previous code for selcting a delivery date which works well. Basically, all I had to was copy that but make it “time” instead of “date”.

With some Googling, I found a nice jQuery based timepicker which i integrated into the checkout_shipping page.

So, the checkout_shipping.php after the changes;

In the admin, on the orders.php details, it looks like this;

Obviously I chose that date and time in the checkout page. Th selcted date and time also shows in the customer facing order history page(s) as well. Sweet!

As you can see I prettied up the time selector by adding a clock image. Looks pretty nice!

Password Masking osCommerce

Quite a while back, I was part of a discussion on a forum (not the osCommerce forum) about Jakob Neilsen’s ideas on password masking. You can read Mr Neilsen’s thoughts here).

My idea was that his thoughts are valid, and are based on usability. My opinion is that 90% of users don’t need to have the passwords starred out (as there is no-one with them at the time of filling in a form). Note that I do not agree with some of the bunkum that Neilsen spouts!

Anyway, fast forward 6 months and whilst searching Google for something entirely unrelated, I found this blog post. So, why not give the option of having your users password fields starred or not?

With a bit of copy and paste, I got this into osCommerce on the create_account and login page.

All rather easy, and less than 5 minutes work!

All credits to Jakob Neilsen and to a fellow Devonshire Developer John Whish.

Unique Product Models in osCommerce

Quite an interesting task to set up a method to easily allow the Shop Owner to see if a model name for a product has already been used whilst adding a new product.

This type of checking is done a lot for usernames in forums and blogs etc. With a bit of thought, it’s easy to replicate in osCommerce.

I used jQuery, linking to MySQL to interrogate the database and then return a message, and easy to see CSS changes (green if OK, red if not).

In the video I used MG200MMS as a test as this model number exists in the database. As it exists, the entry field turns red and gives an error message with a stop image;

If I then change it to something else (that doesn’t already exist), it turns green with a nice message and image;

Nice, I think!

More Image Swapping in osCommerce – mouseover

Interesting site build the other day for a client, who wanted a cleanly coded way to upload multiple images per product, then have them change on mouseover of a thumbnail.

To enable this, I had to change the admin/categories.php file to alow an extra 7 images in addition to the existing one. That was painless as it’s just a matter of copying code and renaming the product variable for each.

Obviously this also means I have to add extra rows in the database table “products” to hold the 7 extra images.

Once a new product has been made, the product page then looks like this:

Note that these products are all available from osc books and I used them in this example as the thumbs and larger images are already created (hence saving me the effort of making multiple images for this blog post!).

As you can see, I laid out the 4 thumbnails in a 2 x 2 formation and the larger image is on the right. When I mouseover any of those thumbnails, the larger image changes automatically…here’s a video;

You might also notice that I prettied up the mouseover cursor by using a .png file (I think this does not work in IE unfortunately). But it looks great in better browsers! A simple piece of .css does this, you can search google for “custom cursor using css” for more info on that.

Not bad, and this is all controlled by just a simple line of javascript in jQuery like this:

$("#images").html('');

As I mentioned, this client wanted something cleanly coded – there are many contributions for osCommerce which have multiple images, and no doubt there are some which can do mouseover based swapping – have a hunt for them and post back to this thread. Let’s see if we can get an images resources going here!

Two prices per product in osCommerce

Had an interesting puzzle presented to me the other day. Basically an osCommerce store owner wanted to have two prices of products. In other words;

– the standard price
– a “friends and family” price (% reduction)

My idea was to simply use a Coupon Code to get the % reduction, then amend the display_price to show both the standard price AND the reduced price.

Pleased to say that within an hour of thinking about it, I was able to come up with a workable solution…based on my version 5.5 Coupon Code system.

So, an installation of v5.5 coupon code was the first step. This allows the store owner to set up coupons for % off, money off or free shipping. It also gives the ability for the buyer to insert the coupon code BEFORE the checkout process (I think mine is the only Coupon Code system that does this), which of course means that the buyer can browse the store with the Coupon Session present [before accessing the checkout].

We can now determine if a coupon code is present and amend the display of all prices appropriately;

if (tep_session_is_registered('coupon_code')) {
$price_shown .= '
Friends and Family Price: ' . $this->format($this->calculate_price($products_price - ($products_price * ($_SESSION['coupon_amount'] / 100)), $products_tax, $quantity)) . '';
}

and to make it look pretty (stylesheet.css);

.FF {
background: yellow;
}

Very straightforward way to give two prices of products. Can be made more complicated by installing other things such as QPBPP (Quantity Price Breaks Per Product) or SPPC (Seperate Pricing Per Customer), but my way is an installation of a fairly simple coupon system and an extra couple of lines of code to deal with showing two prices. Easy!

More new goodies in RC3 osCommerce

Looking at the up-to-date version of RC3, and I spy more new things;

Ability to change the admin directory name as part of the installation procedure:

We’ve all seen the recent eval problem that has been doing the rounds. Changing the admin directory to a completely random name is a great way to help guard against this. Would be nice to have a “make random name” button here. I might code that up later.

Admin access attempts are now part of the new Action Recorder feature:

and

I previously blogged about the Action Recorder here. You can see that we can now set the number of access attempts and number of minutes between login attempts.

Warning about configure file being writable is now also in the Admin Area:

This should help to make users more aware of what they need to do “next”!!

File manager has now gone:

We all know that the File Manager was a risk, not only because of the recent round of hacks but also because it broke files when saving them. Removing this is a great move.

There’s more stuff, which I’ll blog about again later.

Open Source is all about choice

Josh commented;

First, thank you for the original 1.12 contribution [of discount coupons]. It is a very simple, and very easy to follow install. I have been reading for hours all over your site, mostly about the contribution, but I tend to go off on tangents when I see other topics of interest (like the trademark issue).

Anywa, like I said, I’ve been reading about your contribution all day, mostly on your site. What I don’t understand is your attitude (please don’t take offense, it’s the only word I could think of) towards sharing your code. I consider myself an intermediate php programmer, with intermediate oscommerce skills and knowledge (far from advanced on both accounts), so I don’t understand why you keep telling people “I have new great code, and you can buy it, but only if you give me access to your installation and let me install it myself, I will not let anyone else install it.”

The only thing I can think of is that it’s a support issue and you don’t want to answer the hundreds of questions that are bound to follow when you give someone the code and let them try to install it. But I’m with Tai Kahn when I say that I would not want you (or anyone else) installing anything into any of my websites. You made a (what I took as, sarcastic) comment to him (above) saying “when you are ready to start trusting, come back”, but I think that’s a poor attitude for someone who keeps mentioning “paying projects” in many of their blogs (and comments).

If someone like Tai or myself were willing to pay you the same rate that you’re charging to do the install, for simply emailing us the code, why would you scoff at that? Why can’t you simply make the sale with the simple condition that you will not offer any help installing it? I’m sure if the new contribution is as easy to install as v1.12, you wouldn’t hear any more than “thanks” from people who are confident that they can install it themselves.

Now, instead of just buying your code, I’m going to have to take hours to modify v1.12 code to do what you’ve already written. If this was an issue of money, I could understand, but it doesn’t seem to be, so I really don’t understand your point of view. Can you please explain it to me (and everyone else who reads this? In fact, I think this would actually be worthy of getting it’s own blog topic. I’m sure you have many readers who don’t read every blog and all of their comments, so making this a new blog topic would make it visible to everyone.

Again, thank you for the original contribution that you were actually willing to share.

Josh, no offence taken, and I hope you will not take offence at my answer and understand my viewpoint…

Open Source is all about choice. I’ts my choice to relese code in any way I see fit. As you already know the v1.2 is a very simple install – yet I get between 5 and 10 support requests daily…if I go on to release a codebase that is 5 times bigger and harder to install, how many support requests might I get? 20 per day, 30? It’s not viable for me to even look at so many emails…

So, that brings me to YOUR choices. You choose to disallow me access to your shop admin, and that’s OK! Your choice therefore is to use a different discount system, or to use the v1.2 as you already are and update it – that’s great – would be better if, after you update it, you then contribute it back to the community and support it.

You may have noticed that my contribution total stands at around 40 to 50 – guess how many people have actually emailed me over the past 10 years to say “hey thanks for contribution XYZ, it really helped me”. You could count the number on the fingers of 1 hand. But that’s unimportant and is a side-issue. Many more people have thanked me for taking the time to install and support after payment!

As you rightly say, it’s not about the money – $50 doesn’t come close to covering my time to install and support, but it sorts out the people who are serious about their business, compared to those who are not.

So, my choice is to release this only with installation.
And your choice is to accept that, or not.

It seems a fair and equitable way to make the vast majority of people realise that Open Source does not mean Free.

Image Swapping based on attributes in osCommerce

I was tasked by a customer to create some sort of image swapping device for a tshirt store. With some thought my idea was to use a piece of javascript based on the attribute selection which updates the image.

Then my customer decided he only wanted to upload 1 image rather than multiple images.

In the end I decided to do it in a different way, using only 1 image, can you guess how? Here’s a video;