Jump to content

Product Images for alternate (color) combinations on Product List pages


Recommended Posts

Hi All

I am trying to make available in the Product List template file all images URLs related to each and every (colour) combination a product has to offer. Currently I believe only the default product image is made available.

This is a follow up to the following thread I posted a few years ago https://www.prestashop.com/forums/topic/591040-17x-display-images-of-all-product-varients-on-product-list-category-pages/ where i found a workaround using the prepareProductForTemplate function in the ProductListingFrontController. I was able to query and inject the urls into the main product list variable for theme to pick up.

With the new development on PS i am looking to see if there is a better way to do this going forward. I have checked the Extension Concepts page on the Dev Doc as it seems core overrides are discouraged these days.

I had a look to see if i could find any hooks that allow you to manipulate the product data before it is shown on a product list. This way I could move the logic into a bespoke module which hooked into the main flow. I couldn't find any. So this would be my first recommendation to any core devs, please add this hook in upcoming versions.

Using modules there seems to be ways to work with controllers, however i could not see how this was relevant to what I am trying to achieve.

I wondered if it is possible to call functions that retrieve the results of directly in the theme. I would need to access the following calls or something similar: Image::getImages() or $this->context->link->getImageLink(). I could not find any documentation on how to best do this using Prestashop.

I don't think any of the Symfony documentation applies to this part of Prestashop yet.

So could anyone else offer any advice on how to best achieve this in a way that will age well with Prestashop's development going forward. Is there a better way of doing this?




Edited by hygap (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

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