Changing the layout of Zen Cart’s featured products, specials, new products, and upcoming products.
Zen Cart is a wonderful open source e-commerce shopping cart system that we’ve been using for many of our customers who wish to sell items on the internet. Recently we made some customizations of a particular section of Zen Cart, which in turn has generated some people contacting me to share this information. So here it is. This article does assume you know how to program in php and how to make SQL queries.
First, make a folder in the modules folder that is the same name as your template folder. Something like includes/modules/myTemplateName/. Once that’s done copy the files featured_products.php, new_products.php and specials_index.php to the new folder you created in the modules folder.
Featured_products.php, new_products.php, and specials_index.php are just about the same, with the exception of line numbers and some commands, which means if I show you how to do one, you should be able to do the others. Using your favorite php/html editor, open featured_products.php for editng. The first thing we need to do is to add to the query the field that holds the products description. Looking at the query, all we have to do is add “,pd.products_description” to the end of line 15 and line 21. That will pull the description out of the database with the other product info.
Lines 51-54 control what is generated for each product.
Line 51 makes the display price for the product and holds it in the variable $product_price.
Line 53 starts an array that holds the information on creating a new div block for each item in the list. The array $list_box_contents holds 2 pieces of information, “params” defines the class of the div block, and “text” holds what goes in the box.
Line 54 was so long that I decided to break it down to something a bit more readable.
At line 52 I put in some extra blank lines and starting caching some of the product information into some variables. And put in these lines.
Read Full Post