Creating a Zen Cart Template
![]() | Zen Cart: E-commerce Application Development author: Suhreed Sarkar asin: 1847191177 |
Creating a new template for Zen Cart is fun. Prior to version 1.3.x of Zen Cart, some HTML tables were used for layout. But in version 1.3.x onwards, Zen Cart has fully abandoned the use of HTML tables for layout, using a CSS-based layout instead.
Creating A File System
Let us start building a new template for Zen Cart by creating a new folder under includes/templates/. Let us name it Packt (or whatever you like). But remember to use underscore instead of spaces in a long name. Avoid using Book Shop. Instead, use book_shop or BookShop.
Under the packt template folder, create the following folders:
- images: this folder will contain all the images needed for the template.
- css: this folder will contain all the CSS files for the template. It's better to copy all the files from the includes/templates/template_default/css directory to this css folder.
- common': this folder will contain the common files for the template. You may copy the files from the includes/templates/template_default/common folder, and edit those to suit your needs.
- sideboxes: this folder will contain module-specific sideboxes. Here, you can add new sideboxes, which you are going to use.
- templates: this folder contains page-specific templates. Whenever you want to change a page's layout, copy the template for that page to this directory and modify it as required.
Information regarding a template is located in the template_info.php file. You need to create a new template_info.php file for the new template. Copy the file called includes/templates/template_default/template_info.php into the new template folder, and then open the template_info.php file in your favorite text editor.
Change the text between each set of single quotes to suit your new template.
<?php
$template_name = 'Packt Publishing';
$template_version = 'Version 1.0';
$template_author = 'Suhreed Sarkar';
$template_description = 'This template is designed for Packt Publishing';
$template_screenshot = '';
?> Remember to keep the single quotes. Your template name does not need to be identical to your folder name, and you can use spaces to make it read well, but it is best to keep them similar. Leave the space between the quotes for the template screenshot field empty for now, as you don't have one yet.
When you've finished, your new file structure should appear as follows:

