Index: openacs-4/packages/ecommerce/www/admin/products/upload-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/upload-2.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/ecommerce/www/admin/products/upload-2.tcl 28 Aug 2008 12:03:55 -0000 1.11 +++ openacs-4/packages/ecommerce/www/admin/products/upload-2.tcl 18 Feb 2009 23:02:13 -0000 1.12 @@ -114,8 +114,9 @@ # Check if all the required fields have been given a value foreach required_field_name $required_field_names { - if {[set $required_field_name] == ""} { + if {[set $required_field_name] == "" && $required_field_name ne "product_name" } { incr errors + ns_log Notice "ecommerce/www/admin/products/upload-2.tcl: a required fieldname is blank: $required_field_name" } } @@ -144,7 +145,13 @@ set product_id [db_string product_check {select product_id from ec_products where sku = :sku;} -default ""] if { $product_id != ""} { + if { $product_name eq "" } { + # use existing product_name + ns_log Notice "ecommerce/www/admin/products/upload-2.tcl: working on sku $sku" + db_1row get_product_name_from_product_id "select product_name from ec_products where product_id = :product_id" + } + # We found a product_id for the given sku, let's # update the product. if { [catch {db_dml product_update " @@ -174,6 +181,7 @@ append doc_body "

FAILURE! Product update of $product_name failed with error:<\p>

$errmsg

" } else { append doc_body "

Updated $product_name

" + ecds_file_cache_product $product_id } } else { @@ -223,7 +231,7 @@ append doc_body "FAILURE! Product creation of $product_name failed with error:<\p>

$errmsg

" } else { append doc_body "

Created $product_name

" - + ecds_file_cache_product $product_id # we have to also write a row into ec_custom_product_field_values # for consistency with add*.tcl (added 1999-08-08, inadvertently removed 20020504) if { [catch {db_dml custom_product_field_insert "insert into ec_custom_product_field_values (product_id, last_modified, last_modifying_user, modified_ip_address) values (:product_id, now(), :user_id, :peeraddr)" } errmsg] } {