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!

