antonio4287 Posted October 23, 2013 Share Posted October 23, 2013 Necesito duplicar un modulo para colocar varias veces en la web, he intentado seguir los post que hay en el foro para ello pero no es valido. He intentado cambiar los nombres en los archivos del modulo pero debe faltarme alguna info.¿hay algun metodo rapido y sencillo para realizarlo? Link to comment Share on other sites More sharing options...
nadie Posted October 23, 2013 Share Posted October 23, 2013 Lo primero debes indicarme de que modulo se trata, no solo tienes que cambiar el nombre de los ficheros y del directorio, tambien las variables de llamada, el nombre de la clase, las variables de impresion en el tpl, los datos del constructor del modulo, etc.. ¿Que modulo quieres duplicar? Link to comment Share on other sites More sharing options...
antonio4287 Posted October 23, 2013 Author Share Posted October 23, 2013 (edited) Lo primero debes indicarme de que modulo se trata, no solo tienes que cambiar el nombre de los ficheros y del directorio, tambien las variables de llamada, el nombre de la clase, las variables de impresion en el tpl, los datos del constructor del modulo, etc.. ¿Que modulo quieres duplicar? Te lo indico por privado No puedo enviarte privado.. Edited October 23, 2013 by antonio4287 (see edit history) Link to comment Share on other sites More sharing options...
nadie Posted October 23, 2013 Share Posted October 23, 2013 Te lo indico por privado No puedo enviarte privado.. Oh (Top secret) ¿Te monto un ejemplo de duplicar por ejemplo el modulo blockrss? (que es uno sencillo) Link to comment Share on other sites More sharing options...
antonio4287 Posted October 23, 2013 Author Share Posted October 23, 2013 Oh (Top secret) ¿Te monto un ejemplo de duplicar por ejemplo el modulo blockrss? (que es uno sencillo) PErfect, haber si asi aprendo xDxD Link to comment Share on other sites More sharing options...
nadie Posted October 23, 2013 Share Posted October 23, 2013 PErfect, haber si asi aprendo xDxD Ok, pues cuando termine codigo emprende de la "1" me pondre hacerte un ejemplo. (Asi que hoy ya puedes ir a dormir xDDD) Link to comment Share on other sites More sharing options...
antonio4287 Posted October 23, 2013 Author Share Posted October 23, 2013 Ok, pues cuando termine codigo emprende de la "1" me pondre hacerte un ejemplo. (Asi que hoy ya puedes ir a dormir xDDD) cenkiu Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 Buenos dias Nadie, has podido hacer el pequeño tutorial?un saludo Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 Buenos dias Nadie, has podido hacer el pequeño tutorial? un saludo Voy a ello. Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 Voy a ello. Gracias! Rapido y veloz como siempre!! xDxd Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 ¿Creías que me iba olvidar de ti? (Pues noooooooooooooooooooooooo xD) Duplicar Módulo (blockrss) (Bloque fuentes RSS) Renombrar directorio blockrss a blockrss2 Renombrar fichero: blockrss.php a blockrss2.php ----------------------------------------------------------------------------------------------------- Abrir fichero: blockrss2.php Buscar esto: class Blockrss extends Module Y dejarlo así: class Blockrss2 extends Module Buscar esto: function __construct() { $this->name = 'blockrss'; $this->tab = 'front_office_features'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('RSS feed block'); $this->description = $this->l('Adds a block displaying an RSS feed.'); $this->version = '1.1'; $this->author = 'PrestaShop'; $this->error = false; $this->valid = false; } Y dejarlo asi: function __construct() { $this->name = 'blockrss2'; $this->tab = 'front_office_features'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('RSS feed block'); $this->description = $this->l('Adds a block displaying an RSS feed.'); $this->version = '1.1'; $this->author = 'PrestaShop'; $this->error = false; $this->valid = false; } Buscar esto: function install() { Configuration::updateValue('RSS_FEED_TITLE', $this->l('RSS feed')); Configuration::updateValue('RSS_FEED_NBR', 5); if (parent::install() == false OR $this->registerHook('leftColumn') == false OR $this->registerHook('header') == false) return false; return true; } Y dejar asi: function install() { Configuration::updateValue('RSS_FEED_TITLE2', $this->l('RSS feed')); Configuration::updateValue('RSS_FEED_NBR2', 5); if (parent::install() == false OR $this->registerHook('leftColumn') == false OR $this->registerHook('header') == false) return false; return true; } Buscar esto: public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockRss')) { $errors = array(); $urlfeed = Tools::getValue('urlfeed'); $title = Tools::getValue('title'); $nbr = (int)Tools::getValue('nbr'); if ($urlfeed AND !Validate::isAbsoluteUrl($urlfeed)) $errors[] = $this->l('Invalid feed URL'); elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) $errors[] = $this->l('Invalid title'); elseif (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr)) $errors[] = $this->l('Invalid number of feeds'); elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); elseif (!($contents = Tools::file_get_contents($urlfeed))) $errors[] = $this->l('Feed is unreachable, check your URL'); /* Even if the feed was reachable, We need to make sure that the feed is well formated */ else { try { $xmlFeed = new XML_Feed_Parser($contents); } catch (XML_Feed_Parser_Exception $e) { $errors[] = $this->l('Invalid feed:').' '.$e->getMessage(); } } if (!sizeof($errors)) { Configuration::updateValue('RSS_FEED_URL', $urlfeed); Configuration::updateValue('RSS_FEED_TITLE', $title); Configuration::updateValue('RSS_FEED_NBR', $nbr); $output .= $this->displayConfirmation($this->l('Settings updated')); } else $output .= $this->displayError(implode('<br />', $errors)); } else { $errors = array(); if (stristr(Configuration::get('RSS_FEED_URL'), $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); if (sizeof($errors)) $output .= $this->displayError(implode('<br />', $errors)); } return $output.$this->displayForm(); } Y dejarlo así: public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockRss')) { $errors = array(); $urlfeed = Tools::getValue('urlfeed2'); $title = Tools::getValue('title2'); $nbr = (int)Tools::getValue('nbr2'); if ($urlfeed AND !Validate::isAbsoluteUrl($urlfeed)) $errors[] = $this->l('Invalid feed URL'); elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) $errors[] = $this->l('Invalid title'); elseif (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr)) $errors[] = $this->l('Invalid number of feeds'); elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); elseif (!($contents = Tools::file_get_contents($urlfeed))) $errors[] = $this->l('Feed is unreachable, check your URL'); /* Even if the feed was reachable, We need to make sure that the feed is well formated */ else { try { $xmlFeed = new XML_Feed_Parser($contents); } catch (XML_Feed_Parser_Exception $e) { $errors[] = $this->l('Invalid feed:').' '.$e->getMessage(); } } if (!sizeof($errors)) { Configuration::updateValue('RSS_FEED_URL2', $urlfeed); Configuration::updateValue('RSS_FEED_TITLE2', $title); Configuration::updateValue('RSS_FEED_NBR2', $nbr); $output .= $this->displayConfirmation($this->l('Settings updated')); } else $output .= $this->displayError(implode('<br />', $errors)); } else { $errors = array(); if (stristr(Configuration::get('RSS_FEED_URL2'), $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); if (sizeof($errors)) $output .= $this->displayError(implode('<br />', $errors)); } return $output.$this->displayForm(); } --- Buscar esto: 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('Block title').'</label> <div class="margin-form"> <input type="text" name="title" value="'.Tools::safeOutput(Tools::getValue('title', Configuration::get('RSS_FEED_TITLE'))).'" /> <p class="clear">'.$this->l('Create a title for the block (default: \'RSS feed\')').'</p> </div> <label>'.$this->l('Add a feed URL').'</label> <div class="margin-form"> <input type="text" size="85" name="urlfeed" value="'.Tools::safeOutput(Tools::getValue('urlfeed', Configuration::get('RSS_FEED_URL'))).'" /> <p class="clear">'.$this->l('Add the URL of the feed you want to use (sample: http://news.google.com/?output=rss)').'</p> </div> <label>'.$this->l('Number of threads displayed').'</label> <div class="margin-form"> <input type="text" size="5" name="nbr" value="'.(int)Tools::getValue('nbr', Configuration::get('RSS_FEED_NBR')).'" /> <p class="clear">'.$this->l('Number of threads displayed by the block (default value: 5)').'</p> </div> <center><input type="submit" name="submitBlockRss" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $output; } Y dejarlo así: 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('Block title').'</label> <div class="margin-form"> <input type="text" name="title2" value="'.Tools::safeOutput(Tools::getValue('title2', Configuration::get('RSS_FEED_TITLE2'))).'" /> <p class="clear">'.$this->l('Create a title for the block (default: \'RSS feed\')').'</p> </div> <label>'.$this->l('Add a feed URL').'</label> <div class="margin-form"> <input type="text" size="85" name="urlfeed2" value="'.Tools::safeOutput(Tools::getValue('urlfeed2', Configuration::get('RSS_FEED_URL2'))).'" /> <p class="clear">'.$this->l('Add the URL of the feed you want to use (sample: http://news.google.com/?output=rss)').'</p> </div> <label>'.$this->l('Number of threads displayed').'</label> <div class="margin-form"> <input type="text" size="5" name="nbr2" value="'.(int)Tools::getValue('nbr2', Configuration::get('RSS_FEED_NBR2')).'" /> <p class="clear">'.$this->l('Number of threads displayed by the block (default value: 5)').'</p> </div> <center><input type="submit" name="submitBlockRss" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $output; } Buscar: function hookLeftColumn($params) { // Conf $title = strval(Configuration::get('RSS_FEED_TITLE')); $url = strval(Configuration::get('RSS_FEED_URL')); $nb = (int)(Configuration::get('RSS_FEED_NBR')); // Getting data $rss_links = array(); if ($url && ($contents = Tools::file_get_contents($url))) try { if (@$src = new XML_Feed_Parser($contents)) { for ($i = 0; $i < ($nb ? $nb : 5); $i++) { if (@$item = $src->getEntryByOffset($i)) { $xmlValues = array(); foreach(self::$xmlFields as $xmlField) { $xmlValues[$xmlField] = $item->__get($xmlField); } $xmlValues['enclosure'] = $item->getEnclosure(); # Compatibility $xmlValues['url'] = $xmlValues['link']; $rss_links[] = $xmlValues; } } } } catch (XML_Feed_Parser_Exception $e) { Tools::dieOrLog(sprintf($this->l('Error: invalid RSS feed in "blockrss" module: %s'), $e->getMessage()), false); } // Display smarty $this->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); return $this->display(__FILE__, 'blockrss.tpl'); } Dejar: function hookLeftColumn($params) { // Conf $title = strval(Configuration::get('RSS_FEED_TITLE2')); $url = strval(Configuration::get('RSS_FEED_URL2')); $nb = (int)(Configuration::get('RSS_FEED_NBR2')); // Getting data $rss_links = array(); if ($url && ($contents = Tools::file_get_contents($url))) try { if (@$src = new XML_Feed_Parser($contents)) { for ($i = 0; $i < ($nb ? $nb : 5); $i++) { if (@$item = $src->getEntryByOffset($i)) { $xmlValues = array(); foreach(self::$xmlFields as $xmlField) { $xmlValues[$xmlField] = $item->__get($xmlField); } $xmlValues['enclosure'] = $item->getEnclosure(); # Compatibility $xmlValues['url'] = $xmlValues['link']; $rss_links[] = $xmlValues; } } } } catch (XML_Feed_Parser_Exception $e) { Tools::dieOrLog(sprintf($this->l('Error: invalid RSS feed in "blockrss" module: %s'), $e->getMessage()), false); } // Display smarty $this->smarty->assign(array('title2' => ($title ? $title : $this->l('RSS feed')), 'rss_links2' => $rss_links)); return $this->display(__FILE__, 'blockrss2.tpl'); } ----------------------------------------- Renombrar fichero: blockrss.tpl a blockrss2.tpl Editar: blockrss2.tpl Buscando esto: <!-- Block RSS module--> <div id="rss_block_left" class="block"> <h4 class="title_block">{$title}</h4> <div class="block_content"> {if $rss_links} <ul> {foreach from=$rss_links item='rss_link'} <li><a href="{$rss_link.url}">{$rss_link.title}</a></li> {/foreach} </ul> {else} <p>{l s='No RSS feed added' mod='blockrss'}</p> {/if} </div> </div> <!-- /Block RSS module--> Y dejandolo asi: <!-- Block RSS module--> <div id="rss_block_left" class="block"> <h4 class="title_block">{$title2}</h4> <div class="block_content"> {if $rss_links2} <ul> {foreach from=$rss_links2 item='rss_link2'} <li><a href="{$rss_link2.url}">{$rss_link2.title}</a></li> {/foreach} </ul> {else} <p>{l s='No RSS feed added' mod='blockrss2'}</p> {/if} </div> </div> <!-- /Block RSS module--> ---------------------- Editar ficheros: (idiomas, este es un ejemplo para el del idioma Español) /blockrss2/translations/es.php Buscar: <?php global $_MODULE; $_MODULE = array(); $_MODULE['<{blockrss}prestashop>blockrss_2516c13a12d3dbaf4efa88d9fce2e7da'] = 'Bloque fuentes RSS'; $_MODULE['<{blockrss}prestashop>blockrss_04396664ce529aa4204b0f7ad753fad1'] = 'Añadir o bloquear con un campo de búsqueda rápida'; $_MODULE['<{blockrss}prestashop>blockrss_9680162225162baf2a085dfdc2814deb'] = 'fuentes RSS'; $_MODULE['<{blockrss}prestashop>blockrss_6706b6d8ba45cc4f0eda0506ba1dc3c8'] = 'URL de fuente incorrecta'; $_MODULE['<{blockrss}prestashop>blockrss_36ed65ce17306e812fd68d9f634c0c57'] = 'Título incorrecto'; $_MODULE['<{blockrss}prestashop>blockrss_1b3d34e25aef32a3c8daddfff856577f'] = 'Número de fuentes incorrecto'; $_MODULE['<{blockrss}prestashop>blockrss_e423bd72f5aa1be13216c5abbd3deb45'] = 'Ha seleccionado su propio feed a su sitio en al url. Por favor seleccione otro'; $_MODULE['<{blockrss}prestashop>blockrss_bef637cd0e222a8b56676cb64ce75258'] = 'El feed es inalcanzable. Seleccione otro'; $_MODULE['<{blockrss}prestashop>blockrss_1844ef1bfaa030dc8423c4645a43525c'] = 'Feed inválido'; $_MODULE['<{blockrss}prestashop>blockrss_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada'; $_MODULE['<{blockrss}prestashop>blockrss_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuración'; $_MODULE['<{blockrss}prestashop>blockrss_b22c8f9ad7db023c548c3b8e846cb169'] = 'Título del bloque'; $_MODULE['<{blockrss}prestashop>blockrss_2343a40bdffd8c7a6317b6d98c2b1042'] = 'Cree un título para el bloque (por defecto\'RSS feed\')'; $_MODULE['<{blockrss}prestashop>blockrss_402d00ca8e4f0fff26fc24ee9ab8e82b'] = 'Añadir URL de la fuente'; $_MODULE['<{blockrss}prestashop>blockrss_695d0986205c1ce17d03b026feb78c97'] = 'Añada la url del feed a utilizar (ejemplo: http://news.google.com/?output=rss)'; $_MODULE['<{blockrss}prestashop>blockrss_ff9aa540e20285875ac8b190a3cb7ccf'] = 'Número de hilos mostrados'; $_MODULE['<{blockrss}prestashop>blockrss_f33725e23a017705ad35897e849a4db4'] = 'Número de hilos mostrados en cada bloque (por defecto 5)'; $_MODULE['<{blockrss}prestashop>blockrss_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{blockrss}prestashop>blockrss_0a1c629f0e86804a9e165f4b1ee399b7'] = 'Error: RSS feed en \"blockrss\" módulo: %s'; $_MODULE['<{blockrss}prestashop>blockrss_10fd25dcd3353c0ba3731d4a23657f2e'] = 'No se han añadido fuentes RSS'; Y dejarlo así:: <?php global $_MODULE; $_MODULE = array(); $_MODULE['<{blockrss2}prestashop>blockrss2_2516c13a12d3dbaf4efa88d9fce2e7da'] = 'Bloque fuentes RSS (2)'; $_MODULE['<{blockrss2}prestashop>blockrss2_04396664ce529aa4204b0f7ad753fad1'] = 'Añadir o bloquear con un campo de búsqueda rápida'; $_MODULE['<{blockrss2}prestashop>blockrss2_9680162225162baf2a085dfdc2814deb'] = 'fuentes RSS'; $_MODULE['<{blockrss2}prestashop>blockrss2_6706b6d8ba45cc4f0eda0506ba1dc3c8'] = 'URL de fuente incorrecta'; $_MODULE['<{blockrss2}prestashop>blockrss2_36ed65ce17306e812fd68d9f634c0c57'] = 'Título incorrecto'; $_MODULE['<{blockrss2}prestashop>blockrss2_1b3d34e25aef32a3c8daddfff856577f'] = 'Número de fuentes incorrecto'; $_MODULE['<{blockrss2}prestashop>blockrss2_e423bd72f5aa1be13216c5abbd3deb45'] = 'Ha seleccionado su propio feed a su sitio en al url. Por favor seleccione otro'; $_MODULE['<{blockrss2}prestashop>blockrss2_bef637cd0e222a8b56676cb64ce75258'] = 'El feed es inalcanzable. Seleccione otro'; $_MODULE['<{blockrss2}prestashop>blockrss2_1844ef1bfaa030dc8423c4645a43525c'] = 'Feed inválido'; $_MODULE['<{blockrss2}prestashop>blockrss2_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada'; $_MODULE['<{blockrss2}prestashop>blockrss2_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuración'; $_MODULE['<{blockrss2}prestashop>blockrss2_b22c8f9ad7db023c548c3b8e846cb169'] = 'Título del bloque'; $_MODULE['<{blockrss2}prestashop>blockrss2_2343a40bdffd8c7a6317b6d98c2b1042'] = 'Cree un título para el bloque (por defecto\'RSS feed\')'; $_MODULE['<{blockrss2}prestashop>blockrss2_402d00ca8e4f0fff26fc24ee9ab8e82b'] = 'Añadir URL de la fuente'; $_MODULE['<{blockrss2}prestashop>blockrss2_695d0986205c1ce17d03b026feb78c97'] = 'Añada la url del feed a utilizar (ejemplo: http://news.google.com/?output=rss)'; $_MODULE['<{blockrss2}prestashop>blockrss2_ff9aa540e20285875ac8b190a3cb7ccf'] = 'Número de hilos mostrados'; $_MODULE['<{blockrss2}prestashop>blockrss2_f33725e23a017705ad35897e849a4db4'] = 'Número de hilos mostrados en cada bloque (por defecto 5)'; $_MODULE['<{blockrss2}prestashop>blockrss2_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{blockrss2}prestashop>blockrss2_0a1c629f0e86804a9e165f4b1ee399b7'] = 'Error: RSS feed en \"blockrss\" módulo: %s'; $_MODULE['<{blockrss2}prestashop>blockrss2_10fd25dcd3353c0ba3731d4a23657f2e'] = 'No se han añadido fuentes RSS'; Eliminar el: /blockrss2/config.xml ya que cuando lo instalemos el duplicado de forma automático. --- Ultimo paso comprimir el directorio blockrss2 a blockrss2.zip Ahora lo subes desde la pestaña "Módulos -> Módulos" Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 ¿Creías que me iba olvidar de ti? (Pues noooooooooooooooooooooooo xD) Duplicar Módulo (blockrss) (Bloque fuentes RSS) Renombrar directorio blockrss a blockrss2 Renombrar fichero: blockrss.php a blockrss2.php ----------------------------------------------------------------------------------------------------- Abrir fichero: blockrss2.php Buscar esto: class Blockrss extends Module Y dejarlo así: class Blockrss2 extends Module Buscar esto: function __construct() { $this->name = 'blockrss'; $this->tab = 'front_office_features'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('RSS feed block'); $this->description = $this->l('Adds a block displaying an RSS feed.'); $this->version = '1.1'; $this->author = 'PrestaShop'; $this->error = false; $this->valid = false; } Y dejarlo asi: function __construct() { $this->name = 'blockrss2'; $this->tab = 'front_office_features'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('RSS feed block'); $this->description = $this->l('Adds a block displaying an RSS feed.'); $this->version = '1.1'; $this->author = 'PrestaShop'; $this->error = false; $this->valid = false; } Buscar esto: function install() { Configuration::updateValue('RSS_FEED_TITLE', $this->l('RSS feed')); Configuration::updateValue('RSS_FEED_NBR', 5); if (parent::install() == false OR $this->registerHook('leftColumn') == false OR $this->registerHook('header') == false) return false; return true; } Y dejar asi: function install() { Configuration::updateValue('RSS_FEED_TITLE2', $this->l('RSS feed')); Configuration::updateValue('RSS_FEED_NBR2', 5); if (parent::install() == false OR $this->registerHook('leftColumn') == false OR $this->registerHook('header') == false) return false; return true; } Buscar esto: public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockRss')) { $errors = array(); $urlfeed = Tools::getValue('urlfeed'); $title = Tools::getValue('title'); $nbr = (int)Tools::getValue('nbr'); if ($urlfeed AND !Validate::isAbsoluteUrl($urlfeed)) $errors[] = $this->l('Invalid feed URL'); elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) $errors[] = $this->l('Invalid title'); elseif (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr)) $errors[] = $this->l('Invalid number of feeds'); elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); elseif (!($contents = Tools::file_get_contents($urlfeed))) $errors[] = $this->l('Feed is unreachable, check your URL'); /* Even if the feed was reachable, We need to make sure that the feed is well formated */ else { try { $xmlFeed = new XML_Feed_Parser($contents); } catch (XML_Feed_Parser_Exception $e) { $errors[] = $this->l('Invalid feed:').' '.$e->getMessage(); } } if (!sizeof($errors)) { Configuration::updateValue('RSS_FEED_URL', $urlfeed); Configuration::updateValue('RSS_FEED_TITLE', $title); Configuration::updateValue('RSS_FEED_NBR', $nbr); $output .= $this->displayConfirmation($this->l('Settings updated')); } else $output .= $this->displayError(implode('<br />', $errors)); } else { $errors = array(); if (stristr(Configuration::get('RSS_FEED_URL'), $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); if (sizeof($errors)) $output .= $this->displayError(implode('<br />', $errors)); } return $output.$this->displayForm(); } Y dejarlo así: public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockRss')) { $errors = array(); $urlfeed = Tools::getValue('urlfeed2'); $title = Tools::getValue('title2'); $nbr = (int)Tools::getValue('nbr2'); if ($urlfeed AND !Validate::isAbsoluteUrl($urlfeed)) $errors[] = $this->l('Invalid feed URL'); elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) $errors[] = $this->l('Invalid title'); elseif (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr)) $errors[] = $this->l('Invalid number of feeds'); elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); elseif (!($contents = Tools::file_get_contents($urlfeed))) $errors[] = $this->l('Feed is unreachable, check your URL'); /* Even if the feed was reachable, We need to make sure that the feed is well formated */ else { try { $xmlFeed = new XML_Feed_Parser($contents); } catch (XML_Feed_Parser_Exception $e) { $errors[] = $this->l('Invalid feed:').' '.$e->getMessage(); } } if (!sizeof($errors)) { Configuration::updateValue('RSS_FEED_URL2', $urlfeed); Configuration::updateValue('RSS_FEED_TITLE2', $title); Configuration::updateValue('RSS_FEED_NBR2', $nbr); $output .= $this->displayConfirmation($this->l('Settings updated')); } else $output .= $this->displayError(implode('<br />', $errors)); } else { $errors = array(); if (stristr(Configuration::get('RSS_FEED_URL2'), $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); if (sizeof($errors)) $output .= $this->displayError(implode('<br />', $errors)); } return $output.$this->displayForm(); } --- Buscar esto: 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('Block title').'</label> <div class="margin-form"> <input type="text" name="title" value="'.Tools::safeOutput(Tools::getValue('title', Configuration::get('RSS_FEED_TITLE'))).'" /> <p class="clear">'.$this->l('Create a title for the block (default: \'RSS feed\')').'</p> </div> <label>'.$this->l('Add a feed URL').'</label> <div class="margin-form"> <input type="text" size="85" name="urlfeed" value="'.Tools::safeOutput(Tools::getValue('urlfeed', Configuration::get('RSS_FEED_URL'))).'" /> <p class="clear">'.$this->l('Add the URL of the feed you want to use (sample: http://news.google.com/?output=rss)').'</p> </div> <label>'.$this->l('Number of threads displayed').'</label> <div class="margin-form"> <input type="text" size="5" name="nbr" value="'.(int)Tools::getValue('nbr', Configuration::get('RSS_FEED_NBR')).'" /> <p class="clear">'.$this->l('Number of threads displayed by the block (default value: 5)').'</p> </div> <center><input type="submit" name="submitBlockRss" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $output; } Y dejarlo así: 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('Block title').'</label> <div class="margin-form"> <input type="text" name="title2" value="'.Tools::safeOutput(Tools::getValue('title2', Configuration::get('RSS_FEED_TITLE2'))).'" /> <p class="clear">'.$this->l('Create a title for the block (default: \'RSS feed\')').'</p> </div> <label>'.$this->l('Add a feed URL').'</label> <div class="margin-form"> <input type="text" size="85" name="urlfeed2" value="'.Tools::safeOutput(Tools::getValue('urlfeed2', Configuration::get('RSS_FEED_URL2'))).'" /> <p class="clear">'.$this->l('Add the URL of the feed you want to use (sample: http://news.google.com/?output=rss)').'</p> </div> <label>'.$this->l('Number of threads displayed').'</label> <div class="margin-form"> <input type="text" size="5" name="nbr2" value="'.(int)Tools::getValue('nbr2', Configuration::get('RSS_FEED_NBR2')).'" /> <p class="clear">'.$this->l('Number of threads displayed by the block (default value: 5)').'</p> </div> <center><input type="submit" name="submitBlockRss" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $output; } Buscar: function hookLeftColumn($params) { // Conf $title = strval(Configuration::get('RSS_FEED_TITLE')); $url = strval(Configuration::get('RSS_FEED_URL')); $nb = (int)(Configuration::get('RSS_FEED_NBR')); // Getting data $rss_links = array(); if ($url && ($contents = Tools::file_get_contents($url))) try { if (@$src = new XML_Feed_Parser($contents)) { for ($i = 0; $i < ($nb ? $nb : 5); $i++) { if (@$item = $src->getEntryByOffset($i)) { $xmlValues = array(); foreach(self::$xmlFields as $xmlField) { $xmlValues[$xmlField] = $item->__get($xmlField); } $xmlValues['enclosure'] = $item->getEnclosure(); # Compatibility $xmlValues['url'] = $xmlValues['link']; $rss_links[] = $xmlValues; } } } } catch (XML_Feed_Parser_Exception $e) { Tools::dieOrLog(sprintf($this->l('Error: invalid RSS feed in "blockrss" module: %s'), $e->getMessage()), false); } // Display smarty $this->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); return $this->display(__FILE__, 'blockrss.tpl'); } Dejar: function hookLeftColumn($params) { // Conf $title = strval(Configuration::get('RSS_FEED_TITLE2')); $url = strval(Configuration::get('RSS_FEED_URL2')); $nb = (int)(Configuration::get('RSS_FEED_NBR2')); // Getting data $rss_links = array(); if ($url && ($contents = Tools::file_get_contents($url))) try { if (@$src = new XML_Feed_Parser($contents)) { for ($i = 0; $i < ($nb ? $nb : 5); $i++) { if (@$item = $src->getEntryByOffset($i)) { $xmlValues = array(); foreach(self::$xmlFields as $xmlField) { $xmlValues[$xmlField] = $item->__get($xmlField); } $xmlValues['enclosure'] = $item->getEnclosure(); # Compatibility $xmlValues['url'] = $xmlValues['link']; $rss_links[] = $xmlValues; } } } } catch (XML_Feed_Parser_Exception $e) { Tools::dieOrLog(sprintf($this->l('Error: invalid RSS feed in "blockrss" module: %s'), $e->getMessage()), false); } // Display smarty $this->smarty->assign(array('title2' => ($title ? $title : $this->l('RSS feed')), 'rss_links2' => $rss_links)); return $this->display(__FILE__, 'blockrss2.tpl'); } ----------------------------------------- Renombrar fichero: blockrss.tpl a blockrss2.tpl Editar: blockrss2.tpl Buscando esto: <!-- Block RSS module--> <div id="rss_block_left" class="block"> <h4 class="title_block">{$title}</h4> <div class="block_content"> {if $rss_links} <ul> {foreach from=$rss_links item='rss_link'} <li><a href="{$rss_link.url}">{$rss_link.title}</a></li> {/foreach} </ul> {else} <p>{l s='No RSS feed added' mod='blockrss'}</p> {/if} </div> </div> <!-- /Block RSS module--> Y dejandolo asi: <!-- Block RSS module--> <div id="rss_block_left" class="block"> <h4 class="title_block">{$title2}</h4> <div class="block_content"> {if $rss_links2} <ul> {foreach from=$rss_links2 item='rss_link2'} <li><a href="{$rss_link2.url}">{$rss_link2.title}</a></li> {/foreach} </ul> {else} <p>{l s='No RSS feed added' mod='blockrss2'}</p> {/if} </div> </div> <!-- /Block RSS module--> ---------------------- Editar ficheros: (idiomas, este es un ejemplo para el del idioma Español) /blockrss2/translations/es.php Buscar: <?php global $_MODULE; $_MODULE = array(); $_MODULE['<{blockrss}prestashop>blockrss_2516c13a12d3dbaf4efa88d9fce2e7da'] = 'Bloque fuentes RSS'; $_MODULE['<{blockrss}prestashop>blockrss_04396664ce529aa4204b0f7ad753fad1'] = 'Añadir o bloquear con un campo de búsqueda rápida'; $_MODULE['<{blockrss}prestashop>blockrss_9680162225162baf2a085dfdc2814deb'] = 'fuentes RSS'; $_MODULE['<{blockrss}prestashop>blockrss_6706b6d8ba45cc4f0eda0506ba1dc3c8'] = 'URL de fuente incorrecta'; $_MODULE['<{blockrss}prestashop>blockrss_36ed65ce17306e812fd68d9f634c0c57'] = 'Título incorrecto'; $_MODULE['<{blockrss}prestashop>blockrss_1b3d34e25aef32a3c8daddfff856577f'] = 'Número de fuentes incorrecto'; $_MODULE['<{blockrss}prestashop>blockrss_e423bd72f5aa1be13216c5abbd3deb45'] = 'Ha seleccionado su propio feed a su sitio en al url. Por favor seleccione otro'; $_MODULE['<{blockrss}prestashop>blockrss_bef637cd0e222a8b56676cb64ce75258'] = 'El feed es inalcanzable. Seleccione otro'; $_MODULE['<{blockrss}prestashop>blockrss_1844ef1bfaa030dc8423c4645a43525c'] = 'Feed inválido'; $_MODULE['<{blockrss}prestashop>blockrss_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada'; $_MODULE['<{blockrss}prestashop>blockrss_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuración'; $_MODULE['<{blockrss}prestashop>blockrss_b22c8f9ad7db023c548c3b8e846cb169'] = 'Título del bloque'; $_MODULE['<{blockrss}prestashop>blockrss_2343a40bdffd8c7a6317b6d98c2b1042'] = 'Cree un título para el bloque (por defecto\'RSS feed\')'; $_MODULE['<{blockrss}prestashop>blockrss_402d00ca8e4f0fff26fc24ee9ab8e82b'] = 'Añadir URL de la fuente'; $_MODULE['<{blockrss}prestashop>blockrss_695d0986205c1ce17d03b026feb78c97'] = 'Añada la url del feed a utilizar (ejemplo: http://news.google.com/?output=rss)'; $_MODULE['<{blockrss}prestashop>blockrss_ff9aa540e20285875ac8b190a3cb7ccf'] = 'Número de hilos mostrados'; $_MODULE['<{blockrss}prestashop>blockrss_f33725e23a017705ad35897e849a4db4'] = 'Número de hilos mostrados en cada bloque (por defecto 5)'; $_MODULE['<{blockrss}prestashop>blockrss_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{blockrss}prestashop>blockrss_0a1c629f0e86804a9e165f4b1ee399b7'] = 'Error: RSS feed en \"blockrss\" módulo: %s'; $_MODULE['<{blockrss}prestashop>blockrss_10fd25dcd3353c0ba3731d4a23657f2e'] = 'No se han añadido fuentes RSS'; Y dejarlo así:: <?php global $_MODULE; $_MODULE = array(); $_MODULE['<{blockrss2}prestashop>blockrss2_2516c13a12d3dbaf4efa88d9fce2e7da'] = 'Bloque fuentes RSS (2)'; $_MODULE['<{blockrss2}prestashop>blockrss2_04396664ce529aa4204b0f7ad753fad1'] = 'Añadir o bloquear con un campo de búsqueda rápida'; $_MODULE['<{blockrss2}prestashop>blockrss2_9680162225162baf2a085dfdc2814deb'] = 'fuentes RSS'; $_MODULE['<{blockrss2}prestashop>blockrss2_6706b6d8ba45cc4f0eda0506ba1dc3c8'] = 'URL de fuente incorrecta'; $_MODULE['<{blockrss2}prestashop>blockrss2_36ed65ce17306e812fd68d9f634c0c57'] = 'Título incorrecto'; $_MODULE['<{blockrss2}prestashop>blockrss2_1b3d34e25aef32a3c8daddfff856577f'] = 'Número de fuentes incorrecto'; $_MODULE['<{blockrss2}prestashop>blockrss2_e423bd72f5aa1be13216c5abbd3deb45'] = 'Ha seleccionado su propio feed a su sitio en al url. Por favor seleccione otro'; $_MODULE['<{blockrss2}prestashop>blockrss2_bef637cd0e222a8b56676cb64ce75258'] = 'El feed es inalcanzable. Seleccione otro'; $_MODULE['<{blockrss2}prestashop>blockrss2_1844ef1bfaa030dc8423c4645a43525c'] = 'Feed inválido'; $_MODULE['<{blockrss2}prestashop>blockrss2_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada'; $_MODULE['<{blockrss2}prestashop>blockrss2_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuración'; $_MODULE['<{blockrss2}prestashop>blockrss2_b22c8f9ad7db023c548c3b8e846cb169'] = 'Título del bloque'; $_MODULE['<{blockrss2}prestashop>blockrss2_2343a40bdffd8c7a6317b6d98c2b1042'] = 'Cree un título para el bloque (por defecto\'RSS feed\')'; $_MODULE['<{blockrss2}prestashop>blockrss2_402d00ca8e4f0fff26fc24ee9ab8e82b'] = 'Añadir URL de la fuente'; $_MODULE['<{blockrss2}prestashop>blockrss2_695d0986205c1ce17d03b026feb78c97'] = 'Añada la url del feed a utilizar (ejemplo: http://news.google.com/?output=rss)'; $_MODULE['<{blockrss2}prestashop>blockrss2_ff9aa540e20285875ac8b190a3cb7ccf'] = 'Número de hilos mostrados'; $_MODULE['<{blockrss2}prestashop>blockrss2_f33725e23a017705ad35897e849a4db4'] = 'Número de hilos mostrados en cada bloque (por defecto 5)'; $_MODULE['<{blockrss2}prestashop>blockrss2_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{blockrss2}prestashop>blockrss2_0a1c629f0e86804a9e165f4b1ee399b7'] = 'Error: RSS feed en \"blockrss\" módulo: %s'; $_MODULE['<{blockrss2}prestashop>blockrss2_10fd25dcd3353c0ba3731d4a23657f2e'] = 'No se han añadido fuentes RSS'; Eliminar el: /blockrss2/config.xml ya que cuando lo instalemos el duplicado de forma automático. --- Ultimo paso comprimir el directorio blockrss2 a blockrss2.zip Ahora lo subes desde la pestaña "Módulos -> Módulos" despues lo pruebo!! haber si tengo suerte xDxD Gracias una vez mas NADIE, por cierto avisa a que foro te vas pa ir cambiando el sistema xDxD xq no se que va a ser esto si ti xDxd Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 No descarto que se haya colado algo, aunque creo haberlo probado el duplicado y en principio parece que funciona xD Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 Ah y te dire un truco, si vas a cambiar una palabra por otra y ves que se repite muchas veces, siempre puedes usar el boton de "Buscar - Reemplazar" del editor que estés usando, que normalmente todos los editores llevan alguno. Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 Ah y te dire un truco, si vas a cambiar una palabra por otra y ves que se repite muchas veces, siempre puedes usar el boton de "Buscar - Reemplazar" del editor que estés usando, que normalmente todos los editores llevan alguno. Graciass, ya utilizaba intentando cambiarlo antes de pregutar aqui Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 Graciass, ya utilizaba intentando cambiarlo antes de pregutar aqui jajaj, nunca se sabe. Bueno, haz las cosas con paciencia y con amor, a ver si consigues duplicar el modulo que quieres duplicar. (Ahí algunos modulos que llevan mas cosas y por tanto a que tocar mas cosas, el ejemplo que te puse es uno de lo mas basicos) Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 Pues aqui hay mas cosas de las que me dices!! xDxDacabo de hacer el intento y me ha salio rana....parece ser que tiene mas cosas que cambiar Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 Pues aqui hay mas cosas de las que me dices!! xDxD acabo de hacer el intento y me ha salio rana.... parece ser que tiene mas cosas que cambiar ¿Entonces fracaso absoluto? ¿Se puede saber al menos el nombre del módulo que intentas duplicar? Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 ¿Entonces fracaso absoluto? ¿Se puede saber al menos el nombre del módulo que intentas duplicar? ctk_weeklydeal Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 ctk_weeklydeal alguien disponible para hacerle la modificacion al modulo? xDxD Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 ctk_weeklydeal ¿Ese no es un modulo de pago? ¿Porque no se lo pides al autor como es logico y normal? Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 ¿Ese no es un modulo de pago? ¿Porque no se lo pides al autor como es logico y normal? Porque como logico y normal, el modulo debia de funcionar bien y tuve que apañarmelas para que funcionara,,,, vamos, que da soporte practicamente Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 Porque como logico y normal, el modulo debia de funcionar bien y tuve que apañarmelas para que funcionara,,,, vamos, que da soporte practicamente Hola, Si quieres, le envió un privado al autor para que se pase por el tema y así el puede ayudarte mejor. Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 Hola, Si quieres, le envió un privado al autor para que se pase por el tema y así el puede ayudarte mejor. No es necesario, despues del mal servicio que me dio, prefiero buscar a un programador que me lo haga aunque tenga que pagarle la hora de trabajo... Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 No es necesario, despues del mal servicio que me dio, prefiero buscar a un programador que me lo haga aunque tenga que pagarle la hora de trabajo... ¿Estamos hablando de este usuario http://www.prestashop.com/forums/user/286411-cotoko/ ? (Desconozco el tipo de servicio te dio, pero vamos es importante conocer los dos puntos de vista (soy palomita suelta xD) Hablando del tema, yo no tengo problema en enviarle un privado, y le comento pues simplemente que quieres colocar varias veces el modulo en la web, a ver que te comenta. (Creo que no se pierde nada) Link to comment Share on other sites More sharing options...
antonio4287 Posted October 24, 2013 Author Share Posted October 24, 2013 ¿Estamos hablando de este usuario http://www.prestashop.com/forums/user/286411-cotoko/ ? (Desconozco el tipo de servicio te dio, pero vamos es importante conocer los dos puntos de vista (soy palomita suelta xD) Hablando del tema, yo no tengo problema en enviarle un privado, y le comento pues simplemente que quieres colocar varias veces el modulo en la web, a ver que te comenta. (Creo que no se pierde nada) La firma del modulo es suya, el soporte no se si es suyo o de la web que lo comercializa Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 La firma del modulo es suya, el soporte no se si es suyo o de la web que lo comercializa No te preocupes, le envío un privado y que se pase por el tema, tampoco perdemos nada. Link to comment Share on other sites More sharing options...
nadie Posted October 24, 2013 Share Posted October 24, 2013 (Ya esta el privado enviado) Link to comment Share on other sites More sharing options...
antonio4287 Posted October 25, 2013 Author Share Posted October 25, 2013 Nadie poca solucion hay parece no?? xDxD Link to comment Share on other sites More sharing options...
antonio4287 Posted October 26, 2013 Author Share Posted October 26, 2013 Alguien puede indicarme como duplicar el modulo????? Link to comment Share on other sites More sharing options...
nadie Posted October 26, 2013 Share Posted October 26, 2013 Yo ya te mostré un ejemplo, lo que no puedo hacer bajo ningún concepto es duplicarte un modulo que has comprado y adquirido, al menos de forma publica y por privado tampoco, por que ya no estoy activo en el foro ni en este mundo, si usted desea contactar con alguna persona, crea un tema nuevo aquí: http://www.prestashop.com/forums/forum/101-petición-de-ofertas-y-prestaciones/ y crea una peticion gratuita o de pago. Este tema lo cierro ya que Cotoko, al menos no ha podido contestar, y si el autor no quiere hacerlo tendrás que buscar a alguna persona que te ayude. Saludos, Link to comment Share on other sites More sharing options...
Recommended Posts