After Update PHP I have errors in system log. This happens in backend, Products page:
PHP Warning: Use of undefined constant _JSHOP_MENU_CATEGORIES - assumed '_JSHOP_MENU_CATEGORIES' (this will throw an Error in a future version of PHP) in /administrator/components/com_jshopping/functions.php on line 113
(similar errors are from line 113 to 120)
Here is code that causes errors:
================
function addSubmenu($vName){
$user = JFactory::getUser();
$dispatcher = JDispatcher::getInstance();
$adminaccess = $user->authorise('core.admin', 'com_jshopping');
$installaccess = $user->authorise('core.admin.install', 'com_jshopping');
$menu = array();
$menu['categories'] = array(_JSHOP_MENU_CATEGORIES, 'index.php?option=com_jshopping&controller=categories&catid=0', $vName == 'categories', 1);
$menu['products'] = array(_JSHOP_MENU_PRODUCTS, 'index.php?option=com_jshopping&controller=products&category_id=0', $vName == 'products', 1);
$menu['orders'] = array( _JSHOP_MENU_ORDERS, 'index.php?option=com_jshopping&controller=orders', $vName == 'orders', 1);
$menu['users'] = array(_JSHOP_MENU_CLIENTS, 'index.php?option=com_jshopping&controller=users', $vName == 'users', 1);
$menu['other'] = array(_JSHOP_MENU_OTHER, 'index.php?option=com_jshopping&controller=other', $vName == 'other', 1);
$menu['config'] = array( _JSHOP_MENU_CONFIG, 'index.php?option=com_jshopping&controller=config', $vName == 'config', $adminaccess );
$menu['update'] = array(_JSHOP_PANEL_UPDATE, 'index.php?option=com_jshopping&controller=update', $vName == 'update', $installaccess );
$menu['info'] = array(_JSHOP_MENU_INFO, 'index.php?option=com_jshopping&controller=info', $vName == 'info', 1);
$dispatcher->trigger('onBeforeAdminMenuDisplay', array(&$menu, &$vName));
foreach($menu as $item){
if ($item[3]){
JHtmlSidebar::addEntry( $item[0], $item[1], $item[2]);
}
}
}
===============================
Similar error was in some plugin language files, but it was solved simply by quoting constant.
For example
define(_JSHOP_WAYFORPAY_SECRET_KEY, 'Secret key'); - problem line
define('_JSHOP_WAYFORPAY_SECRET_KEY', 'Secret key'); - solved line
But I don't understand how solve problem in array.
How should I change line like this:
$menu['categories'] = array(_JSHOP_MENU_CATEGORIES, 'index.php?option=com_jshopping&controller=categories&catid=0', $vName == 'categories', 1);
to solve problem?
If I just quote _JSHOP_MENU_CATEGORIES to '_JSHOP_MENU_CATEGORIES' errors stop but text in left side menu is not correct - I see text _JSHOP_MENU_CATEGORIES.
Letzte Änderung: 01.09.2020 13:05