Jump to content

How to call a controller function in .tpl using prestashop 1.4.7?


Furqan

Recommended Posts

Hi,

 

I have a store and its running on PS1.4.7. I need to add a custom php function that retrieve data from database, i then need to show that data on the product.tpl. Can anyone please help me how to do that?

 

I have manage to send a static value to the product.tpl from the controller file by assign() function. But i don't know where and exactly how to put php function in controller file.

 

I have used the following function.

 

public static function getlinkById($productId)

{

return Db::getInstance()->getRow('SELECT `url`, `company` FROM `'._DB_PREFIX_.'affiliate` WHERE `id_product` = '.(int)($productId));

}

 

I have put this function in product.php class but i don't know how to call or use it in controller file. And hence take its data into product.tpl.

 

Many Thanks in advance.

Furqan

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...