Jump to content

Problemi con modulo slidenewproduct


Gianni

Recommended Posts

Ciao a tutti ho finalmente trovato un modulo per i nuovi prodotti diciamo così un po' più dinamico solo che c'è un problema non riesco a spostarlo nelle colonne laterali da quello che ho letto sul forum nel php manca l'Hook solo che io non so ne dove ne cosa inserire nel php del modulo.
utilizzo la v 1.2.4 il modulo l'ho scaricato da qui

vi posto il php del modulo

<?php

class SlideNewProducts extends Module
{
   private $_html = '';
   private $_directory;
   private $_filename;
   private $_filename_http;
   private $_postErrors = array();

   function __construct()
   {
       $this->name = 'slidenewproducts';
       $this->tab = 'Tools';
       $this->version = 0.1;

       parent::__construct(); // The parent construct is required for translations

       $this->page = basename(__FILE__, '.php');
       $this->displayName = $this->l('Slide new products');
       $this->description = $this->l('Shows a slideshow of new products in your home page');
   }

   function install()
   {
       if (!Configuration::updateValue('NEW_PRODUCTS_NBR', 50) OR !parent::install() OR !$this->registerHook('home') OR !$this->registerHook('header'))
           return false;
       return true;
   }

   public function getContent()
   {
       $output = ''.$this->displayName.'';
       if (Tools::isSubmit('submitslidenewproducts'))
       {
           $nbr = intval(Tools::getValue('nbr'));
           if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))
               $errors[] = $this->l('Invalid number of product');
           else
               Configuration::updateValue('NEW_PRODUCTS_NBR', $nbr);
           if (isset($errors) AND count($errors))
               $output .= $this->displayError(implode('
', $errors));
           else
               $output .= $this->displayConfirmation($this->l('Settings updated'));
       }
       return $output.$this->displayForm();
   }

   public function displayForm()
   {
       $output = '
       <form action="'.$_SERVER['REQUEST_URI'].'" method="post">
_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'
'.$this->l('Number of products to display').'

                   <input type="text" size="5" name="nbr" value="'.Tools::getValue('nbr', Configuration::get('NEW_PRODUCTS_NBR')).'" />

'.$this->l('The number of products displayed on homepage (default: 10)').'


<input type="submit" name="submitslidenewproducts" value="'.$this->l('Save').'" class="button" />

       </form>';
       return $output;
   }

   function hookHome($params)
   {
       global $smarty;
       $currency = new Currency(intval($params['cookie']->id_currency));
       $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, Configuration::get('NEW_PRODUCTS_NBR'));
       $new_products = array();
       if ($newProducts)
           foreach ($newProducts AS $newProduct)
               $new_products[] = $newProduct;

       $smarty->assign('new_products', $new_products);
       return $this->display(__FILE__, 'slidenewproducts.tpl');
   }

   function hookHeader($params)
   {
        global $smarty;

       ob_start();
       ?>

       <link rel="stylesheet" href="<?php echo $this->_path;?>css/slidenewproducts.css" type="text/css" media="screen" charset="utf-8" />
       [removed]_path;?>js/startstop-slider.js" type="text/javascript">[removed]

   <?php    
       $output = ob_get_contents();
       ob_end_clean();
       return $output;
   }

}

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