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!

2 Replies to “Project for today 13 June 2012”

  1. Hi Gary,
    great post just what I am looking for. Where can I get this contribution (add on) from. I think I will be a regular reader of you blog now as I also found some of you other articles very interesting.
    Cheers
    Stan

  2. Hi Stan. I don’t do addons, I don’t think that would be fair to the client this was made for. I am happy to quote you for something similar (which you can then make into a contribution if you wanted to), get in touch via email; oscshops AT gmail DOT com

Leave a Reply

Your email address will not be published. Required fields are marked *