kink Posted January 31, 2009 Share Posted January 31, 2009 Tout est dans le titre:Voici les modifications à effectuer:Dans product-sort.phpAjouter après la ligne 7 ($orderWay = ...): $orderNewProductsBy = Tools::strtolower(Tools::getValue('ordernewproductsby', $orderByValues[intval(Configuration::get('PS_NEW_PRODUCTS_ORDER_BY'))])); $orderNewProductsWay = Tools::strtoupper(Tools::getValue('ordernewproductsway', $orderWayValues[intval(Configuration::get('PS_NEW_PRODUCTS_ORDER_WAY'))])); if (!in_array($orderNewProductsBy, $orderByValues)) $orderNewProductsBy = $orderByValues[0]; if (!in_array($orderNewProductsWay, $orderWayValues)) $orderNewProductsWay = $orderWayValues[0]; Ajouter après la ligne 21 ( 'orderway' => $orderWay,): 'ordernewproductsby' => $orderNewProductsBy, 'ordernewproductsway' => $orderNewProductsWay, Dans le fichier new-products.phpremplacer la ligne 11 par: 'products' => Product::getNewProducts(intval($cookie->id_lang), intval($p) - 1, intval($n), false, $orderNewProductsBy, $orderNewProductsWay), Dans votre admin/tabs/AdminPPreferences.phpInsérer le code suivant entre la ligne 44 ('PS_PRODUCTS_ORDER_WAY' => ...) :et 45 ('PS_IMAGE_GENERATION_METHOD' => ...) : 'PS_NEW_PRODUCTS_ORDER_BY' => array('title' => $this->l('Default new products order by:'), 'desc' => $this->l('Default order by for new products list'), 'type' => 'select', 'list' => array( array('id' => '0', 'name' => $this->l('Product name')), array('id' => '1', 'name' => $this->l('Product price')), array('id' => '2', 'name' => $this->l('Product added date')), array('id' => '4', 'name' => $this->l('Position inside category')), array('id' => '5', 'name' => $this->l('Manufacturer')), array('id' => '3', 'name' => $this->l('Product modified date')) ), 'identifier' => 'id'), 'PS_NEW_PRODUCTS_ORDER_WAY' => array('title' => $this->l('Default new products order way:'), 'desc' => $this->l('Default order way for new products list'), 'type' => 'select', 'list' => array(array('id' => '0', 'name' => $this->l('Ascending')), array('id' => '1', 'name' => $this->l('Decreasing'))), 'identifier' => 'id'), Dans classes/Product.php (function getNewProducts)//Correction bug paginationremplacer les lignes 903 (if ($count)) à 911 par: if ($count) { $result = Db::getInstance()->getRow(' SELECT COUNT(`id_product`) AS nb FROM `'._DB_PREFIX_.'product` WHERE `active` = 1 AND DATEDIFF(`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0'); return intval($result['nb']); } Dans votre theme, dans le fichier product-sort.tplInsérer après la ligne 21 (addSortDetails($request, 'date_add', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'date_add' AND $orderway eq 'DESC'}selected="selected"{/if}>{l s='last added first'}[/code] Faire une copie du fichier product-sort.tpl et renommer cette copie en new-product-sort.tplEnsuite remplacer tous les $orderby par $ordernewproductsbytous les $orderway par $ordernewproductswayet tous les addSortDetails en addNewProductsSortDetailsDans votre fichier theme/new-products.tplRemplacer la ligne 7 ( {include file=$tpl_dir./product-sort.tpl}) par: {include file=$tpl_dir./new-product-sort.tpl} Dans le fichier classes/Link.phpAjouter après la fonction addSortDetails (ligne 165 à 168) public function addNewProductsSortDetails($url, $ordernewproductsby, $ordernewproductsway) { return $url.(!strstr($url, '?') ? '?' : '&').'ordernewproductsby='.urlencode($ordernewproductsby).'&ordernewproductsway;='.urlencode($ordernewproductsway); } Ensuite vous pourrez choisir le tri à attribuer par défaut au site et aux nouveaux produits dans la partie administration/Préférences/Produits.Le texte sera en anglais, il faut le traduire en utilisant l'onglet outils traduction. Link to comment Share on other sites More sharing options...
kink Posted January 31, 2009 Author Share Posted January 31, 2009 Voici les fichiers modifiés:Dans les classes:Classes/Product.phpClasses/Link.phpZippé dans new.tpl.zip car impossible d'uploader un fichier tplA copier dans votre theme:new-products.tplnew-product-sort.tplproduct-sort.tpl Product.php Link.php new.tpl.zip Link to comment Share on other sites More sharing options...
kink Posted January 31, 2009 Author Share Posted January 31, 2009 Ainsi que:Dans la racine:new-products.phpproduct-sort.phpnew-product-sort.phpDans la partie admin/tabsAdminPPreferences.phpVous pouvez voir le résultat sur http://www.deko-flammes.com/ product-sort.php new-products.php new-product-sort.php AdminPPreferences.php Link to comment Share on other sites More sharing options...
jolvil Posted January 31, 2009 Share Posted January 31, 2009 Bravo ! :-) Pas si simple que ca comme modif ! mais bien utile Link to comment Share on other sites More sharing options...
myname Posted January 31, 2009 Share Posted January 31, 2009 Bonjour .... merci! Félicitations pour votre merveilleux site. Deux questions: 1) où vous trouverez le bloc "guides" J'ai vu sur votre site?2) Où puis-je trouver le bloc "éditorial" configuré comme le vôtre? Merci Link to comment Share on other sites More sharing options...
kink Posted January 31, 2009 Author Share Posted January 31, 2009 Bonjour …. merci! Félicitations pour votre merveilleux site. Deux questions:1) où vous trouverez le bloc “guides” J’ai vu sur votre site?2) Où puis-je trouver le bloc “éditorial” configuré comme le vôtre?Merci Bonjour,Merci ca fait toujours plaisir à entendre 1) Le block guide est un block que j'ai créé et que je n'ai pas partagé car je rentre les informations directement dans le fichier, il n'y a aucun assistant, aucun automatisme et il n'est donc pas pratique si vous souhaitez créer de nombreux guides.2) Pour la page d'accueil, j'ai en fait directement modifié le fichier index.tpl dans le theme. Link to comment Share on other sites More sharing options...
anniebel Posted April 7, 2009 Share Posted April 7, 2009 Wow, excellent travail, rien n'a été oublié... Merci d'avoir pris le temps de partager la méthode!c'est vraiment apprécié :-) Link to comment Share on other sites More sharing options...
SupoWeb Posted July 10, 2009 Share Posted July 10, 2009 Un grand merci pour la méthode, ca fonctionne impec ! Link to comment Share on other sites More sharing options...
davidan Posted October 1, 2009 Share Posted October 1, 2009 Bonjour kink,J'ai visiter ton site, et les tag en 3D c'est génial... Tu peux me dire comment tu as fait ? Je veux le même !Sinon je vais tester les modif du block new product, en espérant que ça marche.Merci Link to comment Share on other sites More sharing options...
jolvil Posted October 1, 2009 Share Posted October 1, 2009 attention la modif est valable pour la version 1.1 de Prestashop, pour d'autres versions il y a probablement des adaptations ! Link to comment Share on other sites More sharing options...
justincarton Posted August 5, 2011 Share Posted August 5, 2011 Et pour la version 1.4.4 de prestashop? Comment peut on faire pour afficher les produits de la page "nouveaux produits" par date d'ajout, c'est à dire, les nouveaux produits en premiers et non l'inverse? Car pour les modifs fournies içi, les pages de prestashop 1.4.4 n'ont plus iren à voir... Merci Link to comment Share on other sites More sharing options...
jolvil Posted August 5, 2011 Share Posted August 5, 2011 Et oui c'est bien dommage que Prestashop ne permette toujours pas le classement des nouveaux produits par dernier produit ajouté indépendament du mode de tri de la boutique. Prestashop a évolué depuis cette proposition de code qui fonctionnait bien sous 1.1... Link to comment Share on other sites More sharing options...
shroom Posted October 9, 2011 Share Posted October 9, 2011 Pour ce qui est de PS v1.4.4.x, j'ai rajouté la ligne suivante dans product-sort.tpl pour bénéficier du tri par nouveautés : <option value="date_add:desc" {if $orderby eq 'date_add' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Newly added'}</option> Link to comment Share on other sites More sharing options...
scoobi Posted November 19, 2011 Share Posted November 19, 2011 Pour la V1.3.7.0 voici la ligne à ajouter <option value="{$link->addSortDetails($request, 'date_add', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'date_add' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Newly added'}</option> Link to comment Share on other sites More sharing options...
diabolyo Posted January 10, 2012 Share Posted January 10, 2012 Pour ce qui est de PS v1.4.4.x, j'ai rajouté la ligne suivante dans product-sort.tpl pour bénéficier du tri par nouveautés : <option value="date_add:desc" {if $orderby eq 'date_add' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Newly added'}</option> Bonjour, Vous avez rajouté cette ligne à quel endroit dans le tpl, chez moi ça ne marche pas… (1.4.4.2) Merci ! Link to comment Share on other sites More sharing options...
leaven Posted January 18, 2012 Share Posted January 18, 2012 Bonjour shroom, Oui, quel est le numéro de la ligne sous 1.4.4.x ou il faut rajouter cette ligne dans le fichier tpl : <option value="date_add:desc" {if $orderby eq 'date_add' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Newly added'}</option> Merci car je n'arrive pas à trouver.. Link to comment Share on other sites More sharing options...
Pyssou Posted August 30, 2012 Share Posted August 30, 2012 Bonsoir, si quelqu'un cherche encore où ajouter la ligne dans prestashop 1.4 c'est apres le code suivant, dans le fichier /prestashop/themes/votretheme/product-sort.tpl {if !$PS_CATALOG_MODE} <option value="price:asc" {if $orderby eq 'price' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Price: lowest first'}</option> <option value="price:desc" {if $orderby eq 'price' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Price: highest first'}</option> {/if} <option value="name:asc" {if $orderby eq 'name' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Product Name: A to Z'}</option> <!-- <option value="name:desc" {if $orderby eq 'name' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Product Name: Z to A'}</option>--> {if !$PS_CATALOG_MODE} <option value="quantity:desc" {if $orderby eq 'quantity' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='In-stock first'}</option> {/if} N'oublier pas d'effacer les caches dans /prestashop/tools/smarty/compile et dans /prestashop/tools/smarty/cache pour voir l'effet Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now