Archive for June, 2008

How to Remove the “Specials” Link on the Site Map if There are no Specials

Monday, June 30th, 2008

You may have noticed that the default Zen Cart Site Map file contains a link to the “Specials” page whether or not your store has any current specials. To make this link appear only if you have current Specials, first we create a SQL query, then we reference the query to see if there are specaials, if so create the link.

First the usual drill…. Always make back ups of your files and always upload any changed files to your custom template directory.

Download tpl_site_map_default.php from includes/templates/template_default/templates directory.

Find:

<li><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_SPECIALS) . ‘”>’ . PAGE_SPECIALS . ‘</a>’; ?></li>

Replace with:

<?php

$specials_index_query = “select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id

from (” . TABLE_PRODUCTS . ” p

left join ” . TABLE_SPECIALS . ” s on p.products_id = s.products_id

left join ” . TABLE_PRODUCTS_DESCRIPTION . ” pd on p.products_id = pd.products_id )

where p.products_id = s.products_id

and p.products_id = pd.products_id

and p.products_status = ‘1′ and s.status = ‘1′

and pd.language_id = ‘” . (int)$_SESSION['languages_id'] . “‘

and p.products_id in (” . $list_of_products . “)”;

if ($specials_index_query > 0) { ?>

<li><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_SPECIALS) . ‘”>’ . PAGE_SPECIALS . ‘</a>’; ?></li>

<?php } ?>

Upload the modified file to: includes/templates/YOUR_TEMPLATE/templates directory.

Now check your site map, if you have no specials there will be no Special link.

Welcome to my blog, Zen Cart Tips!

Monday, June 23rd, 2008

As this is my first post, I don’t really expect anyone is reading this post…. they say the average blog has exactly one reader. Here’s hoping that number will increase shortly for this blog.

I will start with an easy, zen cart for dummies type of tip:

Question: How do I include a “Site Map” link in the footer of my site?

Answer:

  1. In your Zen Cart admin, go to Tools –> EZ-Pages
  2. Click on New File
  3. In the Page Title field, enter “Site Map”
  4. In the “Footer” section, select “yes” and include a number greater than zero. The page will appear in numerical order, so if you want your site map link to always be the last, enter a very large number.
  5. Scroll to the bottom of the page, and in the “Internal Link URL:” field enter, index.php?main_page=site_map
  6. Click Update
  7. Go the the front end of your site, and see the “Site Map” link in the footer.

That’s it for today, make sure you check back soon. Many more posts will be added with zen cart tips you won’t find anywhere else, I promise!