Jump to content

Horizontal Navigation Bar Module v0.5


Recommended Posts

I've updated a Presta 1.1 Shop to 1.4.

There is a module named "Horizontal Navigation Bar Module v0.5" i couldn't get working again.

I have no experience in presta, but the rest i customized in the tpl's and now everything is working again except this module.

 

The Hook

{$HOOK_NAV_BAR}

doesn't work.

 

I read this in some threads, but no solution there how to fix it in my case.

 

I think it has perhaps something to do with the header.php in the root dir or the init.php at the same place.

 

Both look in presta 1.4

$controller = new FrontController();
$controller->displayHeader();

 

header.php

/ P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');

require_once(dirname(__FILE__).'/init.php');

/* CSS */
$css_files[_THEME_CSS_DIR_.'grid.css'] = 'all';
$css_files[_THEME_CSS_DIR_.'common.css'] = 'all';

/* Hooks are volontary out the initialize array (need those variables already assigned) */
$smarty->assign(array(
   'HOOK_HEADER' => Module::hookExec('header'),
   'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'),
   'HOOK_TOP' => Module::hookExec('top'),
   'HOOK_NAV_BAR' => Module::hookExec('navBar'),
   'static_token' => Tools::getToken(false),
   'token' => Tools::getToken(),
   'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_,
   'content_only' => intval(Tools::getValue('content_only'))
));

if(isset($css_files) AND !empty($css_files)) $smarty->assign('css_files', $css_files);
if(isset($js_files) AND !empty($js_files)) $smarty->assign('js_files', $js_files);

/* Display a maintenance page if shop is closed */
if (isset($maintenance) AND (!isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] != Configuration::get('PS_MAINTENANCE_IP')))
{
   header('HTTP/1.1 503 temporarily overloaded');
   $smarty->display(_PS_THEME_DIR_.'maintenance.tpl');
   exit;
}

$smarty->display(_PS_THEME_DIR_.'header.tpl');

 

init.php

if (!isset($smarty))
   exit;

/* Theme is missing or maintenance */
if (!is_dir(dirname(__FILE__).'/themes/'._THEME_NAME_))
   die(Tools::displayError('Current theme unavailable. Please check your theme directory name and permissions.'));
elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' AND !intval(Configuration::get('PS_SHOP_ENABLE')))
   $maintenance = true;

ob_start();
global $cart, $cookie, $_CONF, $link;

/* get page name to display it in body id */
$pathinfo = pathinfo(__FILE__);
$page_name = basename($_SERVER['PHP_SELF'], '.'.$pathinfo['extension']);
$page_name = (ereg('^[0-9]', $page_name)) ? 'page_'.$page_name : $page_name;

$cookie = new Cookie('ps');
Tools::setCookieLanguage();
Tools::switchLanguage();
/* attribute id_lang is often needed, so we create a constant for performance reasons */
define('_USER_ID_LANG_', intval($cookie->id_lang));

if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned(intval($cookie->id_customer))))
{
   $cookie->logout();
   Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
}
elseif (isset($_GET['mylogout']))
{
    $cookie->mylogout();
   Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
}

$iso = strtolower(Language::getIsoById($cookie->id_lang ? intval($cookie->id_lang) : 1));
@include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
@include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
$_MODULES = array();

$currency = Tools::setCurrency();

if (is_numeric($cookie->id_cart))
{
   $cart = new Cart(intval($cookie->id_cart));
   $cart->id_lang = intval($cookie->id_lang);
   if ($cart->OrderExists())
       unset($cookie->id_cart, $cart);
   else
   {
       if ($cookie->id_customer)
           $cart->id_customer = intval($cookie->id_customer);
       $cart->id_currency = intval($cookie->id_currency);
       $cart->update();
   }
}

if (!isset($cart) OR !$cart->id)
{
   $cart = new Cart();
   $cart->id_lang = intval($cookie->id_lang);
   $cart->id_currency = intval($cookie->id_currency);
   if ($cookie->id_customer)
       $cart->id_customer = intval($cookie->id_customer);
}
if (!$cart->nbProducts())
   $cart->id_carrier = NULL;

$ps_language = new Language(intval($cookie->id_lang));
setlocale(LC_TIME, strtolower($ps_language->iso_code).'_'.strtoupper($ps_language->iso_code).'@euro',
strtolower($ps_language->iso_code).'_'.strtoupper($ps_language->iso_code), strtolower($ps_language->iso_code));

if (is_object($currency))
   $smarty->ps_currency = $currency;
if (is_object($ps_language))
   $smarty->ps_language = $ps_language;

$smarty->register_function('dateFormat', array('Tools', 'dateFormat'));
$smarty->register_function('productPrice', array('Product', 'productPrice'));
$smarty->register_function('convertPrice', array('Product', 'convertPrice'));
$smarty->register_function('convertPriceWithoutDisplay', array('Product', 'productPriceWithoutDisplay'));
$smarty->register_function('convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency'));
$smarty->register_function('displayWtPrice', array('Product', 'displayWtPrice'));
$smarty->register_function('displayWtPriceWithCurrency', array('Product', 'displayWtPriceWithCurrency'));
$smarty->register_function('displayPrice', array('Tools', 'displayPriceSmarty'));

