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)
-   -   category list 4.1.9 (https://forum.x-cart.com/showthread.php?t=38229)

sunny 03-11-2008 05:47 PM

category list 4.1.9
 
Hello,

I'm currently upgrading a cart from 4.0.19 to 4.1.9. The older version has a flyout menu for the categories. This is an accumulation of a couple of different codes. It uses a variation of meniu.tpl from http://forum.x-cart.com/showthread.php?t=24388&highlight=category+css+list . The code is

Code:

{* $Id: categories.tpl,v 1.23 2007/05/12 09:53:29 max 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"}
<div id="sidemenu">
<ul>
{*** level 1***}
{section name=l1_cat_num loop=$allcategories}
    {if $allcategories[l1_cat_num].parentid eq 0}
        <li><a href="home.php?cat={$allcategories[l1_cat_num].categoryid}" title="{$allcategories[l1_cat_num].category}">{$allcategories[l1_cat_num].category} 
        {*** count products***} 
        {*{if $allcategories[l1_cat_num].product_count gt 0}
            ({$allcategories[l1_cat_num].product_count}) {/if}*}
            {if $allcategories[l1_cat_num].subcategory_count gt 0}{* ╩ *} {/if}
            <!--[if IE 7]><!--></a><!--<![endif]-->
{if $allcategories[l1_cat_num].subcategory_count gt 0} {*** check if root cat has child cats ***}
{*** end level 1***}

{*** level 2***}
    <ul>
{section name=l2_cat_num loop=$allcategories}
                    {if $allcategories[l2_cat_num].parentid eq $allcategories[l1_cat_num].categoryid}
                        <li><a href="home.php?cat={$allcategories[l2_cat_num].categoryid}" title="{$allcategories[l2_cat_num].category}">{$allcategories[l2_cat_num].category}
                        {*** count products***} 
                                    {*{if $allcategories[l2_cat_num].product_count gt 0}
            ({$allcategories[l2_cat_num].product_count}) {/if}*}
                        {if $allcategories[l2_cat_num].subcategory_count gt 0}{* ╩ *}{/if}<!--[if IE 7]><!--></a><!--<![endif]-->
           
                    {if $allcategories[l2_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
                    {*** end level 2***}
   
    {*** level 3***}
        <ul>
    {section name=l3_cat_num loop=$allcategories}
                                {if $allcategories[l3_cat_num].parentid eq $allcategories[l2_cat_num].categoryid}
                                    <li><a href="home.php?cat={$allcategories[l3_cat_num].categoryid}" title="{$allcategories[l3_cat_num].category}">{$allcategories[l3_cat_num].category} {*** count products***} 
                                    {*{if $allcategories[l3_cat_num].product_count gt 0}
            ({$allcategories[l3_cat_num].product_count}) {/if}*}
                        {if $allcategories[l3_cat_num].subcategory_count gt 0}{* ╩ *}{/if}<!--[if IE 7]><!--></a><!--<![endif]-->

                                {if $allcategories[l3_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
                                {*** end level 3***}
           
            {*** level 4***}
                <ul>

{section name=l4_cat_num loop=$allcategories}
                                            {if $allcategories[l4_cat_num].parentid eq $allcategories[l3_cat_num].categoryid}
                                                <li><a href="home.php?cat={$allcategories[l4_cat_num].categoryid}" title="{$allcategories[l4_cat_num].category}">{$allcategories[l4_cat_num].category} {*** count products***} 
                                    {*{if $allcategories[l4_cat_num].product_count gt 0}
            ({$allcategories[l4_cat_num].product_count}) {/if}*}<!--[if IE 7]><!--></a><!--<![endif]-->
   
                                {/if}{/section}    </li>
                </ul>               
               
                {*** end level 4***}
               
                <!--[if lte IE 6]></a><![endif]-->
            {/if}{/if}{/section}</li>
        </ul>
     
        <!--[if lte IE 6]></a><![endif]-->
    {/if}{/if}{/section}</li>

    </ul>
        <!--[if lte IE 6]></a><![endif]-->
    {/if}{/if}{/section}</li>
</ul>
</div>
{/if}
{/if}
{/capture}
{ include file="menu_rev.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories_rev menu_content=$smarty.capture.menu }


There is enough difference in how the code calls the categories and subcategories between the two versions that this is no longer working. I have figured out how to access the main category level but cannot access the subcategories.

Any thoughts on how to change accessing the subcategories?

Any help is greatly appreciated.

Carol Davenport

Holub 03-13-2008 01:06 AM

Re: category list 4.1.9
 
Please see include/categories.php

There is some code

Code:

if (($current_area == "C" && defined("GET_ALL_CATEGORIES")) || defined('MANAGE_CATEGORIES')) {
        $_categories = func_get_categories_list($cat);
} elseif($current_area == "C") {
        $_categories = func_get_categories_list($cat, true, "current");
} else {
        $_categories = func_get_categories_list($cat, true, "all");
}


by default the variable "GET_ALL_CATEGORIES" is not defined.

I've added

Code:

define("GET_ALL_CATEGORIES","1");

and now I have list of all categories in
PHP - $all_categories
Smarty - $allcategories

sunny 03-13-2008 06:49 AM

Re: category list 4.1.9
 
Thank you, thank you, thank you!! That did the trick.

Carol Davenport

Holub 03-13-2008 06:53 AM

Re: category list 4.1.9
 
I'am very glad that I've help you!


All times are GMT -8. The time now is 01:27 AM.

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