Be Fire Ready, If You’re In a Bushfire Prone Area

Introduction – Who Should Be Fire Ready?

This article is a little odd for my blog perhaps, but there’s a reason. Actually there’s a couple of reasons.

I went through the Victorian bushfire last year, the worst natural disaster in Australian history where 173 people died and thousands were displaced from their homes. Many of those still aren’t able to return as they’ve not yet finalised the details of their rebuild for various reasons. Some of course choose not to come back to the bushfire prone areas and have instead moved to the suburbs.

But even in the suburbs you still need a bushfire plan. The Victorian bushfires of February 2009 that tore through Kinglake, Marysville and half of the Murrindindi Shire, were accompanied by other fires on the day, including one in Narre Warren. The fire in Bendigo on the same day was in a suburban area and destroyed a number of homes, partially I’m sure because people in that area believed they were safe because they were in a suburban area.

Fire-Ready is implemented in CS-Cart

This is where the latest site that I’ve been working on for a customer, fire-ready.com.au comes in. They supply everything you need to help ensure that on the day when bushfire threatens your property and family, you’ll be ready. Fire Ready. Why am I writing about this? Well because I think the site is also a showcase CS-Cart site. It took some doing and lots of blood sweat and tears, but I believe it proves the amazing flexibility of the CS-Cart engine.

How was it done?

The site originated from the original CS-Cart skin – the basic skin. It was then stripped bare, to remove some of the display items that were not needed, and it went through a few iterations while I figured out the best way to tinker with CS-Cart. It soon became clear that one should always try to work within the CS-Cart framework, so I had to learn how to design and code my own blocks, so that these could be added and moved around as the customer required. Although some of the design elements do not lend themselves to being moved around, the CS-Cart engine is strongly oriented towards blocks and rather than hack up the skins to a degree that would make them unsupportable I chose to do these likely unmovable elements as blocks as well.

The CS-Cart knowledgebase is a very handy resource, although unfortunately it is missing a considerable amount of information. But it’s a good place to start learning how to do your own addons and blocks.

I started to write a blog article about how to write CS-Cart blocks, but its quite a complex subject and the article requires some extra editing that I’ve since learned so I will release that shortly and come back here to link to it so others can share the love. But, once you get your head around the CS-Cart architecture it’s really very nice to work with.

One principle that I will share here and now however is that one should never, ever, alter the core CS-Cart files. This is something I’ve learned from the WordPress world, and in some ways programming a CS-Cart skin is a little like working with a WordPress theme. The actual building blocks are very different – CS-Cart uses the Smarty Template System for instance, which WordPress does not – but the architectural decisions are fairly similar. So, you can create your own AddOns (which you’ll just about need to if you want to create your own blocks), which can ‘hook’ into aspects of the CS-Cart functionality using either your own pre/post controller code, or using CS-Cart hooks. Each mechanism has its own pros and cons, which I’ll also try to go into in my next CS-Cart article.

One small thing to note here, if you’re starting to look into writing your own blocks and require access in PHP code to the template variables, you may be tempted to use the Smarty method ‘get_template_vars‘. Don’t. CS-Cart overrides the Smarty object and provides a number of its own methods – most of which are very good and make life a lot easier for you. But there’s also this gotcha – when you use $view->assign, the code internally uses the PHP htmlspecialchars() function to escape any data that may be contained in your template data. However, CS-Cart rather curiously have not overridden the get_template_vars method, instead choosing to create a new method call get_var(). This means that if you use get_template_vars() to get something from the template data it will not be unescaped. If you then re-assign it after you manipulate it, it’ll be DOUBLE ESCAPED. This took me a while to find. Instead, use the CS-Cart provided get_var() function which will unescape your template object for you so that when you manipulate it and put it back it won’t be double escaped.

Anyway, that’s enough for this article for now, please do visit the fire-ready.com.au website, particularly if you’re in Australia and in a bushfire prone area because I believe the website is definitely worth a look.

CS-Cart, A Very Excellent E-Commerce Engine

I’ve been in the Web Development Business now for more years than I care to remember. In that time I’ve worked with plenty of E-Commerce engines, some of which were entirely bespoke before ‘off the shelf’ solutions such as osCommerce or Magento existed.

