Archive for November, 2008

How to Display a “Low Stock” Alert on Zen Cart Product Pages

Tuesday, November 25th, 2008

To create a sense of urgency and let customers know a product has only one item left in stock, a simple SQL query is needed in the tpl_product_info_display.php file.

1. First, you must be tracking stock of your products through Zen Cart.

2. Download, includes/template/Your_Templates/tpl_product_info_display.php and open the file.

Copy this code:

<!-- bof limited supply -->
<?php

$limitedSupply_query = "SELECT products_quantity, products_id
FROM " . TABLE_PRODUCTS . "
WHERE products_id = '" . (int)$_GET['products_id'] . "' ";

$limitedSupply = $db->Execute($limitedSupply_query);

if ($limitedSupply->fields['products_quantity'] == 1)  {
echo '<div id="limited">Only one left</div>';
}
?>
<!-- eof limited supply -->

3. Paste the code in the file where you would like the alert message to appear, I usually put it just above the Add to Cart button. Upload the edited file to includes/templates/Your_Template/

4. Download your stylesheet and create and define #limited. Upload the edited stylesheet to includes/templates/Your_Template/css/

5. Find a product on your web site that has only one product. Make any needed changes to the stylesheet.

Moving the Nav Cat Tabs to Help Zen Cart SEO

Sunday, November 23rd, 2008

If you have a web site that uses drop menus for the navigation system, you may find that the indexing of your web site has a bit to be desired. Recently, on a web site using the drop menu system, I took advantage of using a second navigation menu at the bottom of the site by moving the nav cat tabs to the tpl_footer.php file.

To make the switch, open:

includes/templates/Your_Template/common/tpl_header.php and look for:

<!–bof-optional categories tabs navigation display–>

<?php get_template_dir(’tpl_modules_categories_tabs.php’,DIR_WS_TEMPLATE, $current_page_base,’templates’). ‘/tpl_modules_categories_tabs.php’); ?>

<!–eof-optional categories tabs navigation display–>

Copy the code, delete it and open:
includes/templates/Your_Template/common/tpl_footer.php

Paste your copied code into the footer file in the appropriate postition.

Upload both of the edited files and turn on your Nav Cat Tabs in the Zen Cart admin by going to:

Configuration -> Layout Settings -> Categories-Tabs Menu ON/OFF and turn the Nav Cat Tabs on.

Go to your web site and see your category links in the footer of each page. Now search engines have easy to read text links for your categories.

Understanding Your Zen Cart meta_tags.php Language File

Saturday, November 8th, 2008

In a previous post, I discussed how to add custom meta tags for your products and categories, Read Post.

Recently, when adding custom meta tags for products I noticed that the custom tags I entered at the product level were followed by the custom tags I had set in the meta_tags.php language file and this created a VERY long list of keywords. As you know, google and other search engines will penalize you for keyword spam if you have too many keywords.

To show only the keywords you set at the product or category level, download the file:
includes/languages/english/meta_tags.php

OR
includes/languages/english/YOUR_CUSTOM_TEMPLATE/meta_tags.php (if the file has already been modified)

Open the file and remove all keywords in the following define:
// Custom Keywords
define(’CUSTOM_KEYWORDS’, ”);

Upload the file to: includes/languages/english/YOUR_CUSTOM_TEMPLATE/

Now, any products or categories that have meta tags defined in the admin section of your web site will use ONLY those tag definitions and you will no longer be keyword spamming.