Jump to content

Edit History

R4xx4r

R4xx4r


solved the issue

Hi everybody,

I'm pretty new to PrestaShop - so sry if i ask basic things.


I'm currently working on a module which should display products (you can choose in the backend area) as additional section in the default products template - like "highly recommended products".


I finished the whole Backend part have an array with my product ID's .

As I mentioned before I wanna use the default templates which are available after a fresh installation and so I the template which is placed here: themes\classic\templates\catalog\_partials\products.tpl 


Now my big problem is: I'm not able to get the data like it should be ...


If I debug e.g. the products which are displayed in the default search behaviour, which uses exactly this template too -  I see something like

object(PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray)#323 (11) { ["imageRetriever":"Pr .....

So we have our product data as a ProductListingLazyArray.


I get my product data by looping over my array and make

 

 but as I get my products with 

$product = new Product($productId, true);

So of course I don't have a ProductListingLazyArray - I just have a product as an product object.

 

Do you have any idea - how I can "transform" my product object to this ProductListingLazyArray?
Or is it even the right way ?

 

THANKS for your help, ideas and recommendations!

 

Wish you a good start into the week!

Best

R4xx4r

R4xx4r

Hi everybody,

I'm pretty new to PrestaShop - so sry if i ask basic things.


I'm currently working on a module which should display products (you can choose in the backend area) as additional section in the default products template - like "highly recommended products".


I finished the whole Backend part have an array with my product ID's .

As I mentioned before I wanna use the default templates which are available after a fresh installation and so I the template which is placed here: themes\classic\templates\catalog\_partials\products.tpl 


Now my big problem is: I'm not able to get the data like it should be ...


If I debug e.g. the products which are displayed in the default search behaviour, which uses exactly this template too -  I see something like

object(PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray)#323 (11) { ["imageRetriever":"Pr .....

So we have our product data as a ProductListingLazyArray.


I get my product data by looping over my array and make

 

 but as I get my products with 

$product = new Product($productId, true);

So of course I don't have a ProductListingLazyArray - I just have a product as an product object.

 

Do you have any idea - how I can "transform" my product object to this ProductListingLazyArray?
Or is it even the right way ?

 

THANKS for your help, ideas and recommendations!

 

Wish you a good start into the week!

Best

R4xx4r

R4xx4r

Hi everybody,

I'm pretty new to PrestaShop - so sry if i ask basic things.


I'm currently working on a module which should display products (you can choose in the backend area) as additional section in the default products template - like "highly recommended products".


I finished the whole Backend part have an array with my product ID's .

As I mentioned before I wanna use the default templates which are available after a fresh installation and so I the template which is placed here: themes\classic\templates\catalog\_partials\products.tpl 


Now my big problem is: I'm not able to get the data like it should be ...


If I debug e.g. the products which are displayed in the default search behaviour, which uses exactly this template too -  I see something like

object(PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray)#323 (11) { ["imageRetriever":"Pr .....

So we have our product data as a ProductListingLazyArray.


I get my product data by looping over my array and make

 

 but as I get my products with 

$product = new Product($productId, true);

So of course I don't have a ProductListingLazyArray - I just have a product as an product object.

 

Do you have any idea - how I can "transform" my product object to this ProductListingLazyArray?
Or is it even the right way ?

 

THANKS for your help, ideas and recommendations!

 

Wish you a good start into the week!

Best

×
×
  • Create New...