Jump to content

Top Horizontal Menu with Pictures


Recommended Posts

if you want to modify default block top menu - you have to modify the module php file, it's because menu is generated inside main module php file, not in tpl as it is in other modules.

 

of course you can append or prepend images in tpl, but if you want to do it somewhere "inside" menu items - you can do it with php modification only

Link to comment
Share on other sites

if you want to modify default block top menu - you have to modify the module php file, it's because menu is generated inside main module php file, not in tpl as it is in other modules.

 

of course you can append or prepend images in tpl, but if you want to do it somewhere "inside" menu items - you can do it with php modification only

 

I tried it many times but it is no easly. can you please give an example...

 

autoxdesign.com

 

 

blocktopmenu.php

 

<?php

/*

* 2007-2013 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Academic Free License (AFL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.org/licenses/afl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

*  @author PrestaShop SA <[email protected]>

*  @copyright  2007-2013 PrestaShop SA

*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)

*  International Registered Trademark & Property of PrestaShop SA

*/

 

require (dirname(__FILE__).'/menutoplinks.class.php');

 

class Blocktopmenu extends Module

{

 

    private $_menu = '';

    private $_html = '';

    private $user_groups;

 

    /*

     * Pattern for matching config values

     */

    private $pattern = '/^([A-Z_]*)[0-9]+/';

 

    /*

     * Name of the controller

     * Used to set item selected or not in top menu

     */

    private $page_name = '';

 

    /*

     * Spaces per depth in BO

     */

    private $spacer_size = '5';

 

    public function __construct()

    {

        $this->name = 'blocktopmenu';

        $this->tab = 'front_office_features';

        $this->version = 1.7;

        $this->author = 'PrestaShop';

 

        parent::__construct();

 

        $this->displayName = $this->l('Top horizontal menu');

        $this->description = $this->l('Add a new horizontal menu to the top of your e-commerce website.');

    }

 

    public function install()

    {

        if (!parent::install() ||

            !$this->registerHook('displayTop') ||

            !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') ||

            !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||

            !$this->registerHook('actionObjectCategoryUpdateAfter') ||

            !$this->registerHook('actionObjectCategoryDeleteAfter') ||

            !$this->registerHook('actionObjectCategoryAddAfter') ||

            !$this->registerHook('actionObjectCmsUpdateAfter') ||

            !$this->registerHook('actionObjectCmsDeleteAfter') ||

            !$this->registerHook('actionObjectCmsAddAfter') ||

            !$this->registerHook('actionObjectSupplierUpdateAfter') ||

            !$this->registerHook('actionObjectSupplierDeleteAfter') ||

            !$this->registerHook('actionObjectSupplierAddAfter') ||

            !$this->registerHook('actionObjectManufacturerUpdateAfter') ||

            !$this->registerHook('actionObjectManufacturerDeleteAfter') ||

            !$this->registerHook('actionObjectManufacturerAddAfter') ||

            !$this->registerHook('actionObjectProductUpdateAfter') ||

            !$this->registerHook('actionObjectProductDeleteAfter') ||

            !$this->registerHook('actionObjectProductAddAfter') ||

            !$this->registerHook('categoryUpdate') ||

            !$this->registerHook('actionShopDataDuplication') ||

            !$this->installDB())

            return false;

        return true;

    }

post-753011-0-15276300-1390650830_thumb.jpg

Link to comment
Share on other sites

for example, image in CMS pages drodown:

case 'CMS':
					$selected = ($this->page_name == 'cms' && (Tools::getValue('id_cms') == $id)) ? ' class="sfHover"' : '';
					$cms = CMS::getLinks((int)$id_lang, array($id));
					if (count($cms))
						$this->_menu .= '<li'.$selected.'><img src="URL_TO_YOUR_IMAGE"/><a href="'.Tools::HtmlEntitiesUTF8($cms[0]['link']).'">'.$cms[0]['meta_title'].'</a></li>'.PHP_EOL;
					break;

i added there image code: <img src="URL_TO_YOUR_IMAGE"/>

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...