[ic] perl db question, problems when modifying admin

edmz interchange-users@interchange.redhat.com
Thu Feb 14 18:17:01 2002


I am adding another page to the admin, for new products. Since my
store doesnt carry all the products from the distributor, I have
created a table that holds all the new products. Someone
will manually check the list and only import certain products
to the database.

Searching the admin pages, I found that customer.html was very
close to what I needed, so I modified a copy of it. Now
I can browse all the new products and remove the unwanted but
I am having problem importing them.

I dont know how to insert a new record in the DB nor how
to get the item data to fill the query.

My approach was something like:

[perl tables="new_products products"]
         my $db = $Db{new_products};
         ...
         ...
         ...
        if($CGI->{imporitem}){
           my $dbtemp = $DB{products};
           for(grep $_, @{$CGI_array->{itemsku}}) {
              $dbtemp->set_field($_, "sku", $_);
              $dbtemp->set_field($_, "description", $db->field($_,
"description") );
              #erase record from "new_products" table
              $db->delete_record($_);
            }
        }
        ..
        ..


I know for sure that I get all the itemsku's, its the db handling that I
dont know how to handle.

ANy ideas are appreciated. I have tried different approaches without
success.
I would preferably use perl instead of ITL.

--
edmz


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com