How to Remove the “Specials” Link on the Site Map if There are no Specials
Monday, June 30th, 2008You 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.
