Mod: Option Combination Images - show Main Image in category and search results

I sell items with multiple color options. In my case, the Main Image is a composite of a “glamour” product shot and color swatches. I then assign a distinct color product image to each color’s Option Combination. This allows the customer to see the product in the color they selected when viewing their cart contents and invoice. Super.



The trouble with this functionality is that CS-Cart displays the first existing Option Combination Image in place of the product’s Main Image everywhere on the site - regardless of whether the current view allows a customer to select product options. This is especially annoying in the category and search results, and I would prefer that the product view display the Main Image until the customer changed a product option.



Mod instructions below. This was done in 2.1.2. Standard universal disclaimer applies.



To preserve this Main Image in categories, search results and (initial) product view:



[SIZE=“3”]open /core/fn.catalog.php[/SIZE]

replacephp function fn_gather_additional_product_data(&$product, $get_icon = false, $get_detailed = false, $get_options = true, $get_discounts = true, $get_features = false) withphp function fn_gather_additional_product_data(&$product, $get_icon = false, $get_detailed = false, $get_options = true, $get_discounts = true, $get_features = false, $get_combo_images = true) replacephp if ($get_icon == true || $get_detailed == true) { with```php
if (($get_icon == true || $get_detailed == true) && ($get_combo_images == true)) {

<br />
[SIZE="3"]Open [B]/controllers/customer/categories.php[/B][/SIZE]<br />
replace```php
fn_gather_additional_product_data($products[$k], true, true, true, true, true);
```with```php
fn_gather_additional_product_data($products[$k], true, true, true, true, true, false);
```<br />
<br />
[SIZE="3"]Open [B]/controllers/customer/products.php[/B][/SIZE]<br />
replace```php
fn_gather_additional_product_data($products[$k], true, true);
```with```php
fn_gather_additional_product_data($products[$k], true, true, true, true, false, false);
```replace```php
fn_gather_additional_product_data($product, true, true);
```with```php
fn_gather_additional_product_data($product, true, true, true, true, false, false);
```<br />
<br />
[SIZE="3"]Done.[/SIZE] You may need to clear your cache to see the change take effect.<br />
<br />
cheers,<br />
Glen

OMG… THANK YOU!!!



I kept bugging cscart about this and they just kept telling me it was meant to function this way.

[quote name='sixnin9' timestamp='1291618320' post='97231']

I sell items with multiple color options. In my case, the Main Image is a composite of a “glamour” product shot and color swatches. I then assign a distinct color product image to each color's Option Combination. This allows the customer to see the product in the color they selected when viewing their cart contents and invoice. Super.





The trouble with this functionality is that CS-Cart displays the first existing Option Combination Image in place of the product's Main Image everywhere on the site - regardless of whether the current view allows a customer to select product options. This is especially annoying in the category and search results, and I would prefer that the product view display the Main Image until the customer changed a product option.





Mod instructions below. This was done in 2.1.2. Standard universal disclaimer applies.





To preserve this Main Image in categories, search results and (initial) product view:





[SIZE=“3”]open /core/fn.catalog.php[/SIZE]



replace```php function fn_gather_additional_product_data(&$product, $get_icon = false, $get_detailed = false, $get_options = true, $get_discounts = true, $get_features = false) ```with```php function fn_gather_additional_product_data(&$product, $get_icon = false, $get_detailed = false, $get_options = true, $get_discounts = true, $get_features = false, $get_combo_images = true) ```replace```php if ($get_icon == true || $get_detailed == true) { ```with```php if (($get_icon == true || $get_detailed == true) && ($get_combo_images == true)) { ```





[SIZE=“3”]Open /controllers/customer/categories.php[/SIZE]



replace```php fn_gather_additional_product_data($products[$k], true, true, true, true, true); ```with```php fn_gather_additional_product_data($products[$k], true, true, true, true, true, false); ```





[SIZE=“3”]Open /controllers/customer/products.php[/SIZE]



replace```php fn_gather_additional_product_data($products[$k], true, true); ```with```php fn_gather_additional_product_data($products[$k], true, true, true, true, false, false); ```replace```php fn_gather_additional_product_data($product, true, true); ```with```php fn_gather_additional_product_data($product, true, true, true, true, false, false); ```





[SIZE=“3”]Done.[/SIZE] You may need to clear your cache to see the change take effect.





cheers,



Glen

[/quote]





Hi Glen,



Do you have such mod also for the 2.2.* versions?



Thanks.

It looks like 2.2.2 has changed and this no longer applies. Anyone willing to help out with getting this work with 2.2.2? I tried monkeying around a bit but couldn't figure it out.

[font=“Verdana”]Great work Glen!



Why do people ALWAYS have to quote people? It makes the topic way to long! Just reply, or say @ Their-Name! :P



However, regarding this “Mod” - this annoying “bug” still exists in v2.2.1 and v2.2.2 (just upgraded)!!!



How do we go about applying this … “patch” so that the product image is displayed (e.g. a “Hero” shot) rather than the first Product Option Combination?



Thank you so much for your help!![/font]

FYI I talked to the developers at ShippingKit about this, I was going to pay them to create this for me and they decided they are going to release it as a free addon! Hopefully it will be available within the next week or so :)



If anyone needs any custom dev work I highly suggest ShippingKit, I have had 4 custom addons created within the last couple months and have been really happy with everyone I have worked with over there. And their prices are great! (FYI I will be selling the custom addons I had done within the next month, they are Gift Registry enhancements, ShipRush Integration, Abandoned Cart Discount Offer and an admin based Address Verification).

[font=“Verdana”]We just need a PHP / Windows program that can handle IMPORT of Products + Product Options + Option Combinations!!!



Can anyone recommend or point me in the right direction???



THANK YOU! :D[/font]

ShippingKit.com just released a free addon to do this! I have it installed and working on http://www.littlefornow.com which is running 2.2.2.



https://www.shippingkit.com/members/index.php?_m=downloads&_a=viewdownload&downloaditemid=25&nav=0,11



Big thanks to Alexey and Vladimir at Shipping Kit! They are really great CS-Cart Dev's, use them for custom work!

Anyone got a fix for this in CS Cart V4? (been looking for this!)

For v4.x you need to

#on file


app/functions/fn.catalog.php


#replace


if (!empty($params['get_icon']) || !empty($params['get_detailed'])) {


#with


$show_combination_image = true;
if(Registry::get('runtime.controller') == 'categories' || ( Registry::get('runtime.controller') == 'products' && Registry::get('runtime.mode') == 'search' )){
$show_combination_image = false;
}
if ((!empty($params['get_icon']) || !empty($params['get_detailed'])) && $show_combination_image) {
#if (!empty($params['get_icon']) || !empty($params['get_detailed'])) {




At this time cannot be used any hook in order to cross over cs-cart update



I hope that helps,





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

You rock as usual my friend. :-) Payment coming your way.

What payment ? :))) The coffee was good ;)





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

i confirm it works for version 4.5.1.

Anyone know how to make it work for blocks as well?

i.e. bests sellers, newest etc.

Doesn't seem to work in 4.5.2 - can anyone confirm?

Workaround:

Create a variant called 'Please Select' with no icon.