Can you alter the main category menu?

Hi all,



I am currently evaluating CS-Cart using the 60 day trial on my local test server, however I seam to have run into a snag, I am trying to mimick my current site’s menu (accordion style menu), but I cannot get my old menu system to work, I am currently using opencube’s quick menu’s, the code is as follows:


```php






```


I tried altering the category_trees.tpl for the skin I was using, this has sort of worked but not quite, i.e. I can get it to show the list of parent categories, but when I click on them it won't drop down and show the sub cats, or recognise any are there to put the "plus" image at the end of the parent name...but if i click a link in the site and go to the sub cat, the parent opens up correctly and shows the sub cats..... :cry:



The code i tried using is:

```php {* $Id: categories_tree.tpl 7780 2009-08-04 08:59:41Z zeke $ *}

    {assign var="cc_id" value=$smarty.request.category_id|default:$smarty.session.current_category_id}

    {foreach from=$categories item=category key=cat_key name="categories"}
    {if $category.level == "0"}
    {if $ul_subcategories == "started"}

    {assign var="ul_subcategories" value=""}
    {/if}


  • {$category.category}

    {else}
    {if $ul_subcategories != "started"}


    {/if}


    {if $smarty.foreach.categories.last && $ul_subcategories == "started"}




    {/if}
    {/foreach}




```


If I can get over this problem I think i'm onto a winner to replace my jShop cart system, but I can't get this to work.


Regards

Dan

There is a free accordion menu add-on available in the forums:

[url]http://forum.cs-cart.com/showthread.php?t=11093[/url]



It may need a little work for version 2.0.12 but it would be good starting point.



Bob

[quote name=‘jobosales’]There is a free accordion menu add-on available in the forums:

[url]http://forum.cs-cart.com/showthread.php?t=11093[/url]



It may need a little work for version 2.0.12 but it would be good starting point.



Bob[/QUOTE]



I use it for 2.0.12 and it works fine.

I did it for a client like this:



/skins/YOUR_SKIN/customer/blocks/categories_emenu.tpl:

```php {* $Id: categories_emenu.tpl 6986 $ }

{
* block-description:emenu **}

{include file="views/categories/components/menu_items.tpl" items=$items separated=true submenu=false}
```

skins/*YOUR_SKIN*/customer/views/categories/components/menu_items.tpl:
```php {* $Id: menu_items.tpl $ *}
{strip}
{assign var="foreach_name" value="cats_$cid"}
{foreach from=$items item="category" name=$foreach_name}
{if $category.subcategories}
{$category.category} icon{$category.category}
    {else}
  • {/if}
    {if $category.subcategories}
    {include file="views/categories/components/menu_items.tpl" items=$category.subcategories separated=true submenu=true cid=$category.category_id}
    {/if}
    {if $category.subcategories}{else}{$category.category}{/if}
    {if $category.subcategories}
{else}{/if}
{/foreach}
{/strip} ```

add this to scripts:
```php {script src="js/accordion.js"}
```

Create file js/accordion.js and put following contents:
```php $(document).ready(function(){
$("dd:not(:first)").hide();
$("dt a").click(function(){
$("dd:visible").slideUp("slow");
$(this).parent().next().slideDown("slow");
return false;
});
}); ```

Pretty simple way to implement it, although I'm sure there are more efficient ways.

How can I get this code to display the cats in columns of 10 per column?


```php

{* $Id: menu_items.tpl 6971 2009-03-05 09:28:18Z zeke $ *}

{strip}

{assign var=“foreach_name” value=“cats_$cid”}

{foreach from=$items item=“category” name=$foreach_name}


  • {if $category.subcategories}

      {include file="views/categories/components/menu_items.tpl" items=$category.subcategories separated=true submenu=true cid=$category.category_id}

    {/if}
    {$category.category}

  • {if $separated && !$smarty.foreach.$foreach_name.last}

  • {/if}
    {/foreach}
    {/strip}
    ```

    [quote name=‘Keenan’]I did it for a client like this:



    /skins/YOUR_SKIN/customer/blocks/categories_emenu.tpl:

    ```php {* $Id: categories_emenu.tpl 6986 $ }

    {
    * block-description:emenu **}

    {include file="views/categories/components/menu_items.tpl" items=$items separated=true submenu=false}
    ```

    skins/*YOUR_SKIN*/customer/views/categories/components/menu_items.tpl:
    ```php {* $Id: menu_items.tpl $ *}
    {strip}
    {assign var="foreach_name" value="cats_$cid"}
    {foreach from=$items item="category" name=$foreach_name}
    {if $category.subcategories}
    {$category.category} icon{$category.category}
      {else}
    • {/if}
      {if $category.subcategories}
      {include file="views/categories/components/menu_items.tpl" items=$category.subcategories separated=true submenu=true cid=$category.category_id}
      {/if}
      {if $category.subcategories}{else}{$category.category}{/if}
      {if $category.subcategories}
    {else}{/if}
    {/foreach}
    {/strip} ```

    add this to scripts:
    ```php {script src="js/accordion.js"}
    ```

    Create file js/accordion.js and put following contents:
    ```php $(document).ready(function(){
    $("dd:not(:first)").hide();
    $("dt a").click(function(){
    $("dd:visible").slideUp("slow");
    $(this).parent().next().slideDown("slow");
    return false;
    });
    }); ```

    Pretty simple way to implement it, although I'm sure there are more efficient ways.[/QUOTE]

    Add this to scripts? Where is scripts?

    [COLOR="DarkRed"]add this to scripts:
    ```php {script src="js/accordion.js"}
    ```[/COLOR]

    Thanks



    I would like to redesign the title bar for the same post…