Jump to content

Tag Block - all tags in the same font size and I don't want them to be


Recommended Posts

You can try and re-upload the blocktags.css file for the theme that you use, and see if that works. If you have the unzipped theme files on your local computer browse to /css/modules/blocktags/blocktags.css and upload the file to the root PrestaShop directory on your hosting account in the corresponding location (e.g. /themes/name_of_theme/css/modules/blocktags), overwritting the old file.

 

Clear the browser cache, and any other cache that you might have enabled, and reload the site to see whether that works.

 

If you have made any custom changes to the code of the old blocktags.css file, they will be overwritten by the new one.

 

Hope this helps.

Link to comment
Share on other sites

I had the same problem. I've just made some corrections to the module. It seems to me that it doesn't work for tags with more than 3 occurences (!!!)

 

define('BLOCKTAGS_MAX_LEVEL', 3);

in bloctags.php

 

I didn't find anything in Prestashop issue tracker though...

 

in blocktags.php, I modified hookLeftColumn() function.

 

the folowing 2 lines in the function

function hookLeftColumn($params){
 global $smarty;
 ...	
 foreach ($tags AS &$tag)
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
 ...
}

 

are replaced by:

 


$maxTimes=0;	
foreach ($tags AS &$tag)
{
	if((int)$tag['times'] > $maxTimes)
	{
		$maxTimes= (int)$tag['times'];
	}
}
foreach ($tags AS &$tag)
{
	$classLvl= ceil( (int)$tag['times'] / $maxTimes *  BLOCKTAGS_MAX_LEVEL );			
	$tag['class'] = 'tag_level'.($classLvl);
}

 

 

You should have in your blocktags.css something like:

 

a.tag_level0 { font-size: 0.9em; color: #888 !important }
a.tag_level1 { font-size: 1em; color: #666 !important }
a.tag_level2 { font-size: 1.4em }
a.tag_level3 { font-size: 1.8em; font-weight: bold }

 

(don't forget to hook the module to the "Header of pages" hook)

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for your reply arvprod, and sorry for being late in getting back to you - I was on holiday.

 

A couple of questions:

 

1. Do I change anything to

define('BLOCKTAGS_MAX_LEVEL', 3);

 

2. You mention replacing certain lines, for me it looks slightly different. Do I replace this entire piece?

 

function hookLeftColumn($params)

{

global $smarty;

$tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR')));

if (!sizeof($tags))

return false;

foreach ($tags AS &$tag)

$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);

$smarty->assign('tags', $tags);

 

return $this->display(__FILE__, 'blocktags.tpl');

}

 

3. How do I "hook the module to the "Header of pages" hook"? I have no idea what that means.

 

Thanks for your help!

 

Michelle

Link to comment
Share on other sites

  • 4 weeks later...

Okay, it took a while but the following fix from avprod worked:

 

replace

 

 

foreach ($tags AS &$tag)

$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);

...

 

 

 

by

 

$maxTimes=0;

foreach ($tags AS &$tag)

{

if((int)$tag['times'] > $maxTimes)

{

$maxTimes= (int)$tag['times'];

}

}

foreach ($tags AS &$tag)

{

$classLvl= ceil( (int)$tag['times'] / $maxTimes * BLOCKTAGS_MAX_LEVEL );

$tag['class'] = 'tag_level'.($classLvl);

}

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...