KarlTheKnife Posted January 3, 2011 Share Posted January 3, 2011 he therei'm currently working on a music distribution webshop.i use supplier.php to display "all labels" and manufacturers.php for "all artists"i'm rooted to the spot that manufacturers.php & suppliers.php display the max. defined amountof displayed products (=12) is it possible to display all entries on one page ?i've attached an image of the current situation.i've already blocked the images.regardskarl Link to comment Share on other sites More sharing options...
zwacklmann Posted January 9, 2011 Share Posted January 9, 2011 The output of supplier-list.tpl and manufacturer-list.tpl is both generated in supplier.php.In that file find the following portion of code: $data = call_user_func(array($className, 'get'.$className.'s'), true, intval($cookie->id_lang), true, $p, $n); $imgDir = $objectType == 'supplier' ? _PS_SUPP_IMG_DIR_ : _PS_MANU_IMG_DIR_; foreach ($data AS &$item) $item['image'] = (!file_exists($imgDir.'/'.$item['id_'.$objectType].'-medium.jpg')) ? Language::getIsoById(intval($cookie->id_lang)).'-default' : $item['id_'.$objectType]; $smarty->assign(array( 'pages_nb' => ceil($nbProducts / intval($n)), 'nb'.$className.'s' => $nbProducts, 'mediumSize' => Image::getSize('medium'), $objectType.'s' => $data )); $smarty->display(_PS_THEME_DIR_.$objectType.'-list.tpl'); Now swap all the $n variables for the specific number of manufacturers you want displayed eg 1000: $data = call_user_func(array($className, 'get'.$className.'s'), true, intval($cookie->id_lang), true, $p, '1000'); $imgDir = $objectType == 'supplier' ? _PS_SUPP_IMG_DIR_ : _PS_MANU_IMG_DIR_; foreach ($data AS &$item) $item['image'] = (!file_exists($imgDir.'/'.$item['id_'.$objectType].'-medium.jpg')) ? Language::getIsoById(intval($cookie->id_lang)).'-default' : $item['id_'.$objectType]; $smarty->assign(array( 'pages_nb' => ceil($nbProducts / intval('1000')), 'nb'.$className.'s' => $nbProducts, 'mediumSize' => Image::getSize('medium'), $objectType.'s' => $data )); $smarty->display(_PS_THEME_DIR_.$objectType.'-list.tpl'); ...and you're done. Link to comment Share on other sites More sharing options...
zwacklmann Posted January 9, 2011 Share Posted January 9, 2011 There still is a slight little problem:The interval for displaying pagination page content is adjusted as described above. But the interval for creating the pagination links is apparently not affected. Resulting in non functional pagination links to show up on the page. Assistance needed!For the time being you problem can be solved removing the pagination call from your theme's manufacturer-list.tpl and supplier-list.tpl.That is this little snippet: {include file=$tpl_dir./pagination.tpl} Link to comment Share on other sites More sharing options...
silencl Posted February 21, 2011 Share Posted February 21, 2011 Thanks for sharing. Works well Just want to say, the code is slightly different for my version of prestashop (1.3.1.1) and so it's enough to replace 2x this value: "$n" by '1000' Link to comment Share on other sites More sharing options...
faDdy Posted February 5, 2013 Share Posted February 5, 2013 prestashop version 1.4.8.2 & 1.4.9 you have to modify classes/manufacturer.php search for variable $n and replace it to any higher number e.g, 1000 Thanks to zwacklmann 1 Link to comment Share on other sites More sharing options...
studioneko Posted March 31, 2013 Share Posted March 31, 2013 Better to override (1.4.8 - 1.4.9) create a new file and copy paste the following: <?php class Manufacturer extends ManufacturerCore { public static function getManufacturers($getNbProducts = 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 m.`name` ASC'.($p ? ' LIMIT '.(((int)($p) - 1) * (int)(1000)).','.(int)(1000) : ''); $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); } } $rewrite_settings = (int)Configuration::get('PS_REWRITING_SETTINGS'); for ($i = 0; $i < sizeof($manufacturers); $i++) if ($rewrite_settings) $manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name'], false); else $manufacturers[$i]['link_rewrite'] = 0; return $manufacturers; } } Change the number 1000 to any number fitting your needs (the number of total objects that you want to be displayed in manufacturer-list.tpl) Save as Manufacturer.php in your /override/classes/ folder Done : ) 1 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