Archive for July, 2008

Displaying a Category Description on a Product Page in Zen Cart

Saturday, July 26th, 2008

Zen Cart shows the category description on the product list page by default. There are times where you may want to display the category description on the product detail page. Here’s how:

1. Download and open includes/templates/template_default/templates/tpl_product_info_display.php

2. Add the code below where you would like the description to appear:

<!–show category description on product info page–>
<?php
$current_categories_description = “”;

// categories_description

$sql = “SELECT categories_description

FROM ” . TABLE_CATEGORIES_DESCRIPTION . ”

WHERE categories_id= :categoriesID

AND language_id = :languagesID”;

$sql = $db->bindVars($sql, ‘:categoriesID’, $current_category_id, ‘integer’);

$sql = $db->bindVars($sql, ‘:languagesID’, $_SESSION['languages_id'], ‘integer’);

$categories_description_lookup = $db->Execute($sql);

if ($categories_description_lookup->RecordCount() > 0) {

$current_categories_description = $categories_description_lookup->fields['categories_description'];

}
?>

<?php echo $current_categories_description; ?>
<br />
<!–end show descriptions–>

3. Save and upload the file to includes/templates/YourCustomTemplate/templates/tpl_product_info_display.php

As a tip, this can be used to add additional keyword rich text to your product pages.

Random Display of Banners in Zen Cart Banner Box

Monday, July 21st, 2008

Zen Cart’s “Banner Box All” sidebox is a great way to generate some extra income for your site by selling advertising or displaying affiliate banners. However, by default, the banners are displayed by their sort order.

I like to display the banners randomly. I’ve found that this 1. cuts down on “ad fatigue” and 2. enables you to ensure prospective clients their ads will be randomly placed and gives each advertiser and equal chance of their banners being displayed at the top.

To achieve a random order of banners in the sidebox:

1. Open includes/templates/template_default/sideboxes/tpl_banner_box_all.php and find:

$sql = “select banners_id from ” . TABLE_BANNERS . ” where status = 1 ” . $new_banner_search . $my_banner_filter . ” order by banners_sort_order”;

$banners_all = $db->Execute($sql);

2. Change to:

$sql = “select banners_id from ” . TABLE_BANNERS . ” where status = 1 ” . $new_banner_search . $my_banner_filter . ” order by RAND()”;

$banners_all = $db->Execute($sql);

3. Save and upload the file to: includes/templates/YOUR_CUSTOM_TEMPLATE/sideboxes/

Easy fix!

Two Types of Cross Sell in Zen Cart

Tuesday, July 15th, 2008

One of the things I love about Zen Cart is that it is so intuitive. Once you begin to learn the program and structure, almost anything is possible.

Recently, I had a situation where a client wanted to have regular products with the Cross Sell mod. In addition, she wanted to have a “Press” area where she could easily add press coverage to the web site. She wanted to be able to add recent press herself and then provide photos and links to the items featured in the press piece.

I knew I could do this with Zen Cart but there were a few difficulties:

  1. What would be the easiest way to add the press pieces?
  2. How to use the Cross Sell in two different ways? (on product pages, the Cross Sell would say “You May Also Like” and on the press pages, the Cross Sell needed to say “Buy the Pieces”)

After some thought, I came up with the following plan:

  1. Add a Press category to the product catalog. Limit the Product Type for the Press category to a General Document. (No need to actually purchase the Press item)
  2. Copy the Cross Sell mod (available in the Zen Cart downloads section) and change the file and database table names. This way I was able to have two different types of Cross Sell.

If you are interested in using my Second Cross Sell mod, please send me an email at info(at)zencarttips(dot)com with a link to some zen cart work you have done. I won’t be able to offer support for the mod, so please only email me if you have experience installing zen cart mods and know how to edit zen cart files.

I heart zen cart:)

Custom Meta Tags for your Zen Cart EZPages

Tuesday, July 8th, 2008

Something new I’ve found in Zen Cart version 1.3.8, you can create custom meta tags for your EZ Pages, which I’ve used with great success.

To begin, download and open includes/languages/english/meta_tags.php

Find:

define(’META_TAG_DESCRIPTION_EZPAGE_#’,”);

define(’META_TAG_KEYWORDS_EZPAGE_#’,”);

define(’META_TAG_TITLE_EZPAGE_#’, ”);

In the code above, replace # with your EZPage ID and add the tags, for example:

define(’META_TAG_DESCRIPTION_EZPAGE_1′,’Learn to add meta tags to your Zen Cart EZPages’);

define(’META_TAG_KEYWORDS_EZPAGE_1′,’meta tags for EZPages, zen cart SEO, improve SEO for zen cart’);

define(’META_TAG_TITLE_EZPAGE_1′, ‘Creating Custom Meta Tags for Zen Cart EZPages’);

Repeat the above process for each of your EZPages and upload the file to: includes/languages/english/YOUR_TEMPLATE/