Jump to content

Display a product by his id on the homepage


Natanaël

Recommended Posts

I try to display the data of a single product (selection by its id 32) on my homepage.

I already managed to display the title and the short description via the FrontController:

Public static function getProductName ($ id) {
$ langID = Context :: getContext () -> language-> id;
$ product = new Product ($ id, false, $ langID);

echo ($ product-> name);
}

public static function getProductDescription ($ id) {
$ langID = Context :: getContext () -> language-> id;
$ product = new Product ($ id, false, $ langID);

echo ($ product-> description_short);
}

and calling the variables like that in my tpl:

{FrontController :: getProductName (32)}
{FrontController :: getProductDescription (32)}

It works, but I don't know how to display the image (cover) and features. Is it possible in the same way?

Thanks for help :)
Edited by Natanaël
Font bug (see edit history)
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...