Zen Cart Language Files and How They Are Used – Part Three

In this final portion of the guide to Zen Cart language files, and how they are used, you will learn about the last two definition types. The first of these are your own definitions. While you are customizing your zen cart, you may want, or need, to include additional definitions. This can easily be done by creating a definition file, and saving it to the includes/languages/ENGLISH/extra_definitions folder of your zen cart. The file you create should be a .php file, and should be named according to your pre-existing file name conventions to avoid confusion.

When you make your own defines, you should follow the pattern provided by this sample code from product_free_shipping.php:


define('TEXT_PRODUCT_FREE_SHIPPING_ICON', zen_image(DIR_WS_TEMPLATE_IMAGES . 'always-free-shipping.gif', 'Always Free Shipping')); // for an image or comment out to use another

The last page type is your defined pages. Included in this category is your privacy statement, your conditions of use and shipping and handling information. There are two ways to edit these files: you can make your changes in a text editor and upload the modified file to your server; or you can edit them in your admin control panel. Here is a list of the important page files kept in this folder:
define_privacy.php
define_conditions.php
define_shippinginfo.php

If you need help with your zen cart web site please contact us for a quote.

At Picaflor Azul, we specialize in custom designed responsive zen carts to fit any business, and accommodate any budget. Contact us today about converting your current zen cart to a responsive design, or to have a fantastic new custom design custom tailored to fit your needs and preferences. We can also offer you help with module installation, wordpress integration, or a full zen cart upgrade.

zen cart plus picaflor azul equals success

Zen Cart Language Files and How They Are Used – Part Two

Why use define statments?

The advantage of using define statements is that you can include your text information in your template files using a constant, like this:


<?php echo HEADING_TITLE; ?>

This method is a good alternative to “hard coding” your text, as seen here:


<?php echo 'My Page Heading'; ?>)

Examples of Use

Global Definitions

The definitions in your english.php file affect the footer text, the sidebox headings, the text used by the forms in Zen Cart®, as well as various error messages. Here is an example of the code that can be found in the english.php file:


define('FOOTER_TEXT_BODY', 'Copyright © 2003-2006 Zen Cart. Powered by Zen Cart');define('BOX_HEADING_CATEGORIES', 'Categories');
define('ENTRY_FIRST_NAME', 'First Name:');
define('ENTRY_STREET_ADDRESS_ERROR', 'Your Street Address must contain a minimum of ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' characters.');

Page Specific Definitions

Their name perfectly describes their function, as these are the definitions for text information on specific display pages in your zen cart. The information that can be changed or replaced in these files includes the text for the page heading and the text for the navbar. Depending on the page you are editing, you may also find information for e-mail messages and for other miscellanious tasks performed by a display page. The file these are found in is the conditions.php in your zen cart, and this is a sample of the code you will find there:


define('NAVBAR_TITLE', 'Conditions of Use');
define('HEADING_TITLE', 'Conditions of Use');
From header.php
define('HEADER_ALT_TEXT', 'Powered by Zen Cart :: The Art of E-Commerce');
define('HEADER_SALES_TEXT', 'TagLine Here');
define('HEADER_LOGO_WIDTH', '192px');
define('HEADER_LOGO_HEIGHT', '64px');
define('HEADER_LOGO_IMAGE', 'logo.gif');
From contact_us.php
define('ENTRY_NAME', 'Full Name:');
define('ENTRY_EMAIL', 'Email Address:');
define('ENTRY_ENQUIRY', 'Message:');

If you need help with your zen cart web site please contact us for a quote.

At Picaflor Azul, we specialize in custom designed responsive zen carts to fit any business, and accommodate any budget. Contact us today about converting your current zen cart to a responsive design today, or to have a fantastic new custom design custom tailored to fit your needs and preferences.

zen cart plus picaflor azul equals success

Add the About Us Page to the Sitemap

All of our free template packages come with the About Us page module installed. This module adds a page called “About Us” to the zen cart define pages which can be edited in the zen cart admin define pages editor. Adding the About Us page to the
your site map (and any other site pages) is important because it increases the caching and indexing of your websites’ pages.

Step One is to follow the tutorial here to add the About Us page to your Admin -> Configuration -> Define Pages Status menu. The status must be set to “1” for the page to show on your sitemap:

Easy Help Zen Cart Tutorial: How To Add About Us Page to Configuration – Define Page Status

Next, in your favorite plain text editor, open includes/templates/override-directory/templates/tpl_site_map_default.php file. If the file is not there, create an override for it by copying the includes/templates/template_default/templates/tpl_site_map_default.php to includes/templates/override-directory/templates/tpl_site_map_default.php.

At the end of the file, just before the last tag, add the following code:

 

<?php if (DEFINE_ABOUT_US_STATUS <= ‘1’) { ?>
<li><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_ABOUT_US) . ‘”>’ . BOX_INFORMATION_ABOUT_US . ‘</a>’; ?></li>
<?php } ?>

***This is a php file and MUST be edited in a plain text editor. If you try to edit this file in any type of wysiwyg editor, the code will be corrupted and when you insert the file back into your zen cart it will break your entire site.***

Save the file.

Navigate to your sitemap page and hit the “refresh” button to see the page added.

If you need help customizing your zen cart web site, or would like a great custom design, please contact us for a quote.

equation

Zen Cart Add About Us Page to Configuration – Define Page Status

All of our free template packages come with the About Us page module installed. This module adds a page called “About Us” to the zen cart define pages which can be edited in the zen cart admin define pages editor. Adding the About Us page to the admin – configuration – define page status will give you the following convenient configuration options:

  • Enable the Defined About Us Page Link/Text?
  • 0= Link ON, Define Text OFF
  • 1= Link ON, Define Text ON
  • 2= Link OFF, Define Text ON
  • 3= Link OFF, Define Text OFF

1. Log into your zen cart admin and go to Tools -> Install SQL Patches

Paste this in the box and click on the Send button:


INSERT INTO `configuration` VALUES ('', 'Define About Us Status', 'DEFINE_ABOUT_US_STATUS', '1', 'Enable the Defined About Us Link/Text?0= Link ON, Define Text OFF1= Link ON, Define Text ON2= Link OFF, Define Text ON3= Link OFF, Define Text OFF', 25, 90, '', '', NULL, 'zen_cfg_select_option(array(''0'', ''1'', ''2'', ''3''),');

Go to Admin -> Configuration -> Define Page Satus to see the About Us page in the list:

If you need help customizing your zen cart web site, or would like a great custom design, please contact us for a quote.

equation