1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Beginners guide to Zencart programming


People, who have tried to edit the code of Zencart for the first time, naturally face difficulties to find the right place to put their patches. They end up with hardcoded links, language dependent texts, at the worst case a new database connetion to pull data from database. The same happened to me when I started working with zencart 4 yeas back. So, this is an effort to help people who have just started working with Zencart and lost in the code.

As you might have noticed, Zencart pages are accessed using the GET variable main_page; for example, http://yoursite.com/index.php?main_page=login, which is the url to login page. So whenever you want to edit a page, first check the value of main_page;. I’ll use login as the example throughout the article.

Now that we have decided which page to edit, we need to know what are the files we need to check (the most important question.). Basically lookout for 3 files first:

  1. the page module file at – ROOT_DIRECTORY/includes/modules/pages/login1/header_php.php
  2. the language file at – ROOT_DIRECTORY/includes/languages/english2/login.php
  3. and finally, the template file at – ROOT_DIRECTORY/includes/templates/YOUR_TEMPLATE3/templates/tpl_login1_default.php

1login – This is the vale of the main_page

2engish – This is the current language of the site

3YOUR_TEMPLATE – This is the name of the current template of the site, default is template_default.

  • If you need simple changes like, text change, you should not touch module or template files. Language file is the place where all the texts are defined. If you do not see the message you are looking for in the language file of the page, search it in the common language file at ROOT_DIRECTORY/includes/languages/english.php. Never write hard-coded texts in the module or template file.
  • If you need some cosmetic changes like, moving the email address and password field in the create account form to the top, you should check the template file. You do not need to work on the language or module file.
  • If you need to grab some info from database, process the data and display the result, do the following:
    • Do the logical part like, grabbing info from database and processing the data, in the page module file. After the processing is done, prepare the variables to output in the page.
    • Open the template file and find the place to echo the variables processed in page module file.

This article does not cover many other beautiful features zencart frame work allow, like overriding files, extra configuration files etc. Will try to cover these in later posts.

I always respect the framework of the system I am working with and I ask everybody to do so. This saves lots of coders time. Do not hack a code :)

Bookmark and Share

, , ,

  1. #1 by Mamun on July 17th, 2009

    As i am Beginner to Zencart programming, This article is very useful for me. thanks

  2. #2 by Imran on July 17th, 2009

    Thank you mamun. If you need any other help, let me know.

(will not be published)
Security Code:

  1. No trackbacks yet.