damargon Posted February 26, 2015 Share Posted February 26, 2015 (edited) Hola a todos, Estoy intentando modificar la plantilla del back office y tengo un problema con una variable en smarty. Antecedentes: - En la tabla ps_supplier de la base de datos he añadido un campo nuevo que se llama "apellidos". - Entonces quiero que en la página de proveedores del back office pinte el nombre y los apellidos. - El archivo es panel/themes/default/template/controllers/products/suppliers.tpl <div class="panel-group" id="accordion-supplier"> {foreach from=$associated_suppliers item=supplier name=data} <div class="panel"> <div class="panel-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion-supplier" href="#supplier-{$supplier->id}">{if isset($supplier->name)}{$supplier->name}{/if} {if isset($supplier->apellidos)}{$supplier->apellidos}{/if}</a> </div> El problema como es de suponer lo tengo en la línea del: {if isset($supplier->apellidos)}{$supplier->apellidos}{/if} La variable no la pinta. Si alguien pudiese decirme cómo resolverlo se lo agradecería. NOTA: el campo apellidos tiene datos, Saludos y muchas gracias Edited February 26, 2015 by damargon (see edit history) Link to comment Share on other sites More sharing options...
Enrique Gómez Posted February 27, 2015 Share Posted February 27, 2015 Para añadir campos al modelo de datos, aparte de en la tabla hay que informar a prestashop en la definición http://nemops.com/extending-prestashop-objects/#.VPAyGy7QNTs p.ej <?php Class Product extends ProductCore { public $extrafield; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['extrafield'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } ?> Link to comment Share on other sites More sharing options...
damargon Posted February 27, 2015 Author Share Posted February 27, 2015 Ok, muchas gracias, probaré 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