Jump to content

ordre des produits dans le menu


Recommended Posts

bonjour, 

j'utilise un module headerlinks qui gere le menu de mon site, or

 

il place les catégorie par ordre alphabetique et je souhaiterais pouvoir les classer comme de le souhaite.

de meme je souhaiterais placer "instruments" avant "éclairage"

 

comment faire ?

(pour précision, le tri des produits est bien à "position dans la catégorie" et je suis en 1.4.11.1.

 

merci beaucoup a ceux qui voudront bien m'aider.

Link to comment
Share on other sites

merci je pense qu'il a été créer par un tiers. je reprends le site et je n'ai pas toutes les clés.

 

comment modifier ce php ???

 

<?php
 
if (!defined('_CAN_LOAD_FILES_'))
exit;
 
class headerlinks extends Module
{
function __construct()
{
$this->name = 'headerlinks';
$this->tab = 'Blocks';
$this->version = 1.0;
 
parent::__construct();
 
$this->displayName = $this->l('Headerlinks block');
$this->description = $this->l('Adds a block that displays "Accueil" + 3 Main Categories + "Contact" in the menu.');
}
 
function install()
{
if (!parent::install())
return false;
if (!$this->registerHook('top'))
return false;
return true;
}
 
 
        function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)
{
global $link;
 
$children = array();
if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth))
foreach ($resultParents[$id_category] as $subcat)
$children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1);
if (!isset($resultIds[$id_category]))
return false;
return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']),
'name' => Category::hideCategoryPosition($resultIds[$id_category]['name']), 'desc'=> $resultIds[$id_category]['description'],
'children' => $children);
}
 
 
/**
* Returns module content for header
*
* @param array $params Parameters
* @return string Content
*/
function hookTop($params)
{
                global $smarty, $cookie;
 
/*  ONLY FOR THEME OLDER THAN v1.0 */
global $link;
$smarty->assign(array(
'categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true),
'link' => $link
));
/* ELSE */
 
$id_customer = intval($params['cookie']->id_customer);
$maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
 
if (!$result = Db::getInstance()->ExecuteS('
SELECT DISTINCT c.*, cl.*
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.intval($params['cookie']->id_lang).')
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
WHERE 1'
.(intval($maxdepth) != 0 ? ' AND `level_depth` <= '.intval($maxdepth) : '').'
AND (c.`active` = 1 OR c.`id_category`= 1)
AND cg.`id_group` '.(!$cookie->id_customer ?  '= 1' : 'IN (SELECT id_group FROM '._DB_PREFIX_.'customer_group WHERE id_customer = '.intval($cookie->id_customer).')').'
ORDER BY `level_depth` ASC, cl.`name` ASC'))
return;
$resultParents = array();
$resultIds = array();
 
foreach ($result as $row)
{
$row['name'] = Category::hideCategoryPosition($row['name']);
$resultParents[$row['id_parent']][] = $row;
$resultIds[$row['id_category']] = $row;
}
$blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
 
if (isset($_GET['id_category']))
{
$cookie->last_visited_category = intval($_GET['id_category']);
$smarty->assign('currentCategoryId', intval($_GET['id_category']));
}
if (isset($_GET['id_product']))
{
if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId(intval($_GET['id_product']), array('0' => array('id_category' => $cookie->last_visited_category))))
{
$product = new Product(intval($_GET['id_product']));
if (isset($product) AND Validate::isLoadedObject($product))
$cookie->last_visited_category = intval($product->id_category_default);
}
$smarty->assign('currentCategoryId', intval($cookie->last_visited_category));
}
$smarty->assign('blockCategTree', $blockCategTree);
 
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl'))
$smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/headerlinks/category-tree-branch.tpl');
else
$smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'headerlinks/category-tree-branch.tpl');
$smarty->assign('isDhtml', $isDhtml);
/* /ONLY FOR THEME OLDER THAN v1.0 */
 
return $this->display(__FILE__, 'headerlinks.tpl');
}
 
/**
* Returns module content for left column
*
* @param array $params Parameters
* @return string Content
*/
function hookLeftColumn($params)
{
return $this->display(__FILE__, 'headerlinks.tpl');
}
 
function hookRightColumn($params)
{
return $this->hookLeftColumn($params);
}
}
 
?>
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...