$smarty->assign(Tools::getMetaTags(intval($cookie->id_lang)));
$smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));

/* Breadcrumb */
$navigationPipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
$smarty->assign('navigationPipe', $navigationPipe);

$protocol = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';

$smarty->assign(array(
   'base_dir' => __PS_BASE_URI__,
   'base_dir_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__,

   /* If the current page need SSL encryption and the shop allow it, then active it */
   'protocol' => $protocol,
   'img_ps_dir' => _PS_IMG_,
   'img_cat_dir' => _THEME_CAT_DIR_,
   'img_lang_dir' => _THEME_LANG_DIR_,
   'img_prod_dir' => _THEME_PROD_DIR_,
   'img_manu_dir' => _THEME_MANU_DIR_,
   'img_sup_dir' => _THEME_SUP_DIR_,
   'img_ship_dir' => _THEME_SHIP_DIR_,
   'img_col_dir' => _THEME_COL_DIR_,
   'img_dir' => _THEME_IMG_DIR_,
   'css_dir' => _THEME_CSS_DIR_,
   'js_dir' => _THEME_JS_DIR_,
   'theme_dir' => _THEME_DIR_,
   'tpl_dir' => _PS_THEME_DIR_,
   'modules_dir' => _MODULE_DIR_,
   'mail_dir' => _MAIL_DIR_,
   'pic_dir' => _THEME_PROD_PIC_DIR_,
   'lang_iso' => $ps_language->iso_code,
   'come_from' => 'http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').htmlentities($_SERVER['REQUEST_URI']),
   'shop_name' => Configuration::get('PS_SHOP_NAME'),
   'cart_qties' => intval($cart->nbProducts()),
   'cart' => $cart,
   'currencies' => Currency::getCurrencies(),
   'id_currency_cookie' => intval($currency->id),
   'currency' => $currency,
   'languages' => Language::getLanguages(),
   'logged' => $cookie->isLogged(),
   'page_name' => $page_name,
   'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false)));

 

 

But i'm not sure if this needed in 1.4 because all other modules worked without it. Somebody knows definetly if that module isn't working anymore?

Link to comment
Share on other sites

Hi

I have a similar problem. I have a paid module so I need to contact the developer for an upgrade. You may have to do the same. Does it say on the module that it is not compatible with this version of prestashop. Please contact developer of the module."?

Link to comment
Share on other sites

I wrote ejectcore developer of the navbar like Mike Kranzler posted. http://www.prestashop.com/forums/topic/4636-horizontal-navigation-bar-module-v05-now-available/ ejectcores Thread describes the conf for header.php presta 1.1 - perhaps later versions - but not for 1.4.

 

Last Entries in that thread from this year:

I cannot get it right.

I have a testversion running on 1.3 and that works like a charm.

I cannot get it right in 1.4.

 

and

 

Thank u for your perfect development, But i have got some questions.

from my prestashop 1.4.4.1 ,I can not find the content you said above in heard.php

 

--------------------------------------------

Follow is the content of heard.php

---------------------------------------------

 

<?php

$controller = new FrontController();

$controller->displayHeader();

 

With this problem thread ends. 100% the same problem i have. )-:

Link to comment
Share on other sites

Sounds to me like the menu module you have been using is not compatible with your current version of prestashop.

 

There are few free horizontal menus available if you have a search for them. I particularly like the Julien BREUX Menu.

 

Why not just download and install one and save yourself the hassle with the one you are trying to use now.

Link to comment
Share on other sites

@Mike Kranzler: i sent him yesterday a PM

so now have past 30 hour, still 18 hours to wait :-)

 

I removed Horizontal Navigation Bar Module v0.5 and replaced it with

Dave L suggested

 

 

 

https://github.com/jbreux/jbx_menu/

 

This works fine.

 

@Mike Kranzler:

I will let you know if in 18 hours a answer of ectcores is still missing.

from ectcores Thread i'm thinking development of that mod is paused. Why not, there are many things more interesting than navbar.

 

Thanks for answering

Link to comment
Share on other sites

@Mike Kranzler: i sent him yesterday a PM

so now have past 30 hour, still 18 hours to wait :-)

 

I removed Horizontal Navigation Bar Module v0.5 and replaced it with

Dave L suggested

 

 

 

https://github.com/jbreux/jbx_menu/

 

This works fine.

 

@Mike Kranzler:

I will let you know if in 18 hours a answer of ectcores is still missing.

from ectcores Thread i'm thinking development of that mod is paused. Why not, there are many things more interesting than navbar.

 

Thanks for answering

 

Thanks for the update, I will definitely look into this if he continues to not respond. Thanks Dave L for suggesting an alternate module!

 

-Mike

Link to comment
Share on other sites

×
×
  • Create New...