Jump to content

BaptisteLegoupil

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • First Name
    Baptiste
  • Last Name
    Legoupil

BaptisteLegoupil's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi ! In PS 1.6 we are this function but this add in sub menu too. protected function generateCategoriesMenu($categories, $is_children = 0) { $html = ''; foreach ($categories as $key => $category) { if ($category['level_depth'] > 1) { $cat = new Category($category['id_category']); $link = Tools::HtmlEntitiesUTF8($cat->getLink()); } else { $link = $this->context->link->getPageLink('index'); } /* Whenever a category is not active we shouldnt display it to customer */ if ((bool)$category['active'] === false) { continue; } $html .= '<li'.(($this->page_name == 'category' && (int)Tools::getValue('id_category') == (int)$category['id_category']) ? ' class="sfHoverForce"' : '').'>'; $html .= '<a href="'.$link.'" title="'.$category['name'].'">'.$category['name'].'</a>'; if (isset($category['children']) && !empty($category['children'])) { $html .= '<ul>'; $html .= $this->generateCategoriesMenu($category['children'], 1); if ((int)$category['level_depth'] > 1 && !$is_children) { $files = scandir(_PS_CAT_IMG_DIR_); if (count(preg_grep('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $files)) > 0) { $html .= '<li class="category-thumbnail">'; foreach ($files as $file) { if (preg_match('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $file) === 1) { $html .= '<div><img src="'.$this->context->link->getMediaLink(_THEME_CAT_DIR_.$file) .'" alt="'.Tools::SafeOutput($category['name']).'" title="' .Tools::SafeOutput($category['name']).'" class="imgm" /></div>'; } } $html .= '</li>'; } } $html .= '</ul>'; } $html .= '</li>'; } return $html; }
  2. Hi ! In PS 1.6 how can i add categories thum in mega menu ? I have this code : foreach ($pages as $page) { $cms = new CMS($page['id_cms'], (int)$id_lang); $links = $cms->getLinks((int)$id_lang, array((int)$cms->id)); $selected = ($this->page_name == 'cms' && ((int)Tools::getValue('id_cms') == $page['id_cms'])) ? ' class="sfHoverForce"' : ''; $this->_menu .= '<li '.$selected.'>'; $this->_menu .= '<a href="'.$links[0]['link'].'">'.$cms->meta_title.'</a>'; $this->_menu .= '</li>'; } in getCMSMenuItems function. Can you help me Pascal ?
  3. Bonjour, Le sujet est ouvert depuis un bon bout de temps mais cela peux aider certaines personnes. Voici ma balise <body> dans le fichier header.tpl <body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{/if}{if $hide_right_column} hide-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}{if isset($cart->id_shop)} p{$cart->id_shop|escape:'html':'UTF-8'}{/if}"> Le code que j'ai ajouté est : {if isset($cart->id_shop)} p{$cart->id_shop|escape:'html':'UTF-8'}{/if} J'ai mis un "p" devant "p{$cart->id_shop" pour avoir un nom de classe valide. Ex : p1 au lieu de 1. Voila.
×
×
  • Create New...