noexperience Posted August 13, 2009 Share Posted August 13, 2009 hy,any ideea how to sort manufacturer ?I have for example Apple, Compaq, IbmNormaly the block apper:AppleCompaqIbm-other-but i want for exampleIbmAppleCompaq-other-i want a soluttion but not to rename like (01.Ibm, 02.Compaq, 03.Ibm.....) Link to comment Share on other sites More sharing options...
noexperience Posted August 18, 2009 Author Share Posted August 18, 2009 nodody?another problem, or ideeain mysql my ps_manufactures appears like below:1. Compaq2. Ibm3. Applei dont sort alphabeticaly when put in block manufactureshow can i do that? Link to comment Share on other sites More sharing options...
blaszta Posted August 19, 2009 Share Posted August 19, 2009 Try to rename the actual manufacturer name like:01. Ibm02. Compaqand so onThe "01. " you add in front of the name will be automatically hid by Prestashop in the front store. Link to comment Share on other sites More sharing options...
noexperience Posted August 19, 2009 Author Share Posted August 19, 2009 haw can i make prestastore DO NOT SORT manufacture list? Link to comment Share on other sites More sharing options...
blaszta Posted August 19, 2009 Share Posted August 19, 2009 Then you must edit /classes/Manufacturer.phpFind lines that contains "ORDER BY m.`name` ASC" end remove it.On ver 1.2.1 it's on line 166: $sql.= ' ORDER BY m.`name` ASC'.($p ? ' LIMIT '.((intval($p) - 1) * intval($n)).','.intval($n) : ''); change to $sql.= ' '.($p ? ' LIMIT '.((intval($p) - 1) * intval($n)).','.intval($n) : ''); Don't forget to backup the original file first.I advice you do my first suggestion, since this modification will lost/not work in the next version/update. 2 Link to comment Share on other sites More sharing options...
noexperience Posted August 19, 2009 Author Share Posted August 19, 2009 Super workingi modify structures of ps_manufactures, adding a field SORT varchar(2)after that i create a index on this fieldexample: id_manufacturer name sort1 APPLE 22 IBM 13 COMPAQ 44 HP 3 after that i make change described at #4 but i changhed with $sql.= ' ORDER BY m.`sort` ASC'.($p ? ' LIMIT '.((intval($p) - 1) * intval($n)).','.intval($n) : ''); and my manufactures block appear like below:IBMAPPLEHPCOMPAQ Link to comment Share on other sites More sharing options...
olivierl Posted February 18, 2010 Share Posted February 18, 2010 I, i'm look for a solution to sort the manufacturers list too. I try to rename its as : "01. ManufacturerName", but the "xx." appears in the select list.Is somebody now how to hide it ?Thks ! Link to comment Share on other sites More sharing options...
rocky Posted February 18, 2010 Share Posted February 18, 2010 Change lines 30-36 of modules/blockmanufacturer/blockmanufacturer.php from: $smarty->assign(array( 'manufacturers' => Manufacturer::getManufacturers(), 'link' => $link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), )); to something like: $manufacturers = Manufacturer::getManufacturers(); for ($i = 0; $i < sizeof($manufacturers); $i++) $manufacturers[$i]['name'] = Category::hideCategoryPosition($manufacturers[$i]['name']); $smarty->assign(array( 'manufacturers' => $manufacturers, 'link' => $link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), )); This should hide the number prefix. Link to comment Share on other sites More sharing options...
zaibot Posted March 29, 2010 Share Posted March 29, 2010 GREAT! This works perfect - thanks a lot Link to comment Share on other sites More sharing options...
Attila Bogozi Posted April 3, 2010 Share Posted April 3, 2010 interesting ideas here....but what if I want to hide the MANUFACTURERS block on the front end?thanks a lot..REZOLVED.....sorry for posting....As I'm new to Prestashop, I am just discovering the features of this great e-commerce open source. Link to comment Share on other sites More sharing options...
Jero Posted July 18, 2012 Share Posted July 18, 2012 (edited) Change lines 30-36 of modules/blockmanufacturer/blockmanufacturer.php from: $smarty->assign(array( 'manufacturers' => Manufacturer::getManufacturers(), 'link' => $link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), )); to something like: $manufacturers = Manufacturer::getManufacturers(); for ($i = 0; $i < sizeof($manufacturers); $i++) $manufacturers[$i]['name'] = Category::hideCategoryPosition($manufacturers[$i]['name']); $smarty->assign(array( 'manufacturers' => $manufacturers, 'link' => $link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), )); This should hide the number prefix. Thanks for the tip! But I'm having the same issue with blocklayered block. Blocklayered is still showing number prefixes. And since the code in /modules/blocklayered/blocklayered.php are totatly different than in modules/blockmanufacturer/blockmanufacturer.php I'm wondering if there is any way to implement this fix to the blocklayered? Edited July 18, 2012 by Jero (see edit history) Link to comment Share on other sites More sharing options...
hitomiie Posted January 24, 2013 Share Posted January 24, 2013 Hi everyone, is there a solution for Prestashop 1.5 ? I've tried to adapt the solutions in this topic, but with no result. Thanks for your help (any help ) Link to comment Share on other sites More sharing options...
vinichthus Posted February 1, 2013 Share Posted February 1, 2013 Hi hitomile, I'm using version 1.5 and for me the solution has been application for 3 things: 1. Add the code in the modules/blockmanufacturer/blockmanufacturer.php as described above, but swapping Category::hideCategoryPosition by self::hideCategoryPosition in the function show it (be sure to put a new function we create called getManufacturersRand, instead of getManufacturers): $manufacturers = Manufacturer::getManufacturers(); for ($i = 0; $i < sizeof($manufacturers); $i++) $manufacturers[$i]['name'] = self::hideCategoryPosition($manufacturers[$i]['name']); $this->smarty->assign(array( 'manufacturers' => Manufacturer::getManufacturersRand(), 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS'), )); 2. In the same file, insert the function: (because the function hideCategoryPosition() is obsolete for the 1.5) public static function hideCategoryPosition($name) { return preg_replace('/^[0-9]+\./', '', $name); } 3. Now, insert a new function in the classes/Manufacturer.php, to sort the manufacture randomly: public static function getManufacturersRand($get_nb_products = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_group = false) { if (!$id_lang) $id_lang = (int) Configuration::get('PS_LANG_DEFAULT'); $sql = 'SELECT m.*, ml.`description`'; $sql.= ' FROM `' . _DB_PREFIX_ . 'manufacturer` m LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer_lang` ml ON (m.`id_manufacturer` = ml.`id_manufacturer` AND ml.`id_lang` = ' . (int) ($id_lang) . ') ' . ($active ? ' WHERE m.`active` = 1' : ''); $sql.= ' ORDER BY RAND()' . ($p ? ' LIMIT ' . (((int) ($p) - 1) * (int) ($n)) . ',' . (int) ($n) : ''); $manufacturers = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if ($manufacturers === false) return false; if ($getNbProducts) { $sqlGroups = ''; if (!$all_group) { $groups = FrontController::getCurrentCustomerGroups(); $sqlGroups = (count($groups) ? 'IN (' . implode(',', $groups) . ')' : '= 1'); } foreach ($manufacturers as $key => $manufacturer) { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT p.`id_product` FROM `' . _DB_PREFIX_ . 'product` p LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` as m ON (m.`id_manufacturer`= p.`id_manufacturer`) WHERE m.`id_manufacturer` = ' . (int) ($manufacturer['id_manufacturer']) . ($active ? ' AND p.`active` = 1 ' : '') . ($all_group ? '' : ' AND p.`id_product` IN ( SELECT cp.`id_product` FROM `' . _DB_PREFIX_ . 'category_group` cg LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` ' . $sqlGroups . ')')); $manufacturers[$key]['nb_products'] = sizeof($result); } } for ($i = 0; $i < sizeof($manufacturers); $i++) if ((int) (Configuration::get('PS_REWRITING_SETTINGS'))) $manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name'], false); else $manufacturers[$i]['link_rewrite'] = 0; return $manufacturers; } it is. work for me. excuse the bad english. Link to comment Share on other sites More sharing options...
japanimeshop Posted February 20, 2013 Share Posted February 20, 2013 (edited) can someone help me with disabling alphabetic list. im trying to have it list after ive rearranged them in the manufacture list. ////****** UPDATE******///// NM I FIGURED IT OUT!! thanks! Edited February 20, 2013 by japanimeshop (see edit history) Link to comment Share on other sites More sharing options...
Paldru Posted April 12, 2013 Share Posted April 12, 2013 Would it be possible to change something in /classes/Manufacturer.php for Prestashop 1.5.3 that would sort the Manufacturers by the position they have in the back office? There is some "position" talk in the code of the Manufacturer.php if (empty($order_by) || $order_by == 'position') $order_by = 'name'; if (empty($order_way)) $order_way = 'ASC'; Anyone? Link to comment Share on other sites More sharing options...
louissss Posted June 4, 2013 Share Posted June 4, 2013 Try to rename the actual manufacturer name like: 01. Ibm 02. Compaq and so on The "01. " you add in front of the name will be automatically hid by Prestashop in the front store. I just tried this it doesn't work , prestashop does not hide the number....am I missing anything? (prestashop 1.5) Link to comment Share on other sites More sharing options...
J-works.cz Posted November 23, 2014 Share Posted November 23, 2014 (edited) I have another solution. [sOLVED] Block Manufacturer my specific order (without rename like 01, 02, 03 ..) http://www.prestashop.com/forums/topic/382961-solved-block-manufacturer-my-specific-order-without-rename-like-01-02-03/?p=1876531 Edited November 23, 2014 by J-works.cz (see edit history) Link to comment Share on other sites More sharing options...
fransjaeger Posted March 28, 2015 Share Posted March 28, 2015 I have made a module for this purpose. For ps version 1.6+ Send me a PM if youre interested. Link to comment Share on other sites More sharing options...
Recommended Posts