Adding an additional field to product options

Is it possible to add an additional field to the product options through an add-on? The value of the field wouldn't be displayed anywhere but in admin but it would be used for creating colour previews (I want to store the hex value of a colour in a separate field to the name). Is this possible?

Hi,

I can make the addon, please PM me if you are interested



Sincerely yours,





Valentin

I'll take that as a yes, its possible then. Anyone else willing to point me in the right direction?

What cs-cart version are you using?





Valentin

This is what you are looking for ?





I have done it for v3.x

My example, option is named color, variant white and custom field has value #fffffff





Valentin

version is 3.0.5



Yes, that is the sort of thing I'm looking to achieve.

You can download from here: [url=“http://www.hungryweb.net/cs-cart/addons/option_custom_field_3.x.zip”]http://www.hungryweb.net/cs-cart/addons/option_custom_field_3.x.zip[/url]



You are welcome.





Valentin

I installed the add-on and the input field is shown but the data isn't saved

I managed to get into the database and the data is saved on the record but isn't being displayed

I changed the hook to get_product_option_data_pre and it works now



if ( !defined('AREA') ) { die('Access denied'); }
function fn_option_custom_field_get_product_option_data_pre( $option_id, $product_id, $fields, $condition, $join, &$extra_variant_fields, $lang_code){
if(empty($extra_variant_fields)) $extra_variant_fields .= 'a.custom_field, ';
}

[quote name=‘Vali’ timestamp=‘1359396555’ post=‘153840’]

You can download from here: http://www.hungryweb…m_field_3.x.zip



You are welcome.





Valentin

[/quote]



That was a very generous contribution you have provided Vali ! ;-) (Even if the benefitting recipient can’t realize this… )

Thank you for @Struck for the appreciation