Open your Admin panel and navigate to Tools | Template Selection. Click the Edit button, then choose Packt Publishing from the drop-down menu and click the Update button. Now, navigate to Tools | Layout boxes controller, and click the Reset button at the bottom of the page.
Your new template is now enabled and ready to be customized.
Using Overrides
When building a new template for Zen Cart, you can use its powerful overriding feature. Overriding means using some template as the base and extending it by adding different properties through separate templates. For example, you may want to make some modifications to the default template, template_default. You could modify the files in the template_default directory to do this. But due to its overriding character, you can add the changes in the new template, say packt, which will apply the changes to the shop.
In fact, you can override any file in the path includes/templates/ template_default. Files in this directory generally determine the layout and the HTML formatting of your web pages. By default, Zen Cart has two standard templates: template_default and classic, both of which are located in the includes/templates/ folder.
Out of these two standard templates, only template_default contains a full set of files. Every other template contains only the files that differ from template_default. If your template does not contain a particular file, Zen Cart will pull that file from template_default.
Graphics
You need to add your templates graphics to the appropriate folders. The header image, logo, background image, background image for sidebox headings, and so on should be placed in the images directory under your template directory. If you want to change the buttons and icons, create the graphic files in the GIF, JPG or PNG format and put them in the /includes/templates/template_name/buttons/language_name folder. Then, update the button_names.php file to define the button image file name, and the ALT texts for those images.
Sideboxes
You do not need to copy existing sideboxes from the template_default directory, as these will automatically be displayed. If you are planning to develop a new sidebox, put the template for that sidebox in the sideboxes folder under your template directory.
A sidebox consists of three files, which are located in the includes directory:
- modules/sideboxes/template_name/name_of_sidebox.php
- languages/english/extra_definitions/template_name/ name_of_sidebox_defines.php
- templates/template_name/sideboxes/tpl_name_of_sidebox.php
You need to replace template_name and name_of_sidebox with you template name and the sidebox name respectively. For example, let us build a sidebox named my_sidebox. Then, my_sidebox.php file will read like this:
<?php
$show_my_sidebox = true;
if ($show_my_sidebox == true){
require($template->get_template_dir('tpl_my_sidebox.php', DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_my_sidebox.php');
$title = BOX_HEADING_MY_SIDEBOX;
$left_corner = false;
$right_corner = false;
$right_arrow = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' .
$column_box_default);
}
?> This page actually defines what is to be shown in that sidebox. Note that this page also includes the corresponding template file. Here, we have used a constant BOX_HEADING_MY_SIDEBOX. You need to define this in the includes/languages/english/extra_definitions/packt/my_sidebox_defines.php file. This file will look like this:
<?php
define('BOX_HEADING_MY_SIDEBOX', 'My Sidebox');
?> Now, you have to build its template file includes/templates/packt/sideboxes/tpl_my_sidebox.php, which will read as:
<?php
$content = "This is my first Sidebox. I have created it in 5 minutes. Although it is not of practical use yet, I hope I can eventually build a good sidebox.";
?> If you have created these files for the packt template, you can try it by going to Tools | Layout Boxes Controller in the administration panel. From here, turn the sidebox ON and set it up to display in the left or the right side column. This sidebox will look like the following figure.
![]()
Stylesheets
All stylesheets for your new template should be placed in the /includes/templates/template_name/css folder. You should follow stylesheet naming conventions. It is a good idea to copy an old stylesheet and then modify it to suit your needs. You can have multiple stylesheets for your shop you can even add a stylesheet for each page.
As a design rule, try to keep the declarations minimal, simple, and self explanatory. Try to restrain yourself from changing the class and ID names in the core files.
Creating and Modifying Email Templates
As a store owner, you need to send several mails to your existing and potential customers. All these emails use some templates that reside in the /email folder under the Zen Cart installation directory. To change these emails to your style, you may edit these templates.
The email's structure is determined in one of two ways. If you are sending plain text emails, the email structure is determined by the way you put together the various items (customer greeting, order number, link to detailed invoice, and so on) in a string variable that is then passed to the zen_mail() function. If you are sending HTML emails, the structure is determined by the template you use.
Text Email Template
You can rearrange, add, or delete items in a plain text email. To do so, you will need to edit the Zen Cart files where the email is created. For example, if you want to edit the order confirmation email, you will need to edit the file includes/classes/order.php.
In your example, open up includes/classes/order.php and scroll down to the bottom of the file, in the function send_order_email(). There, you will see the lines that construct the plain text email message:
<?php
/* Line 827 */
$email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' .
$this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' .
strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO,
'order_id=' . $zf_insert_id, 'SSL'
/* Line 848 */
$email_order .= zen_db_output($this->info['comments']) . "\n\n";
/* Line 855 */
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
EMAIL_SEPARATOR . "\n" .
$this->products_ordered .
EMAIL_SEPARATOR . "\n";
?>In this file, the variable that holds the plain text email message is called $email_order. It generally has a different name in each file, such as $email or $email_text. Whatever its name, this is the place where you will make your changes. You can add, delete, and rearrange the order of the items to suit your wishes.
HTML Email Templates
HTML Email templates have two parts: embedded CSS and HTML codes. You may be surprised to see the embedded stylesheet in each mail template and may want to know why linked stylesheets have not been used. One reason for not using the linked stylesheet is that you may not know how the email clients will behave. Most email clients used today can handle HTML emails and stylesheets to some extent. But there is no guarantee that every customer will have an email client that can retrieve linked stylesheets and render the emails in the desired format.
Stylesheet
The first portion of the email template is devoted to defining styles for different parts of the mail. Open the /email/email_template_welcome.html file in your favorite text editor to examine the stylesheet in an email template. The stylesheet in this template will appear as follows:
<style type="text/css">
.body {background-color:#ffffff; color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif;}
.header {font-size:10px; padding:0px; width:550px;}
.content {font-size:10px; padding:5px; width:550px;}
.content-line {padding:5px;}
.coupon-block { padding: 5px; border: 1px #cccccc solid; background-color: #FFFF99; }
.disclaimer1 a:link {color:#666666;}
.disclaimer1 a:visited {color:#666666;}
.disclaimer2 { color: #666666; padding: 5px; }
.copyright { border-bottom: 0px #9a9a9a solid; padding: 5px; }
</style> Style declarations in this stylesheet are straight-forward. First, it has defined style for the body and hyperlinks. Then, it defines the content and email related styles. Most of the style names are self-explanatory. You will find the HTML blocks with these names in the template.
HTML with variables
The main part of the email template is the HTML code with style classes and variables. The following are some of the variables used to construct content for the email:
$EMAIL_GREETING$EMAIL_WELCOME$COUPON_BLOCK$GV_BLOCK$EMAIL_MESSAGE_HTML$EMAIL_CONTACT_OWNER$EMAIL_CLOSURE$EMAIL_FOOTER_COPYRIGHT$EMAIL_DISCLAIMER$EMAIL_SPAM_DISCLAIMER$EXTRA_INFO
These variables are defined in several PHP files, such as create_account.php. Once you have found the files that need to be edited, you may want to add a definition for your new HTML item to each one. For example, you have added an item called $EMAIL_HOURS_OF_OPERATION to the email_template_order_status.html template. One of the files that you will need to edit is admin/orders.php. Find the part of that file where the email message is being constructed. In this case, it begins around line 100.
You can see that the HTML message is constructed with several statements such as:
<?php
$html_msg['EMAIL_CUSTOMERS_NAME'] = $check_status->fields['customers_name'];
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
?> All you need to do is add a new statement under all of these, to define your new item:
<?php
$html_msg['EMAIL_HOURS_OF_OPERATION'] = 'We are open from 9 AM to 5 PM every day of the week.';
?> Use a
$in front of the name of your new item in the HTML template, but do not use the$where you define it.
To change the text displayed in your emails, edit the corresponding language file. You can change an existing text, or add a new one (if you've added it to your email structure). You add or change text values using the define() statements: define(EMAIL_LOVELY_YOU_DROPPED_BY,'We are just so immeasurably delighted that you stopped by our store today!');
There is another language file you need to modify when altering text for your emails, includes/languages/english/email_extras.php. This file contains several text strings common to all emails sent from your store.
How To Setup and Use Zen Cart Video Tutorial
![]() | asin: 1931772398 binding: CD-ROM list price: $24.95 USD amazon price: $24.95 USD |
Dear Reader:
These days many companies of all size, from huge corporations to one man operations are trying to add to their bottom line by creating a significant web presence.
That only makes sense since the size of the internet has exploded and high speed internet is available to almost everyone. It has never been easier to reach a world wide market.
The problem that some companies face is the cost of creating a fully integrated shop. The cost of software can be prohibitive - especially for small business. However there is one solution that has put that obstacle to rest. That solution is Zen Cart.
Zen Cart is an all in one solution that helps you put together an on line shop - for physical products, digital products or both - and smoothly integrate with your payment processor. It truely has leveled the playing field for small business.
The only problem with Zen Cart is that it is quite complex - and I ought to know - it took me ten days to do the research and create this video series. Now you don't have to figure it out as I have done that for you. You just need to watch and learn. You will learn everything you need to know to set up your store in just a few hours - whether you are setting up a physical product store with inventory or a digital ebook store.
Here is just some of what you will learn:
How To Install Zen Cart On Your Server
How To Configure Your Site
How To Set Up Discount Coupons
How To Set Up Gift Certificates
How To Set Up a Digital Product Shop
How To Set Up a Physical Product Shop
How To Modify the Look Of Your Site
How To Create a Custom Template
How To Use the Zen Cart Over Ride File System
and so much more that the list is almost endless.
Here is a neat feature that you will appreciate if you sell digital products. Not only does Zen Cart integrate with your payment processor seemlessly - but it also has custom expiring download links. No more product theft by people passing around your download links. You will learn everything you need to know to set up your store in just a few hours - whether you are setting up a physical product store with inventory or a digital ebook store.
Zen Cart: E-commerce Application Development
![]() | author: Suhreed Sarkar asin: 1847191177 binding: Paperback list price: $49.99 USD amazon price: $38.50 USD |
DETAILED DESCRIPTION
Zen Cart is a popular open-source PHP/MySQL-based e-commerce solution available under GPL that is designed to put the merchants' and shoppers' requirements first. Not only does Zen Cart offer a very long list of features, but the system is designed with both store owners and web developers in mind. There's no sacrifice of usability or power.
This easy-to-follow book will teach you how to install, configure, and customize a Zen Cart shop and use its promotion and public-relations tools to attract customers to the shop. It will also teach you to customize the look and feel of the Zen Cart shop by localizing and customizing templates. With this excellent tutorial, you will be able to extend and tweak the Zen Cart store.
Approach
This is a highly practical book that can act as a reference material to which you will want to return again and again. The discussion in the book is right up-to-the point and it is filled with ample practical examples.
Google Releases 3D World Lively
Google just released Lively, a 3D world where you can chat with others and create your own rooms. Traces of this program appeared back in 2007 under the name of My World (this project also received the rumor nickname Google metaverse; TomHTML, Tony and I also lately saw traces of something called Google Rooms, though we aren’t 100% sure it’s related). After installing the desktop setup for Windows – yes, this is one of the rare Google products which isn’t completely browser-based – you’ll be forwarded to lively.com again. There, you can pick from a number of available rooms, and sign-in with your Google account.
Selecting a room from the Lively site
Joining a room, like this cafe
Configuring your avatar appearance (with some loading symbols in the room)
If you want to create your own room, you’ll start out with a blank setup. You can then expand a furniture selection sidebar, for instance, to drop a chair, which will be represented by a loading cone at first. Note to move objects, you need to switch on the Move icon to the right, and then drag and drop things. A quiet room like your own may also be the right setting to further customize your avatar (you’ll note that you’ll be able to browse the Lively product catalog for more apparels, like your favorite shoes) or go through your repertoire of moves; from pleading and bowing to ROFLing or dancing, or “see no evil.”
Crying on a lonely island (with Monkey Island style clouds in the background)
All in all I found Lively to be an enjoyable experience so far. Some of its features may get some time to used to and its much to early to tell how well the social features will play out, but it’s one of Google’s more ambitious and fun projects. And Second Life may just have gotten a new competitor...

নাস্তিকের মনস্তাত্ত্বিক ব্যবচ্ছেদ........................... ভুমিকা
নাস্তিকের মনস্তাত্ত্বিক ব্যবচ্ছেদ.............
নাস্তিকতাবাদ একটি মতবাদ । এই মতবাদের মূলমন্ত্র হলো, "ঈশ্বর বলতে কিছু নেই"। আর এই মতবাদের অনুসারিদেরকেই নাস্তিক বলা হ্য়।যেহেতু এক এক ধর্মে ঈশ্বরের স্বরুপ এক এক রকম, সেহেতু কোন একটি বিশেষ ধর্মের ঈশ্বরকে অস্বীকার করলেই তাকে নাস্তিক বলা যাবেনা। সেইই নাস্তিক যে কোন ধর্মের কোন ধরনের ঈশ্বরের অস্হিত্বকেই বিশ্বাস করেনা।সুতারাং নাস্তিকতাবাদকে পুরোপুরি বুঝতে হলে সব ধর্মের ঈশ্বরের স্বরুপ সম্ধন্ধে প্রাথমিক ধারনা থাকা প্রয়োজন। সেই লক্ষ্যে আমি উল্লেখযোগ্য কিছু ধর্মের ঈশ্বরের স্বরুপ সম্ধন্ধে সংক্ষিপ্ত আলোচনা করবো।হিন্দু ধর্মে ঈশ্বরের স্বরুপ :ঐতিহাসিক দিক দিয়ে হিন্দু ধর্ম পৃথিবীর সবচেয়ে প্রাচীন ধর্ম, এজন্য একে সনাতন ধর্মও বলা হয়। এই সনাতন ধর্মের ব্যাপারে হিন্দু ধর্মের বিশিষ্ট পন্ডিত ডাঃ এন.সি.বোস তার কোরআন, বাইবেল, বেদ ও বিজ্ঞান বইতে বলেছেন, "বিভিন্ন ধর্মের তুলনামূলক বইয়ের জনৈক লেখক সনাতন ধর্মের মন্তব্যে লিখিয়াছেন, ইহা একটি অবৈজ্ঞানিক ধর্ম। এই মন্তব্যে জবাবে বলা যায় সনাতন ধর্ম একটি সমুদ্র বিশেষ ইহা থেকে কোন সিদ্ধান্ত বাহির করা অত্যন্ত কঠিন " [পৃঃ ১১]হিন্দু ধর্মে ঈশ্বরের স্বরুপ ব্যাখ্যা করা সত্যি অত্যন্ত কঠিন ব্যাপার। সহজ কথায় বলা যায় হিন্দু গ্রন্থ মতে ঈশ্বর নিরাকার, এক ও অদ্বিতীয়। উনার কোন ছবি, প্রতিরুপ, মূর্তি বা প্রতিমা নেই। অজাত, অবিনশ্বর ও সর্বশক্তিমান। [যজুর্বেদ : ৩২:৩, ৪০:৮, ],[যজুর্বেদ দেবী চান্দ কর্তৃক অনুবাদকৃত পৃঃ ৩৭৭], [অথর্ববেদ: ২০ ৫৮:৩], [ঋক্বেদ: ১:১৬৪:৪৬]যদিও সাকার ঈশ্বরের উপাসনা হিন্দু গ্রন্থ মতের বিরোধী তবুও প্রায় সমস্ত হিন্দু সমাজ (ব্রাক্ষ্ম সমাজ ব্যতীত) সাকার ঈশ্বরেরই উপাসনা করে। হিন্দুরা ব্রক্ষ্মা (সৃষ্টিকর্তা), বিষ্ণু (পালনকর্তা) ও শিবা (প্রলয়কারী) এই তিন ঈশ্বরের পূজা করে থাকে। নিম্নে এদের সংক্ষিপ্ত বিবরন দেওয়া হলো,ভগবান ব্রক্ষ্মা একটি পদ্মফুলের উপর আসন পেতে বসে আছেন। তার ৪টি করে মাথা ও হাত। উনি বাহন হিসাবে রাজহাসের উপর চড়ে চলাচল করেন। স্বরস্বতী, বিদ্যার দেবী উনার অর্ধাঙ্গিনী।ভগবান বিষ্ণু একমাথা ও চার হাত বিশিষ্ট ঈশ্বর। উনার বাহন গারুদা নামক এক প্রকারের ঈগলের মত পাখি। উনি মানবজাতীর ক্রান্তিকালে যুগে যুগে মানুষরুপে অথবা জন্তুরুপে অথবা জন্তুমানবরুপে পৃথিবীতে অবতরন করেন। তিনি সর্বমোট দশবার অবতরন করবেন যার মধ্যে হিন্দু পন্ডিতদের মতে ইতোমধ্যে নয়বার অবতরন করেছেন। পরশুরাম, রামা, কৃষ্ণা, বুদ্ধা এদের সবাইকে ভগবান বিষ্ণুর অবতার মনে করা হয়। লক্ষী ভালোবাস, সৌন্দর্য্য ও আনন্দের দেবী উনার অর্ধাঙ্গিনী।ভগবান শিবা গলায় একটি বৃহৎ সাপ পেঁচিয়ে যোগাসনে বসে আছেন।উনার জটাবাধা চুল থেকে গঙ্গা নদীর উৎপত্তি বলে মনে করা হয়। নন্দী নামের একটি ষাঁড় উনার বাহন। শিব মন্দিরে ভগবান শিব থেকে শিবলিঙ্গের কদর বেশি। শিবপূজা বলতে সাধারনত শিবলিঙ্গের পূজায় বুঝায়।আপাতঃদৃষ্টিতে এই হলো হিন্দু ধর্মে ঈশ্বরের স্বরুপ।
নাস্তিকের মনস্তাত্ত্বিক ব্যবচ্ছেদ........................... ভুমিকা
নাস্তিকতাও একটি ধর্ম। আস্তিকরা বিশ্বাস করে কোনো বিশেষ ঈশ্বরে, আর নাস্তিকরা বিশ্বাস করে 'নাই' ঈশ্বরে। দুপক্ষই সমানভাবে বিশ্বাসী। আস্তিকরা যেমন ঈশ্বর আছেন প্রমাণ করতে পারেন, তেমনি পারেন নাস্তিকরা। বলা বাহুল্য, উভয় পক্ষের যুক্তিই আসলে বিশ্বাস নির্ভর। দুপক্ষের এই অর্থহীন বিতর্ক চলবেই। কাজের লোকরা এটি বাদ দিয়ে অন্য কিছু নিয়ে ব্যস্ত থাকে। কেউ যদি ঈশ্বরে বিশ্বাস করে সুখী হয় হোক না কেন? আপনি যদি 'নাই' ঈশ্বরে বিশ্বাসী হোন তাহলে আপনার বিশ্বাস নিয়েই থাকুন। অযথা সব ধর্মের ব্যবচ্ছেদ করার কী দরকার?
Review: Learning Drupal 6 Module Development
![]() | Learning Drupal 6 Module Development author: Matt Butcher asin: 1847194443 |
Drupal is one of the most popular content management systems. It is modular, extensible, customizable and powerful. Unlike Joomla!, which uses Object Oriented Programming (OOP) approach, Drupal uses fully procedural approach. Drupal’s code base is minimal and simple to understand. Like Joomla! you can develop modules (equivalent in Joomla! is called extension) to extend Drupal’s functionalities.
Drupal 6 is the latest stable release available now. One thing to remember is that there are lots of differences between Drupal 5 and Drupal 6. Drupal 7 will also be different by architecture. After releasing Drupal 6, the main problem users face is inadequacy of Drupal 6 modules. Most of the Drupal 5 modules don’t work in Drupal 6. Matt Butcher’s latest book on Drupal 6 Module Development would help others to develop more and more Drupal 6 modules.
Now let’s come to the book on Drupal 6 module development. As per the publisher – Packt Publishing - the book is targeted to ‘PHP developers who want to add features to Drupal 6.” This book should enable PHP developers to develop functional Drupal 6 modules.
The book explains well what it supposed to explain. From the very beginning it discusses Drupal’s architecture, steps necessary to develop a Drupal module, and so on. Then it starts with a simple example of developing a module. Then it discusses other details. Any PHP developer with some little knowledge about how Drupal functions can understand this example easily.
Most interesting part of the book, I think, are chapter 4 and 4, where we learn about creating content types and using Ajax and such things. It shows how we use Drupal’s JavaScript libraries, jQuery and so on. Here we also know about Database API and menu systems used by Drupal.
I am happy to learn all these from this book. Hope, others can also learn developing Drupal 6 module by reading and following the instructions in this book. However, one thing I am interested – and hoped I’ll get some hints here – is that I’ll be able to convert my old Drupal 5.x modules to Drupal 6 modules. It would be excellent if the book could show the differences of Drupal 5 and Drupal 6 modules, and showed us how to make a Drupal 5 module to work fine in Drupal 6. I think, Packt Publishing will look into this and incorporate this in future edition of the book – Learning Drupal 6 Module Development [ISBN 1847194443] by Matt Butcher.




















