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)
-   -   seperate categories in different blocks (https://forum.x-cart.com/showthread.php?t=15111)

shirley2005 07-10-2005 03:02 PM

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!

shan 07-11-2005 03:14 AM

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}

shirley2005 07-11-2005 09:31 AM

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!

rkdiddy 03-01-2008 11:57 AM

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 }

rkdiddy 03-01-2008 12:53 PM

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.


All times are GMT -8. The time now is 07:22 PM.

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