luca1711 Posted January 23, 2019 Share Posted January 23, 2019 Hello everyone, I set up the multilingual site and currently I have only two languages. It seems that this has created conflicts or problems in my product pages. It seems it is a problem of missing code of ISO code for the countries. From the debugging I get this result, please anyone have any suggestions on how to solve this? (1/1) ContextErrorException Notice: Undefined index: iso_code in 1c00f78dace25d509ec3a1f54176b7ae2000accf_2.module.pslanguageselectorpslangu.php line 32 at content_5c4828d15dac45_55505364(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 206 at Smarty_Internal_Template->render(false, 0)in smarty_internal_templatebase.php line 232 at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, null, null, 0)in smarty_internal_templatebase.php line 116 at Smarty_Internal_TemplateBase->fetch(null, null, null, null, false, true, false)in SmartyDevTemplate.php line 41 at SmartyDevTemplateCore->fetch()in Module.php line 2282 at ModuleCore->fetch('module:ps_languageselector/ps_languageselector.tpl')in ps_languageselector.php line 61 at Ps_Languageselector->renderWidget('displayNav2', array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart)))in Hook.php line 929 at HookCore::coreRenderWidget(object(Ps_Languageselector), 'displayNav2', array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart)))in Hook.php line 881 at HookCore::exec('displayNav2', array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart)), null)in smarty.config.inc.php line 165 at smartyHook(array('h' => 'displayNav2'), object(SmartyDevTemplate))in SmartyLazyRegister.php line 83 at SmartyLazyRegister->__call('smartyHook', array(array('h' => 'displayNav2'), object(SmartyDevTemplate)))in cabe4f6fa9a3f328edda810b0448ca742141494a_2.file.header.tpl.php line 81 at Block_20708550685c4828d15b7a14_04171567->callBlock(object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 247 at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_20708550685c4828d15b7a14_04171567), object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 183 at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_20708550685c4828d15b7a14_04171567))in smarty_internal_runtime_inheritance.php line 157 at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_20708550685c4828d15b7a14_04171567', 'header_nav')in cabe4f6fa9a3f328edda810b0448ca742141494a_2.file.header.tpl.php line 31 at content_5c4828d15bf7e9_94044981(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 206 at Smarty_Internal_Template->render()in smarty_internal_template.php line 365 at Smarty_Internal_Template->_subTemplateRender('file:_partials/header.tpl', null, 'layouts/layout-right-column.tpl', 0, 3600, array(), 0, false)in a585becf68d625336862b6ceda78a0f180ea1ba9_2.file.layout-both-columns.tpl.php line 188 at Block_7253954555c4828d15668e5_93572198->callBlock(object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 247 at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_7253954555c4828d15668e5_93572198), object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 183 at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_7253954555c4828d15668e5_93572198))in smarty_internal_runtime_inheritance.php line 157 at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_7253954555c4828d15668e5_93572198', 'header')in a585becf68d625336862b6ceda78a0f180ea1ba9_2.file.layout-both-columns.tpl.php line 62 at content_5c4828d157afc0_56589757(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 206 at Smarty_Internal_Template->render()in smarty_internal_template.php line 365 at Smarty_Internal_Template->_subTemplateRender('layouts/layout-both-columns.tpl', null, 'layouts/layout-right-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 127 at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-both-columns.tpl')in ef0919b744b1678166864f75b73faaef5066fcee_2.file.layout-right-column.tpl.php line 38 at content_5c4828d155c540_97324174(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 206 at Smarty_Internal_Template->render()in smarty_internal_template.php line 365 at Smarty_Internal_Template->_subTemplateRender('layouts/layout-right-column.tpl', null, 'layouts/layout-right-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 127 at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-right-column.tpl')in ad5a1533ae3b6c81eab6a8f9ec955c7d416dc1cd_2.file.product.tpl.php line 54 at content_5c4828d154db94_57529699(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123 at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114 at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 206 at Smarty_Internal_Template->render(false, 0)in smarty_internal_templatebase.php line 232 at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, 'layouts/layout-right-column.tpl', null, 0)in smarty_internal_templatebase.php line 116 at Smarty_Internal_TemplateBase->fetch('catalog/product.tpl', null, 'layouts/layout-right-column.tpl', null, false, true, false)in SmartyDev.php line 41 at SmartyDev->fetch('catalog/product.tpl', null, 'layouts/layout-right-column.tpl')in FrontController.php line 679 at FrontControllerCore->smartyOutputContent('catalog/product.tpl')in FrontController.php line 663 at FrontControllerCore->display()in Controller.php line 275 at ControllerCore->run()in Dispatcher.php line 428 at DispatcherCore->dispatch()in index.php line 28 Link to comment Share on other sites More sharing options...
tdsoft Posted January 23, 2019 Share Posted January 23, 2019 Please open file pslanguageselectorpslangu.php line 32 and recheck index: iso_code Link to comment Share on other sites More sharing options...
luca1711 Posted January 23, 2019 Author Share Posted January 23, 2019 3 ore fa, tdsoft dice: Si prega di aprire il file pslanguageselectorpslangu.php riga 32 e ricontrollare l'indice: iso_code Hello, thanks for your reply. The var / cache folder seems to be creating problems I deleted the folders inside it and now the error has disappeared from the debug mode. In any case I do not understand, I have all the caches turned off forever because I'm still building the site. Why on the other hand does it seem that some cache is active? In my htacess there is no directive for the cache, do you have any suggestions on these cache problems? Link to comment Share on other sites More sharing options...
tdsoft Posted January 24, 2019 Share Posted January 24, 2019 It is Not cache, it is complied files from Smarty in cache\smarty\compile Althrought enable/disable Cache, this directory still is generated Link to comment Share on other sites More sharing options...
luca1711 Posted January 24, 2019 Author Share Posted January 24, 2019 8 ore fa, tdsoft dice: It is Not cache, it is complied files from Smarty in cache\smarty\compile Althrought enable/disable Cache, this directory still is generated You are right about this, then it most likely seems to be a rewriting problem of the templates. Some problems with smarty with file recompilation. I think in any case this depends on the smarty cache, at least I think. In fact, I find different problems on chrome that I usually use and if I open explorer or firefox from here I see the site without problems. In any case, here is the line concerned, I can not figure out what the problem is with jpg image line 32: .jpg" alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['current_language']->value['iso_code'], ENT_QUOTES, 'UTF-8');?> " width="16" height="11" /> full code of 1c00f78dace25d509ec3a1f54176b7ae2000accf_2.module.pslanguageselectorpslangu.php <?php /* Smarty version 3.1.32, created on 2019-01-24 13:35:44 from 'module:pslanguageselectorpslangu' */ /* @var Smarty_Internal_Template $_smarty_tpl */ if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array ( 'version' => '3.1.32', 'unifunc' => 'content_5c49b120a40592_28713111', 'has_nocache_code' => false, 'file_dependency' => array ( '1c00f78dace25d509ec3a1f54176b7ae2000accf' => array ( 0 => 'module:pslanguageselectorpslangu', 1 => 1547477215, 2 => 'module', ), ), 'includes' => array ( ), ),false)) { function content_5c49b120a40592_28713111 (Smarty_Internal_Template $_smarty_tpl) { ?><!-- begin /usr/www/users/canaph/ingrosso-canapa-light/themes/classic/modules/ps_languageselector/ps_languageselector.tpl --><div id="_desktop_language_selector"> <div class="language-selector-wrapper"> <span id="language-selector-label" class="hidden-md-up"><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Language:','d'=>'Shop.Theme.Global'),$_smarty_tpl ) );?> </span> <div class="language-selector dropdown js-dropdown"> <button data-toggle="dropdown" class="hidden-sm-down btn-unstyle" aria-haspopup="true" aria-expanded="false" aria-label="<?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Language dropdown','d'=>'Shop.Theme.Global'),$_smarty_tpl ) );?> "> <span class="expand-more"><img src="/img/l/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['current_language']->value['id_lang'], ENT_QUOTES, 'UTF-8');?> .jpg" alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['current_language']->value['iso_code'], ENT_QUOTES, 'UTF-8');?> " width="16" height="11" /> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['current_language']->value['name_simple'], ENT_QUOTES, 'UTF-8');?> </span> <i class="material-icons expand-more"></i> </button> <ul class="dropdown-menu hidden-sm-down" aria-labelledby="language-selector-label"> <?php $_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['languages']->value, 'language'); if ($_from !== null) { foreach ($_from as $_smarty_tpl->tpl_vars['language']->value) { ?> <li <?php if ($_smarty_tpl->tpl_vars['language']->value['id_lang'] == $_smarty_tpl->tpl_vars['current_language']->value['id_lang']) {?> class="current" <?php }?>> <a href="<?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['url'][0], array( array('entity'=>'language','id'=>$_smarty_tpl->tpl_vars['language']->value['id_lang']),$_smarty_tpl ) );?> " class="dropdown-item"><img src="/img/l/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['language']->value['id_lang'], ENT_QUOTES, 'UTF-8');?> .jpg" alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['language']->value['iso_code'], ENT_QUOTES, 'UTF-8');?> " width="16" height="11" /> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['language']->value['name_simple'], ENT_QUOTES, 'UTF-8');?> </a> </li> <?php } } $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?> </ul> <select class="link hidden-md-up" aria-labelledby="language-selector-label"> <?php $_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['languages']->value, 'language'); if ($_from !== null) { foreach ($_from as $_smarty_tpl->tpl_vars['language']->value) { ?> <option value="<?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['url'][0], array( array('entity'=>'language','id'=>$_smarty_tpl->tpl_vars['language']->value['id_lang']),$_smarty_tpl ) );?> "<?php if ($_smarty_tpl->tpl_vars['language']->value['id_lang'] == $_smarty_tpl->tpl_vars['current_language']->value['id_lang']) {?> selected="selected"<?php }?>><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['language']->value['name_simple'], ENT_QUOTES, 'UTF-8');?> </option> <?php } } $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?> </select> </div> </div> </div> <!-- end /usr/www/users/canaph/ingrosso-canapa-light/themes/classic/modules/ps_languageselector/ps_languageselector.tpl --><?php } } Link to comment Share on other sites More sharing options...
Joyplaz Posted June 6, 2019 Share Posted June 6, 2019 I have exactly the same problem. Have you found a solution? Link to comment Share on other sites More sharing options...
R.Shredder Posted June 11, 2019 Share Posted June 11, 2019 Exactly the same issue here! 😕 Link to comment Share on other sites More sharing options...
luca1711 Posted June 13, 2019 Author Share Posted June 13, 2019 Hi, no, I couldn't solve this Link to comment Share on other sites More sharing options...
R.Shredder Posted June 13, 2019 Share Posted June 13, 2019 Looks like the theme i was using was just not compatible with the 1.7.5 version. I tried with 1.7.4 and it works just fine. Weird. Link to comment Share on other sites More sharing options...
PeterVajda Posted September 10, 2019 Share Posted September 10, 2019 Just delete this: alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['language']->value['iso_code'], ENT_QUOTES, 'UTF-8');?> " Something is wrong with the iso_code variable Link to comment Share on other sites More sharing options...
Joyplaz Posted September 11, 2019 Share Posted September 11, 2019 11 hours ago, PeterVajda said: Just delete this: alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['language']->value['iso_code'], ENT_QUOTES, 'UTF-8');?> " Something is wrong with the iso_code variable Delete this from where? Link to comment Share on other sites More sharing options...
PeterVajda Posted September 11, 2019 Share Posted September 11, 2019 (edited) You probably followed this tutorial https://blog.prestatuts.com/prestashop-1-7-display-language-flags/ so here: /themes/YOUR_THEME/modules/ps_languageselector/ps_languageselector.tpl Edited September 11, 2019 by PeterVajda (see edit history) 1 Link to comment Share on other sites More sharing options...
R.Shredder Posted September 11, 2019 Share Posted September 11, 2019 (edited) In debug mode, i still get : Notice: Undefined index: id_category in 9984ab50a088bf9f57339172de9a00e764435787_2.file.layout-both-columns.tpl.php line 47 with a bunch of many other errors. When i open that cache file, line 47 goes like this (i included here from line 45 to 47) : <body id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['page']->value['page_name'], ENT_QUOTES, 'UTF-8');?> " class="<?php echo htmlspecialchars(call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'classnames' ][ 0 ], array( $_smarty_tpl->tpl_vars['page']->value['body_classes'] )), ENT_QUOTES, 'UTF-8');?> <?php if ($_smarty_tpl->tpl_vars['page']->value['page_name'] != 'index') {?>sub-page<?php }?>"<?php if ($_GET['id_category']) {?> class="cat<?php echo htmlspecialchars($_GET['id_category'], ENT_QUOTES, 'UTF-8');?> "<?php }?>> I have no idea how to fix this ! 😥 Edited September 11, 2019 by R.Shredder wrong code (see edit history) Link to comment Share on other sites More sharing options...
PeterVajda Posted September 11, 2019 Share Posted September 11, 2019 Hi, this is different error than the one in the thread and my solution will not work. Please start a new thread, somebody will help you for sure. Link to comment Share on other sites More sharing options...
R.Shredder Posted September 11, 2019 Share Posted September 11, 2019 Just now, PeterVajda said: Hi, this is different error than the one in the thread and my solution will not work. Please start a new thread, somebody will help you for sure. Mmh i thought that might come from the same thing. My bad. Link to comment Share on other sites More sharing options...
Joyplaz Posted September 12, 2019 Share Posted September 12, 2019 Thank you PeterVajda! Just fyi for anyone else who stumbles up this thread, in my file the code to delete looks like this.. alt="{$current_language.iso_code}" I just changed the alt text to something that works Link to comment Share on other sites More sharing options...
igorsh Posted October 21, 2020 Share Posted October 21, 2020 Hello, here's the link to template variables: https://catalogo-onlinersi.net/en/content/33-prestashop-17-global-variables So if you want your module or theme work's well - just change to correct variable, your case is language ISO code, so change your variable ({lang_iso},{current_language.iso_code}... etc) to {$language.iso_code} in .tpl file that's all Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now