Jump to content

Related products for each product in the homepage


FacileCrypto
 Share

Recommended Posts

Hello,
I'm looking for the response since 48h ...
I need to override a prestashop module.
This module returns a selection of products on the HomePage (very classic), but I need more.
For each product on the Home Page, I need to show a specific feature of his Related Products (ps_accessory).

You know, on a Product Page, You can show the related products and his features, price, etc.
I need the same, but for each product on my home page (3 related products max)

I think it's just 3 or 4 lines to add on the PHP page of the module...but I don't find the solution...

Someone to help me to find the way ?

thank you very much!
Chris

 

 

Edited by FacileCrypto (see edit history)

Share this post


Link to post
Share on other sites

Hi,

You  can  get  them  from  the  module  template  by  using  this  function   inside  the  foreach  loop  where  you  have  id_product  and  id_lang:


{assign  var=product_accessories   value=Product::getAccessoriesLight($product.id_lang, $product.id_product)}

<!---  then test  it  with  a  : -->

<pre>{$product_accessories|print_r}</pre>

 

PS  :   this  function  will  get product accessories  but  only names 

 

This  one  will get  full  product  data  but  not easy  to use  inside the template:


$product=new Product($id_product);

$id_lang=$this->context->language->id;

$accessories =$product->getAccessories($id_lang,true);

 

Edited by ndiaga (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More