Jump to content

michael_villeneuve

Members
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • Location
    Bruges
  • Activity
    Freelancer

michael_villeneuve's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Pense bien a rajouter le script de la fin dans product list, tout en bas du fichier a partir du commentaire productlist
  2. Fistou69 de rien, content que cela ai fonctionné! Mizou125, est tu bien en 1.5.4 ? Ah tu bien changé le code php?
  3. Salut Fistou 69 voici le code des fichiers modifiés : categorycontroller.php : class CategoryControllerCore extends FrontController { public $php_self = 'category'; protected $category; public $customer_access = true; /** * Set default medias for this controller */ public function setMedia() { parent::setMedia(); if ($this->context->getMobileDevice() == false) { //TODO : check why cluetip css is include without js file $this->addCSS(array( _THEME_CSS_DIR_.'scenes.css' => 'all', _THEME_CSS_DIR_.'category.css' => 'all', _THEME_CSS_DIR_.'product_list.css' => 'all', )); if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0) $this->addJS(_THEME_JS_DIR_.'products-comparison.js'); } } public function canonicalRedirection($canonicalURL = '') { if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop()) { $this->redirect_after = '404'; $this->redirect(); } if (!Tools::getValue('noredirect') && Validate::isLoadedObject($this->category)) parent::canonicalRedirection($this->context->link->getCategoryLink($this->category)); } /** * Initialize category controller * @see FrontController::init() */ public function init() { // Get category ID $id_category = (int)Tools::getValue('id_category'); if (!$id_category || !Validate::isUnsignedId($id_category)) $this->errors[] = Tools::displayError('Missing category ID'); // Instantiate category $this->category = new Category($id_category, $this->context->language->id); parent::init(); //check if the category is active and return 404 error if is disable. if (!$this->category->active) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } //check if category can be accessible by current customer and return 403 if not if (!$this->category->checkAccess($this->context->customer->id)) { header('HTTP/1.1 403 Forbidden'); header('Status: 403 Forbidden'); $this->errors[] = Tools::displayError('You do not have access to this category.'); $this->customer_access = false; } } public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'category.tpl'); if (!$this->customer_access) return; if (isset($this->context->cookie->id_compare)) $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); $this->productSort(); // Product sort must be called before assignProductList() $this->assignScenes(); $this->assignSubcategories(); if ($this->category->id != 1) $this->assignProductList(); $this->context->smarty->assign(array( 'category' => $this->category, 'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null, 'id_category' => (int)$this->category->id, 'id_category_parent' => (int)$this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath($this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize(ImageType::getFormatedName('category')), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'thumbSceneSize' => Image::getSize(ImageType::getFormatedName('m_scene')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'allow_oosp' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers() )); } /** * Assign scenes template vars */ protected function assignScenes() { // Scenes (could be externalised to another controler if you need them) $scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false); $this->context->smarty->assign('scenes', $scenes); // Scenes images formats if ($scenes && ($sceneImageTypes = ImageType::getImagesTypes('scenes'))) { foreach ($sceneImageTypes as $sceneImageType) { if ($sceneImageType['name'] == ImageType::getFormatedName('m_scene')) $thumbSceneImageType = $sceneImageType; elseif ($sceneImageType['name'] == ImageType::getFormatedName('scene')) $largeSceneImageType = $sceneImageType; } $this->context->smarty->assign(array( 'thumbSceneImageType' => isset($thumbSceneImageType) ? $thumbSceneImageType : null, 'largeSceneImageType' => isset($largeSceneImageType) ? $largeSceneImageType : null, )); } } /** * Assign sub categories templates vars */ protected function assignSubcategories() { if ($subCategories = $this->category->getSubCategories($this->context->language->id)) { $this->context->smarty->assign(array( 'subcategories' => $subCategories, 'subcategories_nb_total' => count($subCategories), 'subcategories_nb_half' => ceil(count($subCategories) / 2) )); } } /** * Assign list of products template vars */ public function assignProductList() { $hookExecuted = false; Hook::exec('actionProductListOverride', array( 'nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted, )); // The hook was not executed, standard working if (!$hookExecuted) { $this->context->smarty->assign('categoryNameComplement', ''); $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); $image_array=array(); for($i=0;$i<count($this->cat_products);$i++) { //Change 3 with the number of images you want to display $image_array[$i]= $this->category->getProductsimg($this->cat_products[$i]['id_product'],3); } self::$smarty->assign('productimg',(isset($image_array) AND $image_array) ? $image_array : NULL); } // Hook executed, use the override else // Pagination must be call after "getProducts" $this->pagination($this->nbProducts); foreach ($this->cat_products as &$product) { if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) $product['minimal_quantity'] = $product['product_attribute_minimal_quantity']; } $this->context->smarty->assign('nb_products', $this->nbProducts); } } Colle le code ci-dessus à la place de ce qu'il y dans categorycontroller, à partir du haut, après les commentaires. Et le code ci-dessus c'est product-lit.tpl en entier : {* * 2007-2012 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2012 PrestaShop SA * @version Release: $Revision: 7457 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {if isset($products)} <!-- Products list --> <ul id="product_list" class="clear"> {foreach from=$products item=product name=products} <li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} clearfix"> <div class="left_block"> {if isset($comparator_max_item) && $comparator_max_item} <p class="compare"> <input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked="checked"{/if} /> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label> </p> {/if} </div> <div class="center_block"> <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"> {foreach from=$productimg key=key1 item=pimage} {foreach from=$pimage key=key2 item=pimage2} {if $product.id_product==$pimage2.id_product} <img src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$pimage2.id_image, '')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} style="width:300px;height:300px"{/if} class="{$key2}" /> {/if} {/foreach} {/foreach} </a> <h3><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'|truncate:35:'...'}</a></h3> <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}" >{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}</a></p> </div> <div class="right_block"> {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span> {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if} {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} <div class="content_price"> {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span><br />{/if} {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if} </div> {if isset($product.online_only) && $product.online_only}<span class="online_only">{l s='Online only!'}</span>{/if} {/if} {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {if ($product.allow_oosp || $product.quantity > 0)} {if isset($static_token)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", false)}" title="{l s='Add to cart'}" style=" padding-left: 15px;"><span></span>{l s='Add to cart'}</a> {else} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", false)} title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a> {/if} {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} {/if} <a class="button lnk_view" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a> </div> </li> {/foreach} </ul> <!-- /Products list --> {/if} {literal} <script type="text/javascript"> $(document).ready(function(){ $(".1").hide(); $("img.0").mouseover(function(){ if ( $(this).next("img").length > 0 ) { $(this).next("img").show(); $(this).hide(); } }); $(".1").mouseout(function(){ $(this).hide(); $(this).prev("img").show(); }); }); </script> {/literal} Il se peut que tu aies quelques bugs avec les tailles d'images. Je te laisse modifier "widht" et "height" à ta guise. Personnellement ça a marché pour moi. Remplace chaque fichiers : categorycontroller est dans controller/front/ et product list est dans les fichiers de ton thème. Oublie pas de remplacer "homesize" et large_default par la taille d'image que tu souhaites !
  4. Salut, tu ne te poses surement plus la question mais la réponse se trouve simplement dans le BO, tu vas dans catégorie puis "modifier." Cela va modifier la catégorie générale qui par défaut est appelée "Accueil". Cela changera ensuite le nom dans le menu haut horizontal. Si ça ne te sert pas à toi ça sera surement utile à d'autres. Cdlt
  5. Bon après de longues heures de recherche j'ai finalement trouvé solution ici : http://www.prestashop.com/forums/topic/216150-aporte-rollover-de-imagenes-en-la-product-list/, en éspérant que cela serve à quelqu'un ! Cela fonctionne parfaitement pour moi sur la version 1.5.4 ! À voir ici : http://popelin.es/tienda/es/9-bisuteria-mujeres-popelin-texturas-colores
  6. Last up and I give up .. Please, anyone.. I've posted the code above so you can find out the problem..Thank you anyway..
  7. Well it doesn't change anything, when I inspect each image I can see the "onmouseover" but its link is the same as the normal image. Here is my link.php : public function getImageLink($name, $ids, $type = null, $idOver= 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($idOver)){ $result = Db::getInstance()->ExecuteS('SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_product = '.$idOver.' AND position = 2'); foreach ($result as $row) $id_image_over = $row['id_image']; }else{ $id_image_over = 0; } if($id_image_over != 0){ $id_image = $id_image_over; } 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; } public function getMediaLink($filepath) { return Tools::getProtocol().Tools::getMediaServer($filepath).$filepath; } and here is the code of the image in product-list.tpl : <img onmouseover="this.src='{$link->getImageLink($product.link_rewrite, $product.id_image, 'large', $product.id_product)}'" onmouseout="this.src='{$link->getImageLink($product.link_rewrite, $product.id_image, 'large_default')}'" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'large_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$largeSize.width}" height="{$largeSize.height}"{/if} /> thank you :-)
  8. Yes sure, but the code php has not been modified on this theme, only the css, and the code of the two important files to create the effect are the same as on the default theme... :/
  9. Hi, I've tried many of these solutions, but none of these are working for me. The onmouseover of the AT2's solution is just creating the same link as the initial src. In fact it has not changed anything... Any idea ? Here is the link to the page http://popelin.es/tienda/index.php?id_category=9&controller=category&id_lang=3. My prestashop version is 1.5.4.1 . Thank you in advance...
×
×
  • Create New...