I installed Zen Cart on a client’s machine…
- installation was a breeze
- the problem is it is very easily ideifiable as a Zen Cart… which is bad for a professional site. Everything should look home-grown
- The client has an existing site which doesn’t really fit with the Zen Cart presentation style. So I have to do a little conversion
- There is basically NO DOCUMENTATION so I’m having to look through the source code to figure out how to implement these changes
Overview for every page
As is evident from looking at the URLs of any part of the catalog, the “main” page is just index.php, regardless of what the content of the page is. For any particular page it loads, it has a default file it uses for the entire site, which may be overridden by a locally defined file.Most of these are PHP code only:
- includes/application_top.php – this location is one of the only file paths hard-coded into the PHP code. Its companion does NOT use the “includes” name directly but rather a constant define “DIR_WS_INCLUDES”
- includes/modules/pages/[PAGE_NAME]/header_php* – defines some of the product-specific queries and settings for variables defined in application_top.php. You can make other files which will get loaded too, if they start with the phrase header_php
Define Template Variables picked up from
includes/templates/[NAME OF TEMPLATE]/common/main_template_vars.phpunless a file exists in the includes/modules/pages/[PAGE_NAME]/directory to overide. Allowing different pages to have different overall templates.
…anyway, that’s how it associates the “main_page” attribute with a PHP page in one of those two locations. That content page will determine the contents between the two columns and above the “center” elements such as “new products”.
Define the template that will govern the overall page layout, can be done on a page by page basis or using a default template. The default template installed will be a standard 3 column lauout. This template also loads the page body code from a page named in the variable $body_code.(This refers to includes/templates/template_default/common/tpl_main_page.php for the entire site or
includes/templates/template_default/[PAGE_NAME]/tpl_main_page.php for a specific page )
- includes/application_bottom.php – Actually uses a constant define “DIR_WS_INCLUDES” so watch out!
- includes/languages/english/[TEMPLATE_NAME]/[PAGE_NAME] – or more generally includes/languages/[LANGUAGE]/[TEMPLATE_NAME]/[PAGE_NAME] – defines:
- the navbar and heading titles
- THE CONTENT!!! Whew! At Last! it’s stored in the variable TEXT_INFORMATION
Including the Static Pages
- In the demo store there are some mostly-static main content pages under “Information” and “More Information”. Focussing on “More Information.”
- I have a includes/languages/english/[NEW_PAGE_NAME].php . My first inclination was to assume that this is where the bulk of the information for the page should live.
- I see files for the "classic" template like languages/english/classic/[NEW_PAGE_NAME].php . I'm thinking this is for styling the same page in different formats for different template. Are these pages required? If I make a template called BLAH in includes/templates/BLAH do I absolutely need to make files for all my content pages in languages/english/BLAH/[NEW_PAGE_NAME].php ?
- how about includes/modules/pages/[NEW_PAGE_NAME]? It looks like there is only a small file, header_php.php, there. Do I absolutely need something there? what is that area for, besides putting this small file there?
- I also see a great deal of material in includes/templates/template_default/templates/tpl_[NEW_PAGE_NAME]_default.php. This looks to be the default templates for every module, and therefore every content page, so that I need not define a languages/english/BLAH/[NEW_PAGE_NAME].php for my BLAH template.
So, in summary:
- add includes/languages/english/[NEW_PAGE].php for your main content
- add includes/languages/english/[TEMPLATE]/[NEW_PAGE].php if you want your page content to be different in that particular template than the default you just defined
- add includes/templates/template_default/templates/tpl_[NEW_PAGE]_default.php for your template (not the content)
- add includes/modules/pages/[NEW_PAGE]/header_php.php, possibly for your variable settings
- The header is defined in
- Default has
- Log In/Out
- My Account
- Cart (if cart nonempty)
- Checkout (if cart nonempty)
- Logo banner
- Error Message (if any)
- Info Message (if any)
These messages are defined in
- so to get the “buy your candy today!” and countdown message we could:
- add another field to the top- might be a little busy!
- Need to add top of logo as first element on left- others can slide to right?
- Or, possibly have cart navigation etc BELOW the original banner art
- includes/modules/footer.php defines a few variables…
- …which are then displayed by
- Default footer has
- Bottom Nav Bar with “Home”
- IP address of client ?!
- whatever was defined in footer.php, in our case the copyright notice
- the END OF THE BIG TABLE !!
- Advertising banners
- the parse time
- We should probably put the bottom navigation links in here
Including the new pages:
- include/filenames.php – defined FILENAME_[NEW_PAGE_NAME] for each page
- include/languages/english.php – defined BOX_INFORMATION_[NEW_PAGE_NAME]
- include/modules/sideboxes/more_information.php – added each page to the array using both the above variables
includes/modules/sideboxes/information.php includes/modules/sideboxes/more_information.phpis by default empty- make sure you add new items AFTER the closing brace of the conditional there!
- both explicitly stack BOX_INFORMATION* variables together into an array and pass on to templates
- BOX_INFORMATION* variables defined in both
includes/templates/template_default/sideboxes/tpl_information.php– can also replace template_default with other template names includes/templates/template_default/common/tpl_box_default.php– can also replace template_default with other template names
- Must contain pages from old site:
- Custom info
- Visit us
- About the store
- to change the titles of the pages:
- categories box for Zen Cart is at
- template at
- template at
- category_row.php seems to be only for index, used by
however note that this file is only currently included in the template_default template
- can you control which pages have which boxes?
- individual boxes code is in includes/modules/sideboxes/*.php
- the side boxes use constants defined in includes/languages/[LANGUAGE].php
- the actual file which renders the boxes is ??
- if we can find out which file includes the boxes, we will know how it determines
which boxes run in a given page/template!
- under which circumstances does
Up to now our investigation has been totally speculative and non-invasive. Below we summarize all the changes and the notes:
- put all the application-specific PHP routines in a single file, and have it included at the end of application_top.php
- initially this will just define small functions which output store-specific strings
- Database accessing functions will initially output dummy text
- planned functions:
- getConnection() gets a vanilla database connection
- getSmallPromoText() generates the short text-only version of the current promotion
- makeHeaderPromo() incorporates that short text into header HTML
- getLargePromo() generates HTML for the larger version of the promotion
- getRandomSplash() returns HTML for a random product image, for use in a splash image
- copy template fileset; rename and modify color scheme and look and feel
- for example,
templates/blue_stripis the main area for “blue_strip”
- see also
- see also
- for example,
- change the header:
- integrate logo top into left side of header navigation
- add call to action to navigation header (if there’s room!)
- modify banner design to match non-ZenCart version
- change the footer:
- eliminate old content
- make bottom navigation links to major site areas
- add contact info (phone numbers) and bottom stripe
- make templates for all static content – for each new mostly-static page create:
- includes/modules/pages/[NAME OF PAGE] to define the page-specific variables… which could be a 2-line header_php.php
- includes/languages/[LANGUAGE]/[TEMPLATE NAME]/[NAME OF PAGE] which has the actual text of the center pane
- include links to static pages in “information” panel
- not sure if changing tpl_main_page.php is even necessary!
- Make a combined “categories/search” sidebox
- Make a new “promotions” sidebox :
- uses routines defined in PHP included by application_top.php, above
- links to the seasonal items, or the custom items
- possibly just hack this as a 0% sale
- If there is room, make a text-only version which says the next major holiday and
text incorporating the number of days remaining… this is to be used in the navigation header
- add images for products and categories; populate
- images should be proportioned to scale down to 100×80
- deploy store