Show all images of products even if combination is selected

Hi, I've bought the Combinations Tab Pro module and I have a question about product images. I have a product with 2 combinations. The product has 4 images, one for each of the 2 combinations and 2 general images. I would like all 4 images to show for the product (as thumbnails) and for one of the two general images to be used as the main (cover) image. The table of combinations should use the image relevant to each combination. Is there any way to do this? I can see that I can duplicate the images and then link a group of 4 to each combination, but then my main (cover) image becomes the 'combination' image. I appreciate that this question is not really about your module, but any advice would be appreciated. Thanks.


Show all pictures of product, not only images associated with combination

Hello,
I am not sure what's the prestashop version you use, but from your description i see that it is probaly prestashop 1.7.x. So my answer will be based on this PrestaShop version.
(i think so because in ps 1.7 when you will access to product page that has combinations, product page will show pictures that are associated with viewed combination only)


The product has 4 images, one for each of the 2 combinations and 2 general images. I would like all 4 images to show for the product (as thumbnails) and for one of the two general images to be used as the main (cover) image
In PrestaShop you can mark one from the images as a cover of product: https://i.imgur.com/oMj7n4r.png - So, this picture will appear as a cover of the product. Do it, selected picture will appear as a product cover photo.
Then it will be required to modify PrestaShop's core code. Please open file: src/adapter/image/ImageRetrievier.php

there is a code: (somewhere near ~50 line)
public function getProductImages(array $product, Language $language)
    {
        $productAttributeId = $product['id_product_attribute'];
        $productInstance = new Product(
            $product['id_product'],
            false,
            $language->id
        );
alter it to:
public function getProductImages(array $product, Language $language)
    {
        $productAttributeId = 0;
        $productInstance = new Product(
            $product['id_product'],
            false,
            $language->id
        );
Thanks to this change product page will show all product pictures, not only pictures associated with viewed combination

hope that this is what you are looking for ;)


The table of combinations should use the image relevant to each combination. Is there any way to do this?
'combinations table' module near each combination shows cover image of according combination. So in context of the module - there is nothing to 'fix' or 'improve' because it behaves like you described by default :)

Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment