Jump to content

[SOLVED] Highlight the tags with differnt color or font


Recommended Posts

Add the following after line 72 of modules/blocktags/blocktags.php (in PrestaShop v1.3.1) to get the tags of the current product:

$productTags = array();
if (isset($_GET['id_product']))
{
   $productTags = Tag::getProductTags(intval($_GET['id_product']));
   $productTags = $productTags[intval($params['cookie']->id_lang)];
}
$smarty->assign('productTags', $productTags);



Then change line 7 of modules/blocktags/blocktags.tpl from:

<a href="{$base_dir}search.php?tag={$tag.name|urlencode}" title="{l s='More about' mod='blocktags'} {$tag.name|escape:html:'UTF-8'}" class="{$tag.class} {if $smarty.foreach.myLoop.last}last_item{elseif $smarty.foreach.myLoop.first}first_item{else}item{/if}">{$tag.name|escape:html:'UTF-8'}



to:

<a href="{$base_dir}search.php?tag={$tag.name|urlencode}" title="{l s='More about' mod='blocktags'} {$tag.name|escape:html:'UTF-8'}" class="{$tag.class} {if $smarty.foreach.myLoop.last}last_item{elseif $smarty.foreach.myLoop.first}first_item{else}item{/if}{if in_array($tag.name, $productTags)} bold{/if}">{$tag.name|escape:html:'UTF-8'}



This will make the current product tags bold. You can create your own highlight class in global.css and change the class from bold to highlight to use it instead.

Link to comment
Share on other sites

Use the following instead in modules/blocktags/blocktags.tpl:

{$tag.name|escape:html:'UTF-8'} 



Then add the following to your global.css:

div#tags_block_left .highlight
{
  color: red;
  font-weight: bold
}



Change red to the colour you want the current product tags to be.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...