<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>Comments on: Prestashop top menu: add &#8216;active&#8217; state for current page</title>
	<atom:link href="http://nemops.com/prestashop-top-menu-current-state/feed/" rel="self" type="application/rss+xml" />
	<link>http://nemops.com/prestashop-top-menu-current-state/</link>
	<description>Prestashop Tutorials, Modules and More!</description>
	<lastBuildDate>Fri, 10 Mar 2023 23:25:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.35</generator>
	<item>
		<title>By: NemoPS</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-46205</link>
		<dc:creator><![CDATA[NemoPS]]></dc:creator>
		<pubDate>Wed, 25 Nov 2015 13:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-46205</guid>
		<description><![CDATA[Actually I tested it, it worked for me]]></description>
		<content:encoded><![CDATA[<p>Actually I tested it, it worked for me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-45977</link>
		<dc:creator><![CDATA[Erik]]></dc:creator>
		<pubDate>Wed, 22 Apr 2015 09:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-45977</guid>
		<description><![CDATA[Hi Hong,
your code is working on Prestashop 1.6?
Can you tell me exactly how to implement your code please?


What are the files to modify?
Thank you
Erik]]></description>
		<content:encoded><![CDATA[<p>Hi Hong,<br />
your code is working on Prestashop 1.6?<br />
Can you tell me exactly how to implement your code please?</p>
<p>What are the files to modify?<br />
Thank you<br />
Erik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kvokul</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-45862</link>
		<dc:creator><![CDATA[Kvokul]]></dc:creator>
		<pubDate>Wed, 07 Jan 2015 20:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-45862</guid>
		<description><![CDATA[Could you say something more about &quot;Step 2&quot;? I&#039;ve absolutly no idea where is the correct place, that I should  insert Your code. As I understand, I have to change public_html/modules/blocktopmenu/blocktopmenu.php?
In line 613 I have function definition, and there is no place to set id:
&lt;code&gt;
private function getCMSCategories($recursive = false, $parent = 1, $id_lang = false)
{
$id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()-&gt;language-&gt;id;
if ($recursive === false)
{
$sql = &#039;SELECT [...]  bcp.`id_parent` = &#039;.(int)$parent;
return Db::getInstance()-&gt;executeS($sql);
}
else
{
$sql = &#039;SELECT [...] bcp.`id_parent` = &#039;.(int)$parent;
$results = Db::getInstance()-&gt;executeS($sql);
foreach ($results as $result)
{
$sub_categories = $this-&gt;getCMSCategories(true, $result[&#039;id_cms_category&#039;], (int)$id_lang);
if ($sub_categories &amp;&amp; count($sub_categories) &gt; 0)
$result[&#039;sub_categories&#039;] = $sub_categories;
$categories[] = $result;
}
return isset($categories) ? $categories : false;
}
}
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Could you say something more about &#8220;Step 2&#8243;? I&#8217;ve absolutly no idea where is the correct place, that I should  insert Your code. As I understand, I have to change public_html/modules/blocktopmenu/blocktopmenu.php?<br />
In line 613 I have function definition, and there is no place to set id:<br />
<code><br />
private function getCMSCategories($recursive = false, $parent = 1, $id_lang = false)<br />
{<br />
$id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()-&gt;language-&gt;id;<br />
if ($recursive === false)<br />
{<br />
$sql = 'SELECT [...]  bcp.`id_parent` = '.(int)$parent;<br />
return Db::getInstance()-&gt;executeS($sql);<br />
}<br />
else<br />
{<br />
$sql = 'SELECT [...] bcp.`id_parent` = '.(int)$parent;<br />
$results = Db::getInstance()-&gt;executeS($sql);<br />
foreach ($results as $result)<br />
{<br />
$sub_categories = $this-&gt;getCMSCategories(true, $result['id_cms_category'], (int)$id_lang);<br />
if ($sub_categories &amp;&amp; count($sub_categories) &gt; 0)<br />
$result['sub_categories'] = $sub_categories;<br />
$categories[] = $result;<br />
}<br />
return isset($categories) ? $categories : false;<br />
}<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Northon</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-45783</link>
		<dc:creator><![CDATA[Northon]]></dc:creator>
		<pubDate>Fri, 31 Oct 2014 09:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-45783</guid>
		<description><![CDATA[Hi. This is not working for me in Prestashop 1.6.0.9. (the lines you mentioned are missing). But there is a way how to fix this. 

I want to change color of all parent categories in top horizontal menu. Make the modifications described in tutorial on the top of the page. Now, its working on category page. Then to make it work on product page:

Step 1: edit classes/Tools.php find line 1057:
foreach ($categories as $category)

add this:&lt;code&gt;

$( &quot;#num&#039;.htmlentities($category[&#039;id_category&#039;], ENT_NOQUOTES, &#039;UTF-8&#039;).&#039;&quot; ).css(&quot;color&quot;, &quot;#00ffc2&quot;);
&lt;/code&gt;

before this line:&lt;code&gt;
&#039;.$pipe.&#039;&#039; : &#039;&#039;);&lt;/code&gt;

Step 2: edit blocktopmenu.php on line 613:
add ID for tag &quot;A&quot; like this:&lt;code&gt;
id=&quot;num&#039;.$category[&#039;id_category&#039;].&#039;&quot;
&lt;/code&gt;
Done! Now the active category is highlighted even on product. Works with multiple categories (no matter how deep they are). Please, let me know, if there is a better way to deal with this. 
]]></description>
		<content:encoded><![CDATA[<p>Hi. This is not working for me in Prestashop 1.6.0.9. (the lines you mentioned are missing). But there is a way how to fix this. </p>
<p>I want to change color of all parent categories in top horizontal menu. Make the modifications described in tutorial on the top of the page. Now, its working on category page. Then to make it work on product page:</p>
<p>Step 1: edit classes/Tools.php find line 1057:<br />
foreach ($categories as $category)</p>
<p>add this:<code></p>
<p>$( "#num'.htmlentities($category['id_category'], ENT_NOQUOTES, 'UTF-8').'" ).css("color", "#00ffc2");<br />
</code></p>
<p>before this line:<code><br />
'.$pipe.'' : '');</code></p>
<p>Step 2: edit blocktopmenu.php on line 613:<br />
add ID for tag &#8220;A&#8221; like this:<code><br />
id="num'.$category['id_category'].'"<br />
</code><br />
Done! Now the active category is highlighted even on product. Works with multiple categories (no matter how deep they are). Please, let me know, if there is a better way to deal with this. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jazz rentcar</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-45728</link>
		<dc:creator><![CDATA[jazz rentcar]]></dc:creator>
		<pubDate>Mon, 04 Aug 2014 09:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-45728</guid>
		<description><![CDATA[how to make the blocktopmenu to sidebar menu?

www.jawarentcar.com]]></description>
		<content:encoded><![CDATA[<p>how to make the blocktopmenu to sidebar menu?</p>
<p><a href="http://www.jawarentcar.com" rel="nofollow">http://www.jawarentcar.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hong tran dinh</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-45690</link>
		<dc:creator><![CDATA[hong tran dinh]]></dc:creator>
		<pubDate>Wed, 11 Jun 2014 07:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-45690</guid>
		<description><![CDATA[thank u very much.
first time ,i&#039;m was suscess in v1.5.6
but today i using v 1.6.0.6 this not working.
and this my method .


$(function() {
    var pgurl=window.location.href; 

     $(&quot;ul.sf-menu li a&quot;).each(function(){
            
          if($(this).attr(&quot;href&quot;) == pgurl &#124;&#124; $(this).attr(&quot;href&quot;) == &#039;&#039; &#124;&#124; $(this).attr(&quot;href&quot;) == pgurl+&#039;#&#039; )
         $(this).addClass(&quot;active&quot;);
     })
});


and style by my class .active (i&#039;m sorry,  english language very bad :d)]]></description>
		<content:encoded><![CDATA[<p>thank u very much.<br />
first time ,i&#8217;m was suscess in v1.5.6<br />
but today i using v 1.6.0.6 this not working.<br />
and this my method .</p>
<p>$(function() {<br />
    var pgurl=window.location.href; </p>
<p>     $(&#8220;ul.sf-menu li a&#8221;).each(function(){</p>
<p>          if($(this).attr(&#8220;href&#8221;) == pgurl || $(this).attr(&#8220;href&#8221;) == &#8221; || $(this).attr(&#8220;href&#8221;) == pgurl+&#8217;#&#8217; )<br />
         $(this).addClass(&#8220;active&#8221;);<br />
     })<br />
});</p>
<p>and style by my class .active (i&#8217;m sorry,  english language very bad :d)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sylvain</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-45428</link>
		<dc:creator><![CDATA[Sylvain]]></dc:creator>
		<pubDate>Tue, 03 Dec 2013 16:02:18 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-45428</guid>
		<description><![CDATA[It would be nice if someone could help for this too.

Very good and well done tut !

Greetings]]></description>
		<content:encoded><![CDATA[<p>It would be nice if someone could help for this too.</p>
<p>Very good and well done tut !</p>
<p>Greetings</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laura</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-44241</link>
		<dc:creator><![CDATA[Laura]]></dc:creator>
		<pubDate>Fri, 15 Nov 2013 17:28:49 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-44241</guid>
		<description><![CDATA[Is it possible that the first  = homepage also remains active with sfHoverForce class?

Thank you very much for your help.

Greetings.]]></description>
		<content:encoded><![CDATA[<p>Is it possible that the first  = homepage also remains active with sfHoverForce class?</p>
<p>Thank you very much for your help.</p>
<p>Greetings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rok</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-39507</link>
		<dc:creator><![CDATA[Rok]]></dc:creator>
		<pubDate>Thu, 31 Oct 2013 19:13:58 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-39507</guid>
		<description><![CDATA[OK I cleared my cache and server cache after whole day of coding and I get highlight on category while visiting subcategory. Only trouble that remains is highlighting participating subcategories in topmenu.]]></description>
		<content:encoded><![CDATA[<p>OK I cleared my cache and server cache after whole day of coding and I get highlight on category while visiting subcategory. Only trouble that remains is highlighting participating subcategories in topmenu.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rok</title>
		<link>http://nemops.com/prestashop-top-menu-current-state/comment-page-1/#comment-39492</link>
		<dc:creator><![CDATA[Rok]]></dc:creator>
		<pubDate>Thu, 31 Oct 2013 16:10:36 +0000</pubDate>
		<guid isPermaLink="false">http://nemops.com/?p=966#comment-39492</guid>
		<description><![CDATA[Hi!

I tried using your methods to highlight the top menu. It only works partially. I also used suggestion to modify the blocktopmenu.php file from one of the replys but my site dissappears in that case. Did I paste the extra js code correctly into the file?

&lt;code&gt;
})(jQuery);
jQuery(function(){
	jQuery(&#039;ul.sf-menu&#039;).superfish();
        $(&#039;.sfHover&#039;).addClass(&#039;sfHoverForce&#039;);
function recursiveCheck(element)
	{
		if (!element.length)
			return;
		var the_ul = element.parent();
		if (the_ul.hasClass(&#039;sf-menu&#039;))
			element.addClass(&#039;sfHoverForce&#039;);
		else recursiveCheck(the_ul.parent());
	}
	recursiveCheck($(&#039;.sfHoverForce&#039;));
});
&lt;/code&gt;

As in partially I mean that when I visit the main category, it gets properly highlighted. Subcategories do not highlight and connected upper category also remains the same.

What am I doing wrong?

You guys are awesome at this, this is the only proper post on the internet that got me in the right direction.

(Prestashop 1.5.4., test.zaluno.si)]]></description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I tried using your methods to highlight the top menu. It only works partially. I also used suggestion to modify the blocktopmenu.php file from one of the replys but my site dissappears in that case. Did I paste the extra js code correctly into the file?</p>
<p><code><br />
})(jQuery);<br />
jQuery(function(){<br />
	jQuery('ul.sf-menu').superfish();<br />
        $('.sfHover').addClass('sfHoverForce');<br />
function recursiveCheck(element)<br />
	{<br />
		if (!element.length)<br />
			return;<br />
		var the_ul = element.parent();<br />
		if (the_ul.hasClass('sf-menu'))<br />
			element.addClass('sfHoverForce');<br />
		else recursiveCheck(the_ul.parent());<br />
	}<br />
	recursiveCheck($('.sfHoverForce'));<br />
});<br />
</code></p>
<p>As in partially I mean that when I visit the main category, it gets properly highlighted. Subcategories do not highlight and connected upper category also remains the same.</p>
<p>What am I doing wrong?</p>
<p>You guys are awesome at this, this is the only proper post on the internet that got me in the right direction.</p>
<p>(Prestashop 1.5.4., test.zaluno.si)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
