Link to home
Start Free TrialLog in
Avatar of jesterbone
jesterbone

asked on

PHP scripting Prestashop theme

I have my own custom theme integrated into prestashop

You will see what I mean if you go here:
 
www.idiotcycles.com/newsite
Then select any of the 4 catalogues

Then switch between the 4 catalogues using the 4 selector icons you will notice the menus change.

My question is how can I get the active menu to follow the user throughout their shopping.  As they browse I want the menu to stay with them not disapear.  I realize I can probably do this through the url as it is done on the category.php page

http://www.idiotcycles.com/newsite/category.php?id_category=6

How can I most effectively make this happen?  Do I need to add a line of code to each of the other pages to look for the active category?  If so, what would it look like?

Code for header.tpl is attached, the only place where this is dealt with currently.

 







<body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}>
	{if !$content_only}
		<noscript><ul><li>{l s='This shop requires JavaScript to run correctly. Please activate JavaScript in your browser.'}</li></ul></noscript>
		<div id="page">

				<!--<h1 id="logo"><a href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}"><img src="{$img_ps_dir}logo.jpg" alt="{$shop_name|escape:'htmlall':'UTF-8'}" /></a></h1>-->

				<div id="header">
				
					{$HOOK_TOP}
								
				</div>
	
                {if $home neq 'yes' and $cat_id eq '2' or $parentID eq '2'}
                <div style="margin-left: -1.8px; margin-right: -1px; padding-top: 261px;">
                    <ul id="nav3">
	                    {section name=parentmenu loop=$mainmenu}
							<li class="top"><a href="category.php?id_category={$mainmenu[parentmenu].id_category}" class="top_link"><span class="down">{$mainmenu[parentmenu].name}</span></a>
						 {if $mainmenu[parentmenu].sub_menus neq "0"}
						 	{$mainmenu[parentmenu].sub_menus}
						 {/if}
						 </li>
						 {/section}
						 </ul>
					 </div>
			
			{elseif $home neq 'yes' and $cat_id eq '3' or $parentID eq '3'}
			 <div style="margin-left: -1.8px; margin-right: -1px; padding-top: 261px;">
					<ul id="nav1">
						{section name=parentmenu loop=$mainmenu}
							<li class="top"><a href="category.php?id_category={$mainmenu[parentmenu].id_category}" class="top_link"><span class="down">{$mainmenu[parentmenu].name}</span></a>
						 {if $mainmenu[parentmenu].sub_menus neq "0"}
						 	{$mainmenu[parentmenu].sub_menus}
						 {/if}
						 </li>
						 {/section}
					</ul>
		</div>
			
			{elseif $home neq 'yes' and $cat_id eq '5' or $parentID eq '5'}
			 <div style="margin-left: -1.8px; margin-right: -1px; padding-top: 260px;">
			 <ul id="nav2">
					{section name=parentmenu loop=$mainmenu}
							<li class="top"><a href="category.php?id_category={$mainmenu[parentmenu].id_category}" class="top_link"><span class="down">{$mainmenu[parentmenu].name}</span></a>
						 {if $mainmenu[parentmenu].sub_menus neq "0"}
						 	{$mainmenu[parentmenu].sub_menus}
						 {/if}
						 </li>
						 {/section}
					</ul>
					</div>
			{elseif $home neq 'yes' and $cat_id eq '6' or $parentID eq '6'}
			 <div style="margin-left: -1.8px; margin-right: -1px; padding-top: 260px;">
			 <ul id="nav4">
						{section name=parentmenu loop=$mainmenu}
							<li class="top"><a href="category.php?id_category={$mainmenu[parentmenu].id_category}" class="top_link"><span class="down">{$mainmenu[parentmenu].name}</span></a>
						 {if $mainmenu[parentmenu].sub_menus neq "0"}
						 	{$mainmenu[parentmenu].sub_menus}
						 {/if}
						 </li>
						 {/section}
						</ul>
				 </div>
			{else}
				<div><table><tr><td height="270">&nbsp;</td></tr></table></div> 
			{/if}	

			{if $home neq 'yes'}
				<!-- Left -->
				<div id="left_column" class="column">
					{$HOOK_LEFT_COLUMN}
				</div>
			{/if}

			<!-- Center -->
			<div id="center_column" {if $home eq 'yes'}style="display:none;"{/if}>
			
	{/if}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of midhungirish
midhungirish
Flag of Heard Island and McDonald Islands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial