Jump to content

Recommended Posts

Bonjour à tous,

 

je suis en V1.5.5.0.

 

j'ai un module affichant des tags dans le FOOTER et le block recherche en TOP.

par le block recherche pas de problème tous les produits d'un tag sont trouvés et affichés.

par la recherche par tag en footer, le Nb de produits trouvé est bon mais il n'y à aucun affichage (a part un cadre VIDE de produit et plus rien... par contre le Nb de produits trouvé est bon et affiché...

comme on le vois sur la pièce jointe la pagination est bonne également;

 

seul les liens et url des images restent vide...

je joins le php :

if (!defined('_PS_VERSION_'))
exit;
define('blocktagsfooter_MAX_LEVEL', 3);
class blocktagsfooter extends Module
{
function __construct()
{
 $this->name = 'blocktagsfooter';
 $this->tab = 'front_office_features';
 $this->version = '1.1';
 $this->author = 'PrestaShop';
 $this->need_instance = 0;
 parent::__construct();
 $this->displayName = $this->l('Footer Tags block Modified');
 $this->description = $this->l('Adds a block containing a tag cloud.');
}
function install()
{
 if (parent::install() == false
|| $this->registerHook('footer_bottom') == false
|| $this->registerHook('header') == false
|| Configuration::updateValue('blocktagsfooter_NBR', 20) == false)
  return false;
 return true;
}
public function getContent()
{
 $output = '<h2>'.$this->displayName.'</h2>';
 if (Tools::isSubmit('submitblocktagsfooter'))
 {
  if (!($tagsNbr = Tools::getValue('tagsNbr')) || empty($tagsNbr))
$output .= '<div class="alert error">'.$this->l('Please fill in the "tags displayed" field.').'</div>';
  elseif ((int)($tagsNbr) == 0)
$output .= '<div class="alert error">'.$this->l('Invalid number.').'</div>';
  else
  {
Configuration::updateValue('blocktagsfooter_NBR', (int)$tagsNbr);
$output .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>';
  }
 }
 return $output.$this->displayForm();
}
public function displayForm()
{
 $output = '
 <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">
  <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
<label>'.$this->l('Tags displayed').'</label>
<div class="margin-form">
 <input type="text" name="tagsNbr" value="'.(int)(Configuration::get('blocktagsfooter_NBR')).'" />
 <p class="clear">'.$this->l('Set the number of tags to be displayed in this block').'</p>
</div>
<center><input type="submit" name="submitblocktagsfooter" value="'.$this->l('Save').'" class="button" /></center>
  </fieldset>
 </form>';
 return $output;
}
/**
* Returns module content for left column
*
* @param array $params Parameters
* @return string Content
*
*/
function hookfooter_bottom($params)
{
 $tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('blocktagsfooter_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 = (blocktagsfooter_MAX_LEVEL - 1) / ($max - $min);
 }

 if (!sizeof($tags))
  return false;
 foreach ($tags AS &$tag)
  $tag['class'] = 'tag_level'.(int)(($tag['times'] - $min) * $coef + 1);
 $this->smarty->assign('tags', $tags);
 return $this->display(__FILE__, 'blocktagsfooter.tpl');
}
function hookHeader($params)
{
 $this->context->controller->addCSS(($this->_path).'blocktagsfooter.css', 'all');
}
}

 

je joins également le template :

<!-- Block tags module -->
<div id="tags_block_footer" class="tags_footer">

<ul class="block_content">
<span>{l s='Search By Keywords' mod='blocktagsfooter'}</span>
{if $tags}
{foreach from=$tags item=tag name=myLoop}
 <a href="{$link->getPageLink('search', true, NULL, "tag={$tag.name|urlencode}")}" title="{l s='More about' mod='blocktagsfooter'} {$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'}</a>
{/foreach}
{else}
{l s='No tags specified yet' mod='blocktagsfooter'}
{/if}
</ul>
</div>
<!-- /Block tags module -->

 

merci à tous !

post-11451-0-22985900-1372177116_thumb.jpg

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