[email protected] Posted December 2, 2016 Share Posted December 2, 2016 Buenas! Necesitaría conseguir sacar a través del smarty la descripción de la categoría madre. He probado varias cosas pero me salta error 500. La función para conseguir datos he probado: {$parent = new Category ($category->id_parent,Context::getContext()->language->id)}; Pero me implosiona. Me da error de que no encuentra esa función. Alguna idea? Gracias! Link to comment Share on other sites More sharing options...
ventura Posted December 2, 2016 Share Posted December 2, 2016 Donde estas incluyendo ese codigo ¿? Link to comment Share on other sites More sharing options...
[email protected] Posted December 2, 2016 Author Share Posted December 2, 2016 En el category.tpl. La idea que quiero hacer, es que si una subcategoría no tiene descripción me coja la descripción de la categoría superior suya. (es una imagen) Link to comment Share on other sites More sharing options...
ventura Posted December 2, 2016 Share Posted December 2, 2016 No puedes instanciar un objeto en un .tpl, hazlo en el controlador, categoryController.php, en la function initContent asi por ejemplo: if (empty($this->category->description)) { $categoryParent = new Category($this->category->id_parent, $this->context->language->id); $this->category->description= $categoryParent->description; } Link to comment Share on other sites More sharing options...
[email protected] Posted December 6, 2016 Author Share Posted December 6, 2016 Muchas gracias!! Funciona Ok! 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