Jump to content


Photo

Default bootstrap block top menu - move images to the top

prestashop 1.6 theme template modification

  • Please log in to reply
1 reply to this topic

#1 OVOnel

OVOnel

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 26 April 2014 - 09:44 AM

Hello

 

im using default template in latest release of prestashop.

I use default mega menu module and i want to change the way how the category thumbnails appears there.

can anyone give me detailed instruction how i can move the pictures of categories from bottom section of menu to the top?



looking for the best presta addons with outstanding support? check this: PrestaShop Modules

#2 vekia

vekia

    Advanced Member

  • Members
  • PipPipPip
  • 10104 posts

Posted 26 April 2014 - 09:46 AM

hello
it's easy to achieve, 
in this case we have to modify block top menu module .php file.
at the moment there is no other way because this addon generates code to display in php file (not in tpl as it is in other modules)

 

so, open module directory, then go to subdirectory named "blocktopmenu"

open file named blocktopmenu.php
 
 

search for code which looks like code that i pasted below:

                                 $html .= $this->generateCategoriesMenu($category['children']);

				if ((int)$category['level_depth'] == 2)
				{
					$files = scandir(_PS_CAT_IMG_DIR_);

					if (count($files) > 0)
					{
						$html .= '<li id="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>';
					}
				}

change it to:

                                if ((int)$category['level_depth'] == 2)
				{
					$files = scandir(_PS_CAT_IMG_DIR_);

					if (count($files) > 0)
					{
						$html .= '<li id="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 .= $this->generateCategoriesMenu($category['children']);

free tutorials, free templates, free addons, prestashop modules MndfRK4.png  lpHMrZ5.png  gtKHYO7.png  google-48.png






Also tagged with one or more of these keywords: prestashop 1.6, theme, template, modification

IPB Skin By Virteq