Jump to content

Llamar una función PHP desde un tpl


claudio419

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...