List Product By Colors

Hi,



I want to configure my cs-cart to list the products by colors. If one product comes in different colors, I want to list it, multiplied by the number of colors it came (in category pages/ subcategory pages).

When I upload an image color in Variant options, it reduces them to 50px. :( and in Images tab from Products section, it’s difficult to guess from all the pictures galleries which is the correct one.

What I want to know, if it’s possible to do that from cs-cart features/combinations/options or I have to do a custom Mod or something related.



Does anyone met this situation before?

Thanks,

Hi guys,



I am trying to include additional main images, inserted by colors, in Product page from backend.

I have modded the option for only one product image in order to add unlimited ones (in General Tab).



Unfortunately I can't group the main product images with the additional ones, in order to have a nice grid list. I have also merge the new additional images to the $products array.



Below is the products_grid.tpl file altered in order to include my new images on the same product, in order to point to the same product page.

I can't figure that out, how to close the tags ok, in order to have 3x3 or any $columnx$column model listed.



Can anyone can give me a clue? A hint?



Thanks


```php

{if $products}



{script src=“js/exceptions.js”}



{if !$no_pagination}

{include file=“common_templates/pagination.tpl”}

{/if}

{if !$no_sorting}

{include file=“views/products/components/sorting.tpl”}

{/if}



{if $products|sizeof < $columns}

{assign var=“columns” value=$products|@sizeof}

{/if}





{split data=$products size=$columns|default:“3” assign=“splitted_products”}



{math equation=“100 / x” x=$columns|default:“3” assign=“cell_width”}

{if $item_number == “Y”}

{assign var=“cur_number” value=1}

{/if}



{foreach from=$splitted_products item="sproducts" name="sprod"} {* split the products found *}

{foreach from=$sproducts item="product" name="sproducts"}{* search each prodcut and list it *}
{* in this foreach will be listed products gropued by $column number *}

{assign var="obj_id" value=$product.product_id}
{assign var="obj_id_prefix" value="`$obj_prefix``$product.product_id`"}

{include file="common_templates/product_data.tpl" product=$product}
{assign var=total_c value=$product.main_pair_additional|sizeof} {* total images color per each product *}

{if $total_c==0}
{assign var=product_pos value=$smarty.foreach.sproducts.index}
{elseif $total_c!=0}

{if $smarty.foreach.sproducts.index == 0}

{math equation="a" a=0 assign=product_pos}

{math equation="a%b" a=$total_c b=$columns assign=next_main_pos}

{elseif $smarty.foreach.sproducts.index == 1 }

{math equation="b+1" b=$next_main_pos assign=product_pos}
{assign var=next_main_pos2 value=$product_pos}

{elseif $smarty.foreach.sproducts.index == 2}
{* max number of index per row / if replace index with iteration, then will be 3 instead of 2*}

{math equation="b+1" b=next_main_pos2 assign=product_pos}

{/if}
{/if}



{* Section for new additional main product colors *}
{section name=p loop=$product.main_pair_additional}

{math equation="a" a=$smarty.section.p.iteration assign=cur_pos}
{if $cur_pos >= $columns} {math equation="a-b" a=$smarty.section.p.iteration b=$columns assign=cur_pos}
{elseif $cur_pos < $columns} {assign var=cur_pos value=$smarty.section.p.iteration}
{/if}


{if $cur_pos % $columns == 0}{/if}




{/section}


{/if}
{** // Section for new additional main product colors **}


{/if} {* // close product *}




{/foreach}


{/foreach}


{if $product} {* main product, image + details*}

{assign var="form_open" value="form_open_`$obj_id`"}
{$smarty.capture.$form_open}
{hook name="products:product_multicolumns_list"}



{include file="common_templates/image.tpl" obj_id=$obj_id_prefix images=$product.main_pair object_type="product" show_thumbnail="Y" image_width=$settings.Thumbnails.product_lists_thumbnail_width image_height=$settings.Thumbnails.product_lists_thumbnail_height}


{if $item_number == "Y"}{$cur_number}. {math equation="num + 1" num=$cur_number assign="cur_number"}{/if}{assign var="name" value="name_$obj_id"}{$smarty.capture.$name}



{assign var="old_price" value="old_price_`$obj_id`"}
{if $smarty.capture.$old_price|trim}{$smarty.capture.$old_price} {/if}

{assign var="price" value="price_`$obj_id`"}
{$smarty.capture.$price}

{assign var="clean_price" value="clean_price_`$obj_id`"}
{$smarty.capture.$clean_price}


{assign var="add_to_cart" value="add_to_cart_`$obj_id`"}
{$smarty.capture.$add_to_cart}

{/hook}
{assign var="form_close" value="form_close_`$obj_id`"}
{$smarty.capture.$form_close}



{if $product.main_pair_additional} {* if we find additional product images, we want to display in our grid list *}

{assign var="form_open" value="form_open_`$product.main_pair_additional[p].pair_id`"}
{$smarty.capture.$form_open}
{hook name="products:product_multicolumns_list"}



{assign var="image_path" value="images/detailed/0/`$product.main_pair_additional[p].image_path`"}

{assign var="image_width" value=$settings.Thumbnails.product_details_thumbnail_width}

{math equation="new_x * y / x" new_x=$image_width x=$product.main_pair_additional[p].image_x y=$product.main_pair_additional[p].image_y format="%d" assign="image_height"}

___



{if $item_number == "Y"}{$cur_number}. {math equation="num + 1" num=$cur_number assign="cur_number"}{/if}{assign var="name" value="name_$obj_id"}{$smarty.capture.$name}


{/hook}
{assign var="form_close" value="form_close_`$obj_id`"}
{$smarty.capture.$form_close}



{if !$no_pagination}
{include file="common_templates/pagination.tpl"}
{/if}

{/if}

```

:( this is how my grid is displayed … :(

product_grid_split_err.jpg

No one? Anyone?



I finally done it, it works perfect :)

Maybe somebody will have this situation in future. Of course, this is just an alpha version until the full add-on will be made.



Below is my tpl code. Of course i have added some rows in core/fn.catalog.php in order to expand the array with some values.


<br />
{* $Id: products_grid_by_color.tpl @ mod by Robert $ *}<br />
<br />
{if $products}<br />
<br />
{script src="js/exceptions.js"}<br />
<br />
{if !$no_pagination}<br />
	{include file="common_templates/pagination.tpl"}<br />
{/if}<br />
{if !$no_sorting}<br />
	{include file="views/products/components/sorting.tpl"}<br />
{/if}<br />
<br />
{if $products|sizeof < $columns}<br />
	{assign var="columns" value=$products|@sizeof}<br />
{/if}<br />
{assign var=my_col_val value=$settings.Appearance.columns_in_products_list}<br />
{math equation="100 / x" x=$my_col_val assign="cell_width"}<br />
<br />
{if $item_number == "Y"}<br />
	{assign var="cur_number" value=1}<br />
{/if}<br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="fixed-layout multicolumns-list"><br />
<tr><br />
{foreach from=$products item="product" name="sproducts"}<br />
	<br />
	<br />
	{if $product}<br />
	<td class="center" valign="top" width="{$cell_width}%"><br />
	{assign var="obj_id" value=$product.product_id}<br />
	{assign var="obj_id_prefix" value="`$obj_prefix``$product.product_id`"}<br />
	<br />
	{include file="common_templates/product_data.tpl" product=$product}<br />
	{* {assign var=product_pos value=$smarty.foreach.sproducts.iteration} *}<br />
   <br />
			<br />
					<br />
						{if $smarty.foreach.sproducts.iteration == 1} <br />
							{assign var=product_pos value=$smarty.foreach.sproducts.iteration}<br />
							{* <br />main poz: {$product_pos}<br /> *}<br />
						{elseif $smarty.foreach.sproducts.iteration > 1}<br />
							{if $product.main_pair_additional}<br />
								{math equation=a+1 a=$real_cur_pos assign=product_pos}<br />
								{* <br />main poz: {$product_pos}<br /> *}<br />
							{/if}	<br />
						{/if}<br />
	<br />
					<br />
					<br />
	{assign var="form_open" value="form_open_`$obj_id`"}<br />
	{$smarty.capture.$form_open}<br />
	{hook name="products:product_multicolumns_list"}<br />
			<br />
			<br />
	<a href="{"products.view?product_id=`$product.product_id`"|fn_url}">{include file="common_templates/image.tpl" obj_id=$obj_id_prefix images=$product.main_pair object_type="product" show_thumbnail="Y" image_width=$settings.Thumbnails.product_lists_thumbnail_width image_height=$settings.Thumbnails.product_lists_thumbnail_height}</a><br />
			<br />
	<p><br />
	{if $item_number == "Y"}{$cur_number}.&nbsp;{math equation="num + 1" num=$cur_number assign="cur_number"}{/if}{assign var="name" value="name_$obj_id"}{$smarty.capture.$name}<br />
	</p><br />
			<br />
	{assign var="old_price" value="old_price_`$obj_id`"}<br />
	{if $smarty.capture.$old_price|trim}{$smarty.capture.$old_price}&nbsp;{/if}<br />
	<br />
	{assign var="price" value="price_`$obj_id`"}<br />
	{$smarty.capture.$price}<br />
	<br />
	{assign var="clean_price" value="clean_price_`$obj_id`"}<br />
	{$smarty.capture.$clean_price}<br />
	<br />
	<div class="buttons-container"><br />
		{assign var="add_to_cart" value="add_to_cart_`$obj_id`"}<br />
		{$smarty.capture.$add_to_cart}<br />
	</div><br />
			<br />
			<br />
	{/hook}<br />
	{assign var="form_close" value="form_close_`$obj_id`"}<br />
	{$smarty.capture.$form_close}<br />
	{* $product_pos *}	<br />
	</td><br />
	<br />
			{if $product_pos % $my_col_val == 0 } </tr><tr>{/if}<br />
			{if $product.main_pair_additional}<br />
		    		<br />
					<br />
					{* $product_pos *}<br />
					{* total: {$total_p} <br /> *}<br />
					<br />
					{section name=p loop=$product.main_pair_additional}<br />
						<br />
						{assign var=cur_p_pos value=$smarty.section.p.iteration} <br />
						{math equation=a+b a=$cur_p_pos b=$product_pos assign=real_cur_pos}<br />
							{* $real_cur_pos *}<br />
								<br />
								<br />
							<td class="center" valign="top" width="{$cell_width}%"><br />
								{assign var="form_open" value="form_open_`$product.main_pair_additional[p].pair_id`"}<br />
								{$smarty.capture.$form_open}<br />
								{hook name="products:product_multicolumns_list"}<br />
								{* $real_cur_pos *}	<br />
								<a href="{"products.view?product_id=`$product.product_id`"|fn_url}"><br />
									<br />
									{assign var="image_path" value="images/detailed/0/`$product.main_pair_additional[p].image_path`"}<br />
									<br />
									{assign var="image_width" value=$settings.Thumbnails.product_details_thumbnail_width}<br />
									<br />
									{math equation="new_x * y / x" new_x=$image_width x=$product.main_pair_additional[p].image_x y=$product.main_pair_additional[p].image_y format="%d" assign="image_height"}<br />
									<br />
									<img class="{$valign} {$class}" {if $product.main_pair_additional[p].pair_id && !$no_ids}id="det_add_img_{$product.main_pair_additional[p].pair_id}"{/if} src="{$config.full_host_name}{$image_path|default:$config.no_image_path}" {if $image_width}width="{$image_width}"{/if} {if $image_height}height="{$image_height}"{/if} alt="___" border="0" /><br />
								<br />
								</a><br />
								<p><br />
								{if $item_number == "Y"}{$cur_number}.&nbsp;{math equation="num + 1" num=$cur_number assign="cur_number"}{/if}{assign var="name" value="name_$obj_id"}{$smarty.capture.$name}<br />
								</p><br />
								{assign var="old_price" value="old_price_`$obj_id`"}<br />
								{if $smarty.capture.$old_price|trim}{$smarty.capture.$old_price}&nbsp;{/if}<br />
								<br />
								{assign var="price" value="price_`$obj_id`"}<br />
								{$smarty.capture.$price}<br />
								<br />
								{assign var="clean_price" value="clean_price_`$obj_id`"}<br />
								{$smarty.capture.$clean_price}<br />
								<br />
								<div class="buttons-container"><br />
								{assign var="add_to_cart" value="add_to_cart_`$obj_id`"}<br />
								{$smarty.capture.$add_to_cart}<br />
								</div><br />
								{/hook}<br />
								{assign var="form_close" value="form_close_`$obj_id`"}<br />
								{$smarty.capture.$form_close}<br />
								<br />
							</td><br />
 							{if $real_cur_pos % $my_col_val == 0 } </tr><tr>{/if}<br />
									<br />
					{/section}<br />
					<br />
						<br />
				{/if}<br />
				{** // Section for new additional main product colors **}	<br />
			<br />
			<br />
	<br />
			<br />
	{/if} {* // close product *}<br />
		<br />
{/foreach}<br />
</tr><br />
</table><br />
<br />
<br />
{if !$no_pagination}<br />
	{include file="common_templates/pagination.tpl"}<br />
{/if}<br />
<br />
{/if}<br />
<br />
{capture name="mainbox_title"}{$title}{/capture}<br />
<br />
<br />

Under options, if you go to option combinations, you can add images for each variant. So if you have a pink square uploaded under “colors”, and click pink on the front end, the pink product will show up in your images on the left. There is no need to modify the files.

Robert

[quote]

Of course i have added some rows in core/fn.catalog.php in order to expand the array with some values.

[/quote]

Why? Why not use the get_products hook or the get_products_post hook to do what you need.

[quote name='moka' timestamp='1310179683' post='116673']

Under options, if you go to option combinations, you can add images for each variant. So if you have a pink square uploaded under “colors”, and click pink on the front end, the pink product will show up in your images on the left. There is no need to modify the files.

[/quote]



Hi, I know about the product combinations. What you say refers to Product page, not Categories pages, if I am not mistaken.

That was my first option in order to do this, but I couldn't find a way to hook the product image colors added there with the main product image in order to display them on categories pages. The problem was practically Listing those images in Category pages. If a product comes in different colors, then it must appear after the main product image.



Thanks,

[quote name='tbirnseth' timestamp='1310180101' post='116676']

Robert



Why? Why not use the get_products hook or the get_products_post hook to do what you need.

[/quote]



Maybe you are right, I am still learning how to work on cs-cart platform. I am new and is possible to miss some things in this moment.



First of all I have extended the $products array with another parameter. All I have done in core/fn.catalog.php was to add a couple of lines, like below:


in function fn_get_product_data( ....
.....
if ($get_add_pairs == true) {
$product_data['main_image_pairs'] = fn_get_image_pairs($product_id, 'product_additional_main', 'MA', true, true, $lang_code);
}

.....

in function fn_gather_additional_products_data(....
.....
$product_ima_data_1 = db_get_array("
SELECT
?:images_links.pair_id, ?:images_links.image_id, ?:images_links.detailed_id, ?:images_links.type
FROM ?:images_links
INNER JOIN ?:images
ON ?:images_links.detailed_id = ?:images.image_id
WHERE ?:images_links.object_id = $product_id AND ?:images_links.type = 'MA'
");
$product_ima_data_2 = db_get_array(
"SELECT
?:images.image_id, ?:images.image_path, ?:images.image_x, ?:images.image_y
FROM ?:images
INNER JOIN ?:images_links
ON ?:images.image_id = ?:images_links.detailed_id
WHERE ?:images_links.object_id = $product_id AND ?:images_links.object_type = 'product_additional_main' AND ?:images_links.type = 'MA'

"
);

$product['main_pair_additional'] = fn_array_merge($product_ima_data_1, $product_ima_data_2);
........



There was a small modification in admin also. I have added an option in order to add more images in General Tab of the Products instead of one thumb & one popup. I have done exactly like the Images Tab, the only difference is that those images are listed in Category Pages.



Of course, this is a temporary measure. After I will complete all the necessary tasks and all of them works ok, I will try to optimize my code as well. Some hooks / Add-ons…

Thanks,

products_grid_admin_integration.jpg

I had cscartrocks modify my cart. If you click on my color filters on the left the color for that option shows in the results.

Both of those functions have hooks that will allow you to modify their results. Look for 'fn_set_hoook('…

To use a PHP hook, you modify your addons/my_changes/init.php to add a line of (for get_product_data hook)

fn_register_hooks('get_product_data');



Then you create a function in addons/my_changes/func.php named

fn_my_changes_get_product_data() and use the parameters passed from the fn_set_hook() call. Suggest you have these parameters be by reference, not by value so that your changes will occur in the data back in the caller.



Then do whatever modifications you need to do in your fn_my_changes_get_product_data() function.



There's a tutorial in the developer area of the forum I wrote a while back that is much more detailed and uses an example.



For what you are doing, it can probably all be done without modification to any standard files.

Moka - That's they way it should work in the standard cart but would require an admin interface to associate option images to detailed images (or thumbs)

[quote name='tbirnseth' timestamp='1310235890' post='116716']

There's a tutorial in the developer area of the forum I wrote a while back that is much more detailed and uses an example.

[/quote]



Hi tbirnseth, the sample file in your tutorial PHP Controller - 6 (The finalle) is not available. Will be great if you could update the link. Thanks!

Sorry about that. Had done some cleanup a while back and moved it to an archive folder. I've put it back now so the link in the other thread should work correctly.

[quote name='tbirnseth' timestamp='1310235890' post='116716']

Both of those functions have hooks that will allow you to modify their results. Look for 'fn_set_hoook('…

To use a PHP hook, you modify your addons/my_changes/init.php to add a line of (for get_product_data hook)

fn_register_hooks('get_product_data');



Then you create a function in addons/my_changes/func.php named

fn_my_changes_get_product_data() and use the parameters passed from the fn_set_hook() call. Suggest you have these parameters be by reference, not by value so that your changes will occur in the data back in the caller.



Then do whatever modifications you need to do in your fn_my_changes_get_product_data() function.



There's a tutorial in the developer area of the forum I wrote a while back that is much more detailed and uses an example.



For what you are doing, it can probably all be done without modification to any standard files.

[/quote]



Thanks for the hints. I will follow them. It makes all sense. I already separated .tpl files and integrate in admin list options (Products Grid, Compact list … Products Grid by color … ). If I will remove my lines from fn.catalog.php and integrate in the new functions, I think everything will be ok and further upgrades will not affect my work.

[quote name='tbirnseth' timestamp='1310235890' post='116716']

Both of those functions have hooks that will allow you to modify their results. Look for 'fn_set_hoook('…

To use a PHP hook, you modify your addons/my_changes/init.php to add a line of (for get_product_data hook)

fn_register_hooks('get_product_data');



Then you create a function in addons/my_changes/func.php named

fn_my_changes_get_product_data() and use the parameters passed from the fn_set_hook() call. Suggest you have these parameters be by reference, not by value so that your changes will occur in the data back in the caller.



Then do whatever modifications you need to do in your fn_my_changes_get_product_data() function.



There's a tutorial in the developer area of the forum I wrote a while back that is much more detailed and uses an example.



For what you are doing, it can probably all be done without modification to any standard files.

[/quote]



Hi tbirnseth,



I have followed your advice and created the hooks for those functions I need to be modified.

So far seems to be ok, but I still have to add the attach_images.tpl block (in order to offer the possibility to add unlimited color images) for the add product layout in admin.



Can you tell me how or where can I overwrite the update.tpl file which is located /skins/basic/admin/views/products/update.tpl for my_changes addon?

(I have tried in addons/my_changes/schemas/ but nothing happends ).



I didnt understand if the directories need to follow the same path or needs a different one.

For example if I have in /admin/views/products/update.tpl the tpl file

in addon/my_changes/schemas must I have addon/my_changes/schemas/admin/views/products/update.tpl ?



Thanks,

additional_image_colors.jpg

Schemas directory has nothing to do with templates… Only for menu items, Import/Export definitions, etc.

If you wanted to replace the skins/basic/admin/views/products/update.tpl file, I would probably first ensure that I couldn't use one of the existing hooks, then I'd probably enclose the whole file in a new hook named {hook name=“products:my_update”} and then copy the original file there and make my changes (using comments so 6 months from now, it will make sense).

[quote name='tbirnseth' timestamp='1310235890' post='116716']

Both of those functions have hooks that will allow you to modify their results. Look for 'fn_set_hoook('…

To use a PHP hook, you modify your addons/my_changes/init.php to add a line of (for get_product_data hook)

fn_register_hooks('get_product_data');



Then you create a function in addons/my_changes/func.php named

fn_my_changes_get_product_data() and use the parameters passed from the fn_set_hook() call. Suggest you have these parameters be by reference, not by value so that your changes will occur in the data back in the caller.



Then do whatever modifications you need to do in your fn_my_changes_get_product_data() function.



There's a tutorial in the developer area of the forum I wrote a while back that is much more detailed and uses an example.



For what you are doing, it can probably all be done without modification to any standard files.

[/quote]



Hello again,



I have created a controller for products.php, called products.post.php and put it in addons/my_changes/controllers/admin/products.post.php:

```php


if ($_SERVER['REQUEST_METHOD'] == 'POST') {

if ($mode == 'add') {
if (!empty($_REQUEST['product_data']['product'])) { // Checking for required fields for new product


fn_attach_image_pairs('product_add_additional_color', 'product', $product_id, DESCR_SL);


}
}

if ($mode == 'update') {
if (!empty($_REQUEST['product_data']['product'])) {

fn_attach_image_pairs('product_update_additional_color', 'product', $_REQUEST['product_id'], DESCR_SL);

fn_attach_image_pairs('product_add_additional_color', 'product', $_REQUEST['product_id'], DESCR_SL);

}

}


}

?>

```



next, i wanted to define the custom functions in addons/my_changes/func.php and set up from init.php:



func.php:


function fn_my_changes_get_product_data($product_id, &$auth, $lang_code = CART_LANGUAGE, $field_list = '', $get_add_pairs = true, $get_main_pair = true, $get_taxes = true, $get_qty_discounts = false, $preview = false, $features = true)
{
$product_id = intval($product_id);
if (!empty($product_id)) {
.................
if ($get_add_pairs == true) {
$product_data['main_image_colors'] = fn_get_image_pairs($product_id, 'product', 'MA', true, true, $lang_code);
}
.........

}
}

function fn_my_changes_gather_additional_products_data(&$products, &$params){

........
// Get images
if ($params['get_icon'] == true || $params['get_detailed'] == true) {
if (empty($product['main_pair']) && !empty($products_images[$product_id])) {
$product['main_pair'] = reset($products_images[$product_id]);

}
$product['main_image_colors'] = $products_color_images[$product_id];
}
..........
}












init.php:


if ( !defined('AREA') ) { die('Access denied'); }

fn_register_hooks(
'get_product_data',
'gather_additional_products_data',
....

);





The Controller works fine, but the functions from addons, are not working properly.

My question is: in those function do I have to put all the code from fn.catalog.php function or just my changes regarding that function, like in a controller?

What should I do with those hooks called inside those functions?



I want to separate and make them functional, in the same time, those lines, for those functions:

this, for get_product_data()


if ($get_add_pairs == true) {
$product_data['main_image_colors'] = fn_get_image_pairs($product_id, 'product', 'MA', true, true, $lang_code);
}




and this, for gather_additional_products_data():


if ($params['get_icon'] == true || $params['get_detailed'] == true) {
$products_color_images = fn_get_image_pairs($product_ids, 'product', 'MA', $params['get_icon'], $params['get_detailed'], CART_LANGUAGE);
}
foreach ($products as &$_product) {
$product = $_product;
$product_id = $product['product_id'];

// Get images
if ($params['get_icon'] == true || $params['get_detailed'] == true) {

$product['main_image_colors'] = $products_color_images[$product_id];
}

}
}




How should I do it? Can you give me another hint?

I was look for your php controllers post, but no success. Maybe you have removed it?



Thanks

I think i might get starting to understand how those works, finally.

For get_product_data() i have done only this:



function fn_my_changes_get_product_data(&$product_id, &$get_add_pairs)
{

if ($get_add_pairs == true) {
$product_data['main_image_colors'] = fn_get_image_pairs($product_id, 'product', 'MA', true, true, $lang_code);
}

}




It works, but the images are not displayed, yet, in admin, in product page.

You must use the parameters being passed by the fn_set_hook() functions. You can't just invent them and use them.

I have no idea what you're trying to do. You are referencing things like $products_images[$product_id] but you have no variable defined called $products_images and hence assigning it does nothing.



You must not have looked very hard, the tutorial is on the first page in the Developer's section (PHP Controllers - 1 - Developers' Corner - CS-Cart Community Forums).

[quote name='tbirnseth' timestamp='1318354741' post='123446']

You must use the parameters being passed by the fn_set_hook() functions. You can't just invent them and use them.

I have no idea what you're trying to do. You are referencing things like $products_images[$product_id] but you have no variable defined called $products_images and hence assigning it does nothing.



You must not have looked very hard, the tutorial is on the first page in the Developer's section (http://forum.cs-cart…ew__getlastpost).

[/quote]

thanks, T

i have fount it now



In the function fn_get_product_data() i have the following hook:



fn_set_hook('get_product_data', $product_id, $field_list, $join, $auth, $lang_code);




i have dropped the parameters that i do not need and kept the required one, passed by reference: &$product_id



function fn_my_changes_get_product_data(&$product_id)
{

$product_data['main_image_colors'] = fn_get_image_pairs($product_id, 'product', 'MA', true, true, $lang_code);
//attaches the main_image_colors param, to $product_data array

}





the array returned is identical, like the $product_data[main_pair] for the main image.



i saw that, throught &$product_id param, the $product_data array is passed by into this function, from addons



but still, there is something that is missing…