Jump to content

Comment mettre le Bloc promotion au dessus des produit phare ?


Recommended Posts

Bonsoir,

Un module ne peut pas être affiché en même temps à des endroits différents ( enfin cela me semble logique puisqu'il contient des informations d'installation à un endroit précis).
La seule solution est de dupliquer le module (TPL et PHP etc) de changer son nom et de modifier le php afin de le faire installer ou tu souhaites.
Regardes bien le module original et cherches à comprendre le code, cela t'aidera pour faire un nouveau module qui s'installera ou tu le souhaites.

Link to comment
Share on other sites

Bonjour,

Ce module n'est pas prévu à la base pour une greffe en page d'accueil.
Pour l'autoriser il faut modifier le fichier /blockspecials/blockspecials.php

en fin de fichier essayez de rajouter :

function hookhome($params)
   {
       return $this->hookRightColumn($params);
   }



Au besoin désinstaller et réinstaller le module en back-office après modification.

Link to comment
Share on other sites

J'ai pas cela dans mon fichier

Voici ce qui ce trouve


<!-- MODULE Block specials -->


{l s='Specials' mod='blockspecials'}



{if $special}


{l s='All specials' mod='blockspecials'}


{else}

{l s='No specials at this time' mod='blockspecials'}


{/if}


<!-- /MODULE Block specials -->
Link to comment
Share on other sites

sa fonctionne toujours pas, voici mon fichier :


<?php

if (!defined('_CAN_LOAD_FILES_'))
exit;

class BlockSpecials extends Module
{
private $_html = '';
private $_postErrors = array();

function __construct()
{
$this->name = 'blockspecials';
$this->tab = 'Blocks';
$this->version = 0.8;

parent::__construct();

$this->displayName = $this->l('Specials block');
$this->description = $this->l('Adds a block with current product Specials');
}

function install()
{
return (parent::install() AND $this->registerHook('rightColumn'));
}

function hookRightColumn($params)
{
global $smarty;

if ($special = Product::getRandomSpecial(intval($params['cookie']->id_lang)))
$smarty->assign(array(
'special' => $special,
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'] / (1 + $special['rate'] / 100), 2),
'oldPrice' => $special['price'] + $special['reduction'],
'mediumSize' => Image::getSize('medium')));
return $this->display(__FILE__, 'blockspecials.tpl');
}

function hookLeftColumn($params)
{
return $this->hookRightColumn($params);
}

function hookhome($params)
{
return $this->registerHook($params);
}
}

?>

Link to comment
Share on other sites

quand tu publies du code penses à mettre entre balises pour plus de lisibilité.

pour info, mon blockspecials.php (qui fonctionne chez moi en 1.3.x)

<?php

if (!defined('_CAN_LOAD_FILES_'))
   exit;

class BlockSpecials extends Module
{
   private $_html = '';
   private $_postErrors = array();

   function __construct()
   {
       $this->name = 'blockspecials';
       $this->tab = 'Blocks';
       $this->version = 0.8;

       parent::__construct();

       $this->displayName = $this->l('Specials block');
       $this->description = $this->l('Adds a block with current product Specials');
   }

   function install()
   {
       return (parent::install() AND $this->registerHook('rightColumn'));
   }

   function hookRightColumn($params)
   {
       global $smarty;

       if ($special = Product::getRandomSpecial(intval($params['cookie']->id_lang)))
           $smarty->assign(array(
           'special' => $special,
           'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'] / (1 + $special['rate'] / 100), 2),
           'oldPrice' => $special['price'] + $special['reduction'],
           'mediumSize' => Image::getSize('medium')));
       return $this->display(__FILE__, 'blockspecials.tpl');
   }

   function hookLeftColumn($params)
   {
       return $this->hookRightColumn($params);
   }

   function hookhome($params)
   {
       return $this->hookRightColumn($params);
   }

}

?>

Link to comment
Share on other sites

  • 1 month later...

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