Jump to content

Problema al Mostrar campo en Detalle de la Orden. order-detail.


rmonclova

Recommended Posts

Hola,

 

Quiero mostrar un campo en el Detalle de la Orden (entiendo que es este hook displayOrderDetail), y no consigo que me lo muestre, y es más, desde que he metido estos cambios, ya no me muestra nada. Estos son los cambios:

 

- En MiModulo.php

      public function hookdisplayOrderDetail($params)
      {
            global $smarty;
            require_once(dirname(__FILE__). '/MiCodigo.php');
            $id_code=MiCodigo::getMiCodigo($params['order']->id);

            echo "id_code: $id_code"; // aqui me muestra por pantalla el id_code correcto.

            $this->context->smarty->assign('id_code', $id_code);
      }

En el override de order-detail.tpl:

<div class="info-order">

{if $carrier->id}<p><strong>{l s='Carrier'}</strong> {if $carrier->name == "0"}{$shop_name|escape:'htmlall':'UTF-8'}{else}{$carrier->name|escape:'htmlall':'UTF-8'}{/if}</p>{/if}

<p><strong>{l s='Payment method'}</strong> <span class="color-myaccount">{$order->payment|escape:'htmlall':'UTF-8'}</span></p>

<p><strong>{l s='Mi Codigo'}</strong> <span class="color-myaccount">{$id_code|escape:'htmlall':'UTF-8'}</span></p>

{if $invoice AND $invoiceAllowed}
...
...

¿Porque no me muestra el campo con su valor?

 

PD.: Uso plantilla default y version PS 1.5.6.2

 

 

Gracias

saludos

Edited by rmonclova (see edit history)
Link to comment
Share on other sites

Este es el error que me muestra en pantalla cuando hago click en "detalle" de una orden (el campo "id_code" me lo muestra porque tengo puesto un echo en el hookdisplayOrderDetail):

 

id_code: 66667777
Notice: Undefined property: Smarty::$id_codsap in C:\xampp\htdocs\prestashop\tools\smarty\Smarty.class.php on line 676
id_code: 66667777
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "C:\xampp\htdocs\prestashop\themes\default\order-detail.tpl" on line 430 "{/if}" unexpected closing tag' in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php:667 Stack trace: #0 C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_compilebase.php(170): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unexpected clos...', 430) #1 C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_compile_if.php(197): Smarty_Internal_CompileBase->closeTag(Object(Smarty_Internal_SmartyTemplateCompiler), Array) #2 C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Ifclose->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #3 C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php(259): Smarty_Internal_Templ in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 667

Link to comment
Share on other sites

Lo ultimo que he probado y que me muestra el siguiente error:

id_code: 666444333
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "C:\xampp\htdocs\prestashop\themes\default\order-detail.tpl"

En el hookdisplayOrderDetail:

      public function hookdisplayOrderDetail($params)
      {
            global $smarty;
            require_once(dirname(__FILE__). '/MiCodigo.php');
            $id_code=MiCodigo::getMiCodigo($params['order']->id);

            $this->context->cookie->id_code_new = $id_code;
	    $this->smarty->assign('id_code_new', $this->context->cookie->id_code_new);
	
	    return $this->display(_PS_THEME_DIR_, 'order-detail.tpl');
      }

En order-detail.tpl:

<div class="info-order">
{if $carrier->id}<p><strong>{l s='Carrier'}</strong> {if $carrier->name == "0"}{$shop_name|escape:'htmlall':'UTF-8'}{else}{$carrier->name|escape:'htmlall':'UTF-8'}{/if}</p>{/if}
<p><strong>{l s='Payment method'}</strong> <span class="color-myaccount">{$order->payment|escape:'htmlall':'UTF-8'}</span></p>
{*  Añado aqui mi campo con su valor  *}
<p><strong>{l s='Mi Codigo'}</strong> <span class="color-myaccount">{$id_code_new|escape:'htmlall':'UTF-8'}</span></p>

¿Por qué no me pinta el campo?

 

 

gracias de antemano.

Edited by rmonclova (see edit history)
Link to comment
Share on other sites

  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...