JuDrYa Posted September 19, 2014 Share Posted September 19, 2014 Hola a tod@s. Estoy intentando implementar lo siguiente en mi web... http://www.prestashop.com/forums/topic/272119-guide-rollover-images-on-product-lists/?do=findComment&comment=1362940 El primer paso seria pegar el archivo "Link.php" en "override/classes" LINK.PHP <?php class Link extends LinkCore { /** * Returns a link to a product image for display * Note: the new image filesystem stores product images in subdirectories of img/p/ * * @param string $name rewrite link of the image * @param string $ids id part of the image filename - can be "id_product-id_image" (legacy support, recommended) or "id_image" (new) * @param string $type * @param integer $rollover id of current product */ public function getImageLink($name, $ids, $type = null, $rollover = null) { $not_default = false; // legacy mode or default image $theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : ''); if ((Configuration::get('PS_LEGACY_IMAGES') && (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'))) || ($not_default = strpos($ids, 'default') !== false)) { if ($this->allow == 1 && !$not_default) $uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'; } else { // if ids if of the form id_product-id_image, we want to extract the id_image part $split_ids = explode('-', $ids); $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); $theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : ''); if(isset($rollover)) { $hover_image = Db::getInstance()->getRow('SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_product = '.$rollover.' AND position = 1'); if($hover_image) $id_image = array_shift($hover_image); else return '0'; } if ($this->allow == 1) $uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg'; } return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path; } } Pero resulta que en la ruta "override/classes" ya tengo un archivo "Link.php" la cual ya contiene la función "public function getImageLink($name, $ids, $type = null, $rollover = null)".... public function getImageLink($name, $ids, $type = NULL, $idOver= NULL) { global $protocol_content; /* CUSTOM */ if(isset($idOver)) { $result = Db::getInstance()->ExecuteS('SELECT id_image FROM ps_image WHERE id_product = '.$idOver.' AND position = 2'); foreach ($result as $row) $id_image_over = $row['id_image']; } else { $id_image_over = 0; } // legacy mode or default image if ((Configuration::get('PS_LEGACY_IMAGES') && (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'.jpg'))) || strpos($ids, 'default') !== false) { $split_ids = explode('-', $ids); $newIds1 = $split_ids[1] + 1; $idsArray = array($split_ids[0], $newIds1); $newIds = implode('-', $idsArray); if($id_image_over != 0) { $id_image = $id_image_over; if ($this->allow == 1) $uri_path = __PS_BASE_URI__.$newIds.($type ? '-'.$type : '').'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.$newIds.($type ? '-'.$type : '').'.jpg'; } else { if ($this->allow == 1) $uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').'.jpg'; } }else { // if ids if of the form id_product-id_image, we want to extract the id_image part $split_ids = explode('-', $ids); // $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); if($id_image_over != 0) { $id_image = $id_image_over; } else { $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); } if ($this->allow == 1) $uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'.jpg'; } return $protocol_content.Tools::getMediaServer($uri_path).$uri_path; } Como puedo añadir lo primero a lo segundo. Gracias. Link to comment Share on other sites More sharing options...
JuDrYa Posted September 20, 2014 Author Share Posted September 20, 2014 (edited) Up!!!! Porfa, nadie...... Estoy atrancado con esto. Edited September 20, 2014 by JuDrYa (see edit history) Link to comment Share on other sites More sharing options...
galindogadea Posted September 20, 2014 Share Posted September 20, 2014 Antes de comentarte nada, ¿El override que intentas implementar en el override que tienes creado corresponde a la misma versión de Prestashop que estas usando? Link to comment Share on other sites More sharing options...
JuDrYa Posted September 20, 2014 Author Share Posted September 20, 2014 (edited) Gracias por contestar "galindogadea". Me llevo faltal con el ingles (malo para moverte por este mundillo :unsure: ). He leido esto... http://www.prestashop.com/forums/topic/272119-guide-rollover-images-on-product-lists/?do=findComment&comment=1623687 Gracias por todo. NOTA_ La cosa es que ese override del archivo link, no lo he hecho yo, esta de la instalación de presta. No recuerdo haberlo puesto yo. Edited September 20, 2014 by JuDrYa (see edit history) Link to comment Share on other sites More sharing options...
galindogadea Posted September 20, 2014 Share Posted September 20, 2014 NOTA_ La cosa es que ese override del archivo link, no lo he hecho yo, esta de la instalación de presta. No recuerdo haberlo puesto yo. Con la instalación de Prestashop no viene ningun override, ese override se te ha instalado, al instalar algun módulo. Link to comment Share on other sites More sharing options...
JuDrYa Posted September 20, 2014 Author Share Posted September 20, 2014 Ok, no lo sabia. Uso la versión 1.6.0.6 y según ese post anterior que te puesto, si es compatible. Link to comment Share on other sites More sharing options...
galindogadea Posted September 20, 2014 Share Posted September 20, 2014 Pero lo que quieres hacer, no es lo mismo que se comenta aquí ¿http://pelechano.es/efecto-rollover-listados-prestashop-1-5-y-1-6/? (Guía en Español) Link to comment Share on other sites More sharing options...
JuDrYa Posted September 20, 2014 Author Share Posted September 20, 2014 Efectivamente, no lo habia encontrado. Pruebo y comento. _______________________________________________________ Gracias por tu tiempo. Link to comment Share on other sites More sharing options...
Recommended Posts