Import product data to table in db problem: on product - many imported rows

Hi,

I made new addons in my cscart (v2.0.12) and In database table created new table.

I need to import into table data many records, but for the same product_code.





My code:

$schema = array (

#section’ => ‘products’,

#name’ => fn_get_lang_var(‘dostepnosc’),

#pattern_id’ => ‘dostepnosc’,

#key’ => array(‘product_code’),

#table’ => ‘dostepnosc’,

#range_options’ => array (

#selector_url’ => INDEX_SCRIPT . ‘?dispatch=products.manage’,

#object_name’ => fn_get_lang_var(‘products’),

),

#export_fields’ => array (

‘Product ID’ => array (

#required’ => true,

#alt_key’ => true,

#db_field’ => ‘product_code’

),

‘Status 1’ => array (

#required’ => true,

#db_field’ => ‘status1’

),

‘Name’ => array (

#required’ => true,

#db_field’ => ‘name’

),

‘Name 2=> array (

#required’ => true,

#db_field’ => ‘name2’

),

‘Status 2’ => array (

#required’ => true,

#db_field’ => ‘status2’,

),

),

);





but when I import file with data like below:



“CODE1” “name1” 1 1 “State 1”

“CODE1” “name1” 1 2 “State 2”

“CODE1” “name2” 1 3 “State 3”

“CODE1” “name3” 1 1 “State 4”

“CODE1” “name1” 1 2 “State 5”



after import I have only one record in table (I expect it will be 5 records…)

How can I modify the script to write more than 1 record for the same product_code? When I remove "’#alt_key’ => true," - cscart show me a error message.



What I make wrong?

(Sorry, my english isn’t perfect ;))

please use code tags so that info is formatted. Too hard to decipher otherwise.

The product code is like a symbolic lookup of a product_id. So when you repeat the product_code, you are essentially overwriting your previous data. My guess is you are ending up with data from the last line of your import.