In more recent years I’ve been using osCommerce. I took a look at Magento but reviews of its fairly serious need for horsepower and to be honest I found it quite difficult to get around. Before any Magento fans flame me I’m quite prepared to admit that is probably much more down to me than it is to Magento. So I stuck with osCommerce. I’ve released a number of E-Commerce sites based on osCommerce and in general I had been fairly happy with it. But, it’s very old technology now – my first shop was released back in 2005, on osCommerce 2.2 and today the platform is still the same, 4.5 years later. And I’m sure I wasn’t on the bleeding edge back then. I don’t want to bash osCommerce here either – that’s not the purpose of this article. But it is my basis for comparison and as such I have to point out the shortfalls it has when compared to CS-Cart.

I took the plunge and started looking at CS-Cart. It was a brave (and potentially stupid) move because I chose to investigate it’s use for a large client site. Sometimes when taking on a large project it can be better the devil you know. In this case though, I was pleasantly surprised. It was better the devil I didn’t know.

CS-Cart is based on the Smarty Template Engine and I have good experience with Smarty, having developed the more recent parts of DearDiary.Net in Smarty, along with the original version of Kabarty Collector, plus the playing around with WHMCS (which also uses Smarty) and a couple of other smaller projects. CS-Cart is also structured into a Model – View – Controller paradigm, which with my commercial background with Java Server Faces, Struts and CodeIgniter appealed to me from the outset. Perhaps having experience in both these technologies helped me to understand CS-Cart quicker than others might was an advantage but I soon found I could get around the software quickly and easily.

CS-Cart is written in PHP using the Smarty Template Engine, and although it is commercial software (which I might add is very reasonably priced at $265US) it does come with full source code so you can find your way around it. Just like the WordPress world though it is highly recommended that you do not make any edits to the core code. Doing so will make your upgrade path much harder – and it’s just about never necessary (although I did have to for one of my customers as it was a bug in the core).

CS-Cart uses a skin architecture (made simple by the use of MVC) so you can make it look exactly how you want – and I’ve applied a pretty radical design to one of my new sites. I’ll update the URL later once it’s been made public. But you can hook in jQuery effects and just totally radically alter the way the site looks whilst not having to stress at all about how the engine works. The engine is totally seperate from the display – which is how a modern system should be designed.

The engine also supports the concept of Add-Ons which means you can plugin extra functionality. In the case of CS-Cart these are quite literally ‘plug ins’. You don’t have to get your editor out and search for line Y in file blah.php and modify this query to show Z. You place the addon into the addons directory – possibly add the addon skin additions to the skins directory, and then activate the addon in the Administration screen. You may need to configure the addon and that’s all done through the Admin screen.

CS-Cart, straight out of the box, comes with dozens of Payment Gateways, including Paypal, eWay, WestPac (sadly, no Commonwealth Bank of Australia or ANZ (yet)), noChex and too many more to mention. Along with those payment gateways, it also comes with a bunch of pre-installed Postage Handlers, including live postage rate calculations from Australia Post and others. It supports multiple taxation models for sales tax, so if you’re a multi-national you can apply VAT to British Addresses, GST to Australian addresses and whatever other sales taxes you might need, all at different taxation rates as defined by you.

CS-Cart is also very user friendly for the customer. It contains its own Content Management System which allows the customer to add additional pages that aren’t product specific (for example, Terms and Conditions, Returns Information, Privacy Policy). The user does not have to understand any PHP to do this, CS-Cart provides an editor built into the Administration Screens.

Positively THE most powerful part of CS-Cart is found in its ‘Blocks Management’. This allows a designer of the site and/or addons to create blocks of content which can be placed on certain (or all) pages and the intuitive interface allows the cart administrator to move these blocks all around to fit how they want it to look. No need to edit HTML – the administrator simply drags the block from (for example) the left sidebar over to the right sidebar, or even to the top. The blocks manager seems to be almost infinitely flexible and even allows certain blocks to be only shown on specific product or category pages.

The only strange part I’ve found to CS-Cart at this stage is the business model that CS-Cart employs when a specific add on is required. You can write to CS-Cart and request a particular addon be coded, which they will quote you a price for. If you agree, and pay the price, they will code the addon. All good there. But that addon could then appear in a later version of the CS-Cart product – even though you just paid for it to be developed. It’s not a huge deal, and I think it’s just something that will happen more in the bespoke software world.

All in all, I’ve been really very pleased with the easy way CS-Cart can be extended and the intuitive and very powerful customer administration interface that makes it a great system to deploy to customers and not have to continually go back and make changes for them.