(Ex)Freelancer Frank

60 semicolons a minute

Posted on No Responses

Zen Cart: List all products by default

There are many sites out there that just need a small shop attached, nothing fancy, maybe listing a few products and adding or deleting one or two in the year. Most e-commerce solutions are overkill for this kind of site. Zen Cart is the best I have found so far. Magento, though popular, has some serious drawbacks, such as not running locally out of the box and upload crashes.

Zen Cart, in common with almost most e-commerce sites, has one drawback when it comes to deployment as a small scale shopping app. It defaults to a complex bells and whistles front page rather than a simple product list. A simple product list, however, is what most users would want to see if they are clicking a ‘buy’ option from within a larger containing site that has already done the job of explaining features and attracting custom. The Zen Cart admin does not have a quick and easy way to default to a product list, apparently because that would make it cumbersome for users should there be a long lists of products in the store. This is true but irrelevant when it comes to the small scale shop, with only a few products, which is the ideal candidate for defaulting this way in the first place. It’s possible to mess about with item categories, and so on, but this wastes time when Zen Cart already has a perfectly good menu option for listing all products as standard. The only requirement, therefore, is to switch the default opener from the usual to this list.

Preamble over, here’s the hack. Top of the index page – add this:

if (!(isset($_GET['main_page']))){

This is a quick and easy fix. The drawback is that you won’t be able to access the original page, if needed. But, again, on the type of site I am talking about, this won’t be a problem.

Incidentally, if you want to change the list ordering, add this one…

if (!(isset($_GET['disp_order']))){

There’s a range of ordering variables, somewhere. If I get the chance to look it up I’ll add it here.

Leave a Response
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>