Jump to content

 

m-space

Member Since 02 Jan 2010
Offline Last Active Dec 20 2011 09:15 PM
-----

Topics I've Started

Form Main Menu from Categories - Without using Top Menu

25 November 2011 - 12:40 PM

Hi All,

I had been working with CS-Cart's tech support but they have now told me its too much to cover under TS! Brilliant... however the code is somewhat working but just needs a little extra 'pizzaz'

In controllers/customer/ init.php I have:

// Added to Allow Top Menu Categories to be displayed as Main Menu
@list($top_menu_categories, ) = fn_get_categories();

//This is the line that needs extra development - I think...
//$top_menu_categories = fn_top_menu_form( fn_get_static_data_section('A', true) );

$top_menu_categories = fn_top_menu_select( $top_menu_categories, $controller, $mode, Registry::get('current_url') );
$view->assign('top_menu_categories', $top_menu_categories);

And then in my_changes I have:

	{assign var="foreach_name" value="cats_$cid"}
		<ul id="main-menu">
		{foreach from=$top_menu_categories item="category" name=$foreach_name }
			<li class = "{if $smarty.foreach.$foreach_name.first}first {/if}{if $category.selected == true }cm-active{/if}"><a href="{"categories.view?category_id=`$category.category_id`"|fn_url}">{$category.category}</a></li>
		{/foreach}
		</ul>

That runs as expected and produces an unordered list of the top level categories in the site for navigation, however and this is the part where tech support bailed on me - it currently does not highlight the currently viewed page - the cm-active class is missing - {if $category.selected == true }cm-active{/if} .selected does not exist in the returned data because the menu is not being parsed by either

fn_top_menu_form or fn_top_menu_select

I have tried ( see the commented out line in the first code section ) to parse the data through fn_top_menu_form and then fn_top_menu_select but it does nothing or at worst returns no menu items...

Can anyone help with getting this working? Personally I am amazed with Tech Support only offering half an answer and two that this is not an option in the main system!

I look forward to any help resolving this...

MM