Configurable Product - Show Main Product Image In Results

Hi,

currently if you setup a configurable product (with sub-products), CS-Cart will show the image of the first sub-product in results by default.

However, I would like to change the behavior so that the Image of the main product is shown in results. On the product page, it works fine as its showing the image of the selected sub-product.

I.e. I have a product X that is sold in different sizes. So I set the main product image to show a bundle of all sizes, and each sub-product only depicts the product in one size. In the results I want to see the main product image (showing all sizes) and when clicking it I want to see sub-product images, i.e. specific sizes.

Thanks for your help.

app/addons/product_variations/Tygh/Addons/ProductVariations/Product/AdditionalDataLoader.php

find the loadBaseData function and try to replace

$product['main_pair'] = reset($this->images[$product['variation_product_id']]);

with

if (!empty($_REQUEST['product_id'])) {
$product['main_pair'] = reset($this->images[$product['variation_product_id']]);
}

(!) Not tested

Seems to work. Thanks, great work as always!

Mods should gather all tweaks of eComlabs in one page with links to them and make it sticky!

Seems to work. Thanks, great work as always!

We were glad to help you :rolleyes: