claudio419 Posted October 21, 2015 Share Posted October 21, 2015 Hola a todos, necesito ver una función de php en un tpl, tal cual lo hace : {$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8') pero hasta el momento tuve suerte. Lo que hice fue: 1) cree una funcion: getCategoryParent() en Product.php public function getCategoryParent(){ return 'Hola desde Product.php'; } 2) en product-list.tpl escribi lo siguiente: {$product->getCategoryParent()} Pero me sale el siguiente error: Fatal error: Call to a member function getCategoryParent() on array in /Applications/XAMPP/xamppfiles/htdocs/......................./cache/smarty/compile/75/b5/0c/75b50c4c7f0c97cc4699dca3b7bd4363950e5044.file.product-list.tpl.cache.php on line 190 Alguien me podriar indicar que estoy haciendo mal? Desde ya muchas gracias Link to comment Share on other sites More sharing options...
ventura Posted October 21, 2015 Share Posted October 21, 2015 (edited) Prueba asi para poder llamarla en estatico public static function getCategoryParent($product_id){ return 'Hola desde Product.php'; } y asi desde el product-list.tpl {Product::getCategoryParent((int)$product.id_product)} Edited October 21, 2015 by ventura (see edit history) Link to comment Share on other sites More sharing options...
claudio419 Posted October 21, 2015 Author Share Posted October 21, 2015 Gracias!!! Funciona 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