Jump to content

me gustaria sabe como puedo move las novedare de producto a pagina central


Max283

Recommended Posts

  • 4 weeks later...

Para hace eso deben modificar los Hook(ganchos)
primero deben desintalar el modulo en cuestion luego editar los parametros de instalacion de tal manera que el registerHook les quede en home

en su caso deben editar el modulo blocknewproducts/blocknewproducts.php y dejarlo ma o meno asi :

version 1.3.x

<?php

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

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

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

       parent::__construct();

       $this->displayName = $this->l('New products block');
       $this->description = $this->l('Displays a block featuring newly added products');
   }

/*   function install()
   {
       if (parent::install() == false OR $this->registerHook('rightColumn') == false OR Configuration::updateValue('NEW_PRODUCTS_NBR', 5) == false)
       return false;
   return true;
   }*/
   function install()
   {
       if (!Configuration::updateValue('NEW_PRODUCTS_NBR', 5) OR !parent::install() OR !$this->registerHook('home'))
           return false;
       return true;
   }
   public function getContent()
   {
       $output = ''.$this->displayName.'';
       if (Tools::isSubmit('submitBlockNewProducts'))
       {
           if (!$productNbr = Tools::getValue('productNbr') OR empty($productNbr))
               $output .= ''.$this->l('You should fill the "products displayed" field').'';
           elseif (intval($productNbr) == 0)
               $output .= ''.$this->l('Invalid number.').'';
           else
           {
               Configuration::updateValue('NEW_PRODUCTS_NBR', intval($productNbr));
               $output .= 'l('Confirmation').'" />'.$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('Products displayed').'

                   <input type="text" name="productNbr" value="'.intval(Configuration::get('NEW_PRODUCTS_NBR')).'" />

'.$this->l('Set the number of products to be displayed in this block').'

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

       </form>';
       return $output;
   }

   /*function hookRightColumn($params)
   {
       global $smarty;

       $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
       $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));

       return $this->display(__FILE__, 'blocknewproducts.tpl');
   }*/

/*    function hookLeftColumn($params)
   {
       return $this->hookRightColumn($params);
   }*/
       function hookHome($params)
   {
       global $smarty;

$newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
       $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('home')));

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

?>



para otra versiones de prestas quiten esto

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




saludos!!

Link to comment
Share on other sites

  • 2 months later...

Hola, tengo la misma necesidad de colocar el modulo de novedades en la home, estoy bajo la version 1.3.7 y al copiar este codigo e irme al backoffice para instalar el modulo me sale el siguiente error: Error de interpretción en módulo(s) ->blocknewproducts, teneis idea de porque?

Link to comment
Share on other sites

<?php

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

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

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

       parent::__construct();

       $this->displayName = $this->l('New products block');
       $this->description = $this->l('Displays a block featuring newly added products');
   }

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

   public function getContent()
   {
       $output = ''.$this->displayName.'';
       if (Tools::isSubmit('submitBlockNewProducts'))
       {
           if (!$productNbr = Tools::getValue('productNbr') OR empty($productNbr))
               $output .= ''.$this->l('You should fill the "products displayed" field').'';
           elseif (intval($productNbr) == 0)
               $output .= ''.$this->l('Invalid number.').'';
           else
           {
               Configuration::updateValue('NEW_PRODUCTS_NBR', intval($productNbr));
               $output .= 'l('Confirmation').'" />'.$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('Products displayed').'

                   <input type="text" name="productNbr" value="'.intval(Configuration::get('NEW_PRODUCTS_NBR')).'" />

'.$this->l('Set the number of products to be displayed in this block').'

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

       </form>';
       return $output;
   }

   function hookRightColumn($params)
   {
       global $smarty;

       $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
       $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));

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

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

?>



Asi me funciona correctamente.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...