akzidenz Posted July 14, 2008 Share Posted July 14, 2008 Does anyone know if its possible to make the block categories module like this:- -2008 (Main Category) Accessories (Sub category) Product 1 (product) Product 2 (product) iPods (Sub category) Product 3 Laptops (Sub category Product 4 Ie. make it list the products inside the category?Thanks,Kenny. Link to comment Share on other sites More sharing options...
ejectcore Posted July 14, 2008 Share Posted July 14, 2008 This topic needs to really be moved to either the general category of this forum or feature requests :-) Currently to do what you are asking, you would need some serious modification to blockcategoryI have to say I can't really understand your reason for doing this. Would it be possible to post a link to another site with the same functionality %-P Also how many products are there going to be on this site ie. if there are more than 10 in each category maybe this will not be the correct solution.I will look into this further when you can show me another site using this method of navigation ;-) Link to comment Share on other sites More sharing options...
akzidenz Posted July 14, 2008 Author Share Posted July 14, 2008 Well, it'd be good for a sitemap at least methinks.Im not sure i've seen it elsewhere. Theres only going to be a few products per sub category, and probably no more than 10 for the whole main category.I'm looking around and might to turn this a loop, listing products of a category. Would that work?$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);Hmm.. Link to comment Share on other sites More sharing options...
ejectcore Posted July 14, 2008 Share Posted July 14, 2008 I am looking into this for you.So far if you just replace the code for this function "hookLeftColumn"Now I just have to work out a way to show this within the category tree function hookLeftColumn($params) { global $smarty; /* ONLY FOR THEME OLDER THAN v1.0 */ global $link; $smarty->assign(array( 'categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true), 'link' => $link )); /* ELSE */ //construct categories tree $rootCateg = Category::getRootCategory(); $blockCategTree = $rootCateg->recurseLiteCategTree(intval(Configuration::get('BLOCK_CATEG_MAX_DEPTH'))); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); $products = $rootCateg->getProducts(); foreach ($products as $key => $product) { $products[$key]['name'] = str_replace('"', '\'', $product['name']); $products[$key]['name'] = htmlentities(utf8_decode($product['name'])); } if (isset($_GET['id_category'])) $smarty->assign('currentCategoryId', intval($_GET['id_category'])); $smarty->assign('products', $products); $smarty->assign('blockCategTree', $blockCategTree); $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); $smarty->assign('isDhtml', $isDhtml); /* /ONLY FOR THEME OLDER THAN v1.0 */ return $this->display(__FILE__, 'blockcategories.tpl'); } Link to comment Share on other sites More sharing options...
skyline1 Posted July 23, 2008 Share Posted July 23, 2008 Another question, if i don't want the category order by name, instead of i want category order by date: i mean by date posting, is this impossible! Thanks Link to comment Share on other sites More sharing options...
shake Posted July 23, 2008 Share Posted July 23, 2008 instead you could make the categories appear in the order you would like:01.Ztest02.Htest03.Atestcategoryjust prefix your category names with 01. etc.. might be a pain if you've already added loads of categories but any future ones will be easy Link to comment Share on other sites More sharing options...
ejectcore Posted July 23, 2008 Share Posted July 23, 2008 Simple solution for this just change the ORDER BY clause found in classes/Category.phpfor example change lines 443 - 450 to: $result = Db::getInstance()->ExecuteS(' SELECT c.`id_category`, c.`date_add` , cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category` WHERE `id_lang` = '.intval($id_lang).' AND c.`id_parent` = '.intval($id_parent).' '.($active ? 'AND `active` = 1' : '').' ORDER BY c.`date_add` DESC'); Link to comment Share on other sites More sharing options...
khuctinhsy Posted July 26, 2008 Share Posted July 26, 2008 I am looking into this for you.So far if you just replace the code for this function "hookLeftColumn"Now I just have to work out a way to show this within the category tree function hookLeftColumn($params) { global $smarty; /* ONLY FOR THEME OLDER THAN v1.0 */ global $link; $smarty->assign(array( 'categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true), 'link' => $link )); /* ELSE */ //construct categories tree $rootCateg = Category::getRootCategory(); $blockCategTree = $rootCateg->recurseLiteCategTree(intval(Configuration::get('BLOCK_CATEG_MAX_DEPTH'))); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); $products = $rootCateg->getProducts(); foreach ($products as $key => $product) { $products[$key]['name'] = str_replace('"', '\'', $product['name']); $products[$key]['name'] = htmlentities(utf8_decode($product['name'])); } if (isset($_GET['id_category'])) $smarty->assign('currentCategoryId', intval($_GET['id_category'])); $smarty->assign('products', $products); $smarty->assign('blockCategTree', $blockCategTree); $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); $smarty->assign('isDhtml', $isDhtml); /* /ONLY FOR THEME OLDER THAN v1.0 */ return $this->display(__FILE__, 'blockcategories.tpl'); } Can you show me what file to edit? Link to comment Share on other sites More sharing options...
gotstuckrecord Posted March 28, 2009 Share Posted March 28, 2009 Did you ever get round to working out how to include this in the category tree. Would be really helpful as I have a site that only has 10 products and a client who has insisted they want products available on the category tree (fewer clicks).Many thanks Link to comment Share on other sites More sharing options...
Recommended Posts