Jump to content
luca1711

Undefined index: iso_code

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

Please open file pslanguageselectorpslangu.php line 32

and recheck index: iso_code

 

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

It is Not cache, it is complied files from Smarty in cache\smarty\compile

Althrought enable/disable Cache, this directory still is generated

Share this post


Link to post
Share on other sites
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">&#xE5C5;</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 }
}

 

 

Share this post


Link to post
Share on other sites

I have exactly the same problem.  Have you found a solution?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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? 

Share this post


Link to post
Share on other sites

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 by R.Shredder
wrong code (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More