Saving Multiple Fields Of Product Data Into One Column In Database

Hi. I have some fields in product page like product_data[field_a], product_data[field_b], product_data[field_c], etc.. I don't want save these fields different colums like field_a, field_b, field_c in products table when I saved the product. I want to aggregate these values into one column in the table.

product_data[field_a], product_data[field_b], product_data[field_c] are going to be saved into just one column named like all_values.

How to do this?

Here is the code part:

 {foreach from=$specs item=s}
 {assign var="values" value="|"|explode:$s.value} 

{/foreach}

There are more than one select box data and I need to save them into one column.

If what you're saying is that you have select boxes that are returning 3 different values and you want to aggregate them into one and then store it in the product table, What's preventing you from:

$aggregated = implode(',',array('$formval1, $formval2, $formval3));
// assuming you've created a cscart_products.my_value column
db_qurey("UPDATE ?:products SET my_value=?s WHERE product_id=?i", $aggregated, $_REQUEST['product_id]);

I must be misunderstanding what you're trying to do.

My codes are in in /hooks/products/update_detailed_images.post.tpl file. So, I can't use PHP in tpl file.

The values of the selectboxes come from another table. And I need to select values from each select box and save these values into just one column.

So, I need to aggregate them into an array and save to the column in ?:products.

Sorry, I can't see the picture here of what you have and what you want to do.

If you want to aggregate values from select boxes and update the DB, you will need to POST those values, parse them, aggregate them and then save them in the PHP controller.

Sorry, I can't see the picture here of what you have and what you want to do.

If you want to aggregate values from select boxes and update the DB, you will need to POST those values, parse them, aggregate them and then save them in the PHP controller.

Thanks tbirnseth. I have found the way how to do.