X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Catergories set-up to not display if no products in category (https://forum.x-cart.com/showthread.php?t=6623)

enge919 03-07-2004 11:39 PM

Catergories set-up to not display if no products in category
 
I have a client that is running x-cart 3.5.3 and wants to have the categories set-up so they do not display on the customer front end if there are no avail products in that particular category.

I am still very much learning (and teaching myself) programming. I think I should be able to do this with a if/else statement but dont quite know what the rest of the code should be.

Anyone give me a hand with this? This would be a nice mod to come standard with x-cart (hint, hint) :D

concepts 03-08-2004 05:21 PM

which cats? The side bar or the one in the middle which list sub cats also? Thats products.tpl

Anyway, find the code that shows the # of products inside the tpl

I am too lazy to look, maybe someone can post the code.

for example sake, lets just call it $productcount or whatever

{if $productcount eq 0}
&nbsp (if you run a table or whatever) blank
{elseif $productcount ne 0}
category name here (original section which shows the categories name)
{/if}

I am using elseif because I think there is already an else call somewhere in there already.

enge919 03-08-2004 11:48 PM

Well, here is the categories.tpl.....any specific suggestions?

Code:

{* $Id: categories.tpl,v 1.19 2003/11/11 14:02:32 svowl Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}
<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</font>

{/section}
{else} {section name=cat_num loop=$subcategories}
<font class=CategoriesList>{ $subcategories[cat_num].category_name|escape }</font>

{/section}
{/if}
{/if}


{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }


BTW
I am just looking for the side bar categories to be disabled if no products under that category/sub-category.

Come to think of it, I guess if there are no sub-categories being used just the main category in the side bar should be disabled automatically, but, if he is using sub-categories, then just that sub-category should be automatically disabled. This my be tougher that I thought :roll:


All times are GMT -8. The time now is 11:20 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.