Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

seperate categories in different blocks

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-10-2005, 03:02 PM
 
shirley2005 shirley2005 is offline
 

Advanced Member
  
Join Date: Jun 2005
Posts: 33
 

Default seperate categories in different blocks

I want to seperate the main categories in different blocks for better viewing.


For example, I have root categories: "flower", "chocalate"......
I also set up a root category named "Shop by occasions". There are some subcategories within "Shop by occasions", such as "anniversary", "birthday".....

I want cat & subcats of "Shop by occasions" NOT displaying in "category" box, but in a seperate box. So the final looking of the menu should like:

CATEGORIES
flowers
chocalate
........

MANUFACTURERES
.......

SHOP BY OCCASIONS
anniversary
birthday
.......



There is a mod in herehere, but not really the way I want it.

Any help?
Thanks in advance!
__________________
x-cart 4.0.14 Pro
Reply With Quote
  #2  
Old 07-11-2005, 03:14 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

a simple way to do it is to set the pos field of the categories so that anything with a value of say 500 + is for shop by occasion and anything below 500 is standard

next create a copy of the categories.tpl and then just set up a if statement to check the value of the pos field in each of them to display the right categories.

something like

Code:
{if $categories[cat_num].pos > 500}
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 07-11-2005, 09:31 AM
 
shirley2005 shirley2005 is offline
 

Advanced Member
  
Join Date: Jun 2005
Posts: 33
 

Default

I combined some code from here and here

The results almost achieve what I want, but still not exactly.

Now it looks like:

-------------------------
CATEGORIES
-------------------------

FLOWERS
CAKE
-------------------------
-------------------------
OCCASIONS
-------------------------



BIRTHDAY
LOVE
-------------------------


(click "flower" or "cake" will show its subcategories)

But for some reason, there is a blank area between "OCCASIONS" and "BIRTHDAY". And it's too close for "CAKE" and "OCCASIONS".

There is another headache. In order to achieve this, I set all the occasions as root categories, and set the first occasion's POS. as 900.
But by this way, it's too confusing for product management in backend. I'd like to setup a root categories as "Shop by Occasions" and all the occasions as subcategries. "Shop by Occasions" should appear as a seperate block instead of a category.

Any help how can I modify the code?


Below is my current categories.tpl:

Code:
{* $Id: categories.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"} {else} <TABLE cellpadding="0" cellspacing="0" width="100%" border="0"> {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories} {if $categories[cat_num].order_by eq 900} {capture name=menu} {/capture} <TR><TD valign="top" colspan="3"> { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_occasions_categories menu_content=$smarty.capture.menu } </TD> </TR> {/if} <TR> <TD valign="top"> [img]{$ImagesDir}/custom/blue_arr.gif[/img]</TD> <TD> <FONT class="CategoriesList">{$categories[cat_num].category}</FONT> {if $cat eq $categories[cat_num].categoryid || $current_category.parentid eq $categories[cat_num].categoryid} {section name=subcat loop=$allcategories} {if $allcategories[subcat].parentid eq $categories[cat_num].categoryid} {$allcategories[subcat].category} {/if} {/section} {/if} </TD> </TR> <TR> <TD colspan="2">[img]{$ImagesDir}/custom/menu_splitter.gif[/img] </TD> </TR> {/section} {else} {section name=cat_num loop=$subcategories} <TR> <TD valign="top">[img]{$ImagesDir}/custom/blue_arr.gif[/img]</TD> <TD> <FONT class="CategoriesList">{$subcategories[cat_num].category}</FONT> </TD> </TR> <TR> <TD colspan="2">[img]{$ImagesDir}/custom/menu_splitter.gif[/img] </TD> </TR> {/section} {/if} </TABLE> {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }


Thanks in advance!
__________________
x-cart 4.0.14 Pro
Reply With Quote
  #4  
Old 03-01-2008, 11:57 AM
  rkdiddy's Avatar 
rkdiddy rkdiddy is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 60
 

Default Re: seperate categories in different blocks

Ok, I'm still a little lost.

As of right now the other Category is showing up but all of the links are below Category 1 and none other 2. Plus I want a total of 3 categories.

Can someone please help????


Here is what I have for /customer/categories.tpl:

{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="fc_cellpadding" value="0"}
{else}
{if $categories[cat_num].pos < 20}
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<a href="home.php?cat={$c.categoryid}">{$c.category}< /a>
{/foreach}
{else} {foreach from=$subcategories item=c key=catid}
<a href="home.php?cat={$catid}">{$c.category}</a>
{/foreach}
{/if}
{/if}
{/if}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Print Products" menu_content=$smarty.capture.menu }

/customer/categories2.tpl:
{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="fc_cellpadding" value="0"}
{else}
{if $categories[cat_num].pos > 20}
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<a href="home.php?cat={$c.categoryid}">{$c.category}< /a>
{/foreach}
{else} {foreach from=$subcategories item=c key=catid}
<a href="home.php?cat={$catid}">{$c.category}</a>
{/foreach}
{/if}
{/if}
{/if}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Print Packages" menu_content=$smarty.capture.menu }
__________________
Stealth Cords - Discrete Power Cords for Automotive Enthusiasts
www.stealthcords.com
X-Cart version: 4.1.9
Reply With Quote
  #5  
Old 03-01-2008, 12:53 PM
  rkdiddy's Avatar 
rkdiddy rkdiddy is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 60
 

Default Re: seperate categories in different blocks

Quote:
{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="fc_cellpadding" value="0"}
{else}
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<a href="home.php?cat={$c.categoryid}">{$c.category}< /a>
{/foreach}
{else} {foreach from=$subcategories item=c key=catid}
<a href="home.php?cat={$catid}">{$c.category}</a>
{/foreach}
{/if}
{/if}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}

Here is the original code.
__________________
Stealth Cords - Discrete Power Cords for Automotive Enthusiasts
www.stealthcords.com
X-Cart version: 4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:29 PM.

   

 
X-Cart forums © 2001-2020