[-] MO : #PSCFV-3223 - Fix bug with blocktags module
This commit is contained in:
@@ -36,7 +36,7 @@ class BlockTags extends Module
|
||||
{
|
||||
$this->name = 'blocktags';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = 1.0;
|
||||
$this->version = '1.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -96,16 +96,32 @@ class BlockTags extends Module
|
||||
* @param array $params Parameters
|
||||
* @return string Content
|
||||
*
|
||||
* @todo Links on tags (dedicated page or search ?)
|
||||
*/
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
|
||||
$tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR')));
|
||||
|
||||
$max = -1;
|
||||
$min = -1;
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
if ($tag['times'] > $max)
|
||||
$max = $tag['times'];
|
||||
if ($tag['times'] < $min || $min == -1)
|
||||
$min = $tag['times'];
|
||||
}
|
||||
|
||||
if ($min == $max)
|
||||
$coef = $max;
|
||||
else
|
||||
{
|
||||
$coef = (BLOCKTAGS_MAX_LEVEL - 1) / ($max - $min);
|
||||
}
|
||||
|
||||
if (!sizeof($tags))
|
||||
return false;
|
||||
foreach ($tags AS &$tag)
|
||||
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
|
||||
$tag['class'] = 'tag_level'.(int)(($tag['times'] - $min) * $coef + 1);
|
||||
$this->smarty->assign('tags', $tags);
|
||||
|
||||
return $this->display(__FILE__, 'blocktags.tpl');
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>blocktags</name>
|
||||
<displayName><![CDATA[Tags block]]></displayName>
|
||||
<version><![CDATA[1]]></version>
|
||||
<version><![CDATA[1.1]]></version>
|
||||
<description><![CDATA[Adds a block containing a tag cloud.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
Reference in New Issue
Block a user