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:


<!-- QuickMenu Structure [Menu 0] --><br />
<ul id="qm0" class="qmmc"><br />
<br />
	<li><a class="qm-startopen qmparent" href="javascript:void(0);">{$category.category}</a><br />
<br />
		<br />
        <ul><br />
        <li><a href="{$index_script}?dispatch=categories.view&category_id={$category.category_id}">{$category.category}</a></li><br />
        </ul><br />
		<br />
        <br />
    </li><br />
<br />
<li class="qmclear"> </li></ul><br />
<br />
<!-- Create Menu Settings: (Menu ID, Is Vertical, Show Timer, Hide Timer, On Click (options: 'all' * 'all-always-open' * 'main' * 'lev2'), Right to Left, Horizontal Subs, Flush Left, Flush Top) --><br />
<script type="text/javascript">qm_create(0,false,250,250,false,false,false,false,false);</script><br />
<br />
<!--[END-QM0]-->
```<br />
<br />
<br />
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: <br />
<br />
<br />
<br />
The code i tried using is:<br />
<br />
```php
{* $Id: categories_tree.tpl 7780 2009-08-04 08:59:41Z zeke $ *}<br />
<ul id="qm0" class="qmmc"><br />
{assign var="cc_id" value=$smarty.request.category_id|default:$smarty.session.current_category_id}<br />
<br />
{foreach from=$categories item=category key=cat_key name="categories"}<br />
	{if $category.level == "0"}<br />
		{if $ul_subcategories == "started"}<br />
			<br />
			{assign var="ul_subcategories" value=""}<br />
		{/if}<br />
		<br />
<br />
			<li><a class="qm-startopen qmparent" href="javascript:void(0);">{$category.category}</a><br />
		<br />
	{else}<br />
		{if $ul_subcategories != "started"}<br />
			<ul>  <br />
				{assign var="ul_subcategories" value="started"}<br />
                <br />
                <br />
		{/if}<br />
		<br />
		<li><a href="{$index_script}?dispatch=categories.view&category_id={$category.category_id}">{$category.category}</a></li><br />
       <br />
          <br />
      <br />
           </ul><br />
    <br />
	{/if}<br />
    <br />
    <br />
	{if $smarty.foreach.categories.last && $ul_subcategories == "started"}<br />
  <br />
        <br />
        <br />
        <br />
	{/if}<br />
{/foreach}<br />
</li>  <br />
<li class="qmclear"> </li></ul><br />
<br />
<!-- Create Menu Settings: (Menu ID, Is Vertical, Show Timer, Hide Timer, On Click (options: 'all' * 'all-always-open' * 'main' * 'lev2'), Right to Left, Horizontal Subs, Flush Left, Flush Top) --><br />
<script type="text/javascript">qm_create(0,false,250,250,false,false,false,false,false);</script><!--[END-QM0]-->
```<br />
<br />
<br />
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.<br />
<br />
<br />
Regards<br />
<br />
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…