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