eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
cool hacks
Affiliate hack / Log addresses  
sent in the following hack...

After a couple of years of using your script, here comes the time I contribute about 6 lines of code, but ... it is a terrific hack.

Because I am getting real tired of adding all the new clients to our access database each week, I thought I'd make another log-file, just for the addresses. I used the following code for that:

########### In the setup.db file ################

Just add this line
$sc_adres_log_file = "./Admin_files/adres.log";

Anywhere around this line:
$sc_order_log_file = "./Admin_files/orders.log";


########### In the order_lib.pl file ################

@@ Look for this text:

             #
                 # The entries in the log file
                 # are separated by two lines of
                 # 40 hyphens ("-" x 40)
                 #

Then add this to the file, above the   "if ($sc_send_order_to_log =~
/yes/i) {" line

## add this ####
$date           =       &get_date;
$user_name      =       $form_data{'01-name'};
$user_sexe      =       $form_data{'04-b_state'};
$user_adres     =       $form_data{'02-b_street_address'};
$user_pc        =       $form_data{'05-b_zip'};
$user_plaats    =       $form_data{'03-b_city'};
$user_land      =       $form_data{'06-b_country'};
## untill this ####

You then see the following lines in your script:

   if ($sc_send_order_to_log =~ /yes/i) {
     open (ORDERLOG, ">>$sc_order_log_file");
         ...
     close (ORDERLOG);
     }

Replace this with:

   if ($sc_send_order_to_log =~ /yes/i) {
     open (ORDERLOG, ">>$sc_order_log_file");
         ...
     close (ORDERLOG);

     open (ADRESLOG, ">>$sc_adres_log_file");
     print ADRESLOG
"$date|$cart_id|$user_sexe|$user_name|$user_adres|$user_pc|$user_plaats|$use
r_land \n";
     close (ADRESLOG);
     }

That's it, can it be more simple? :-)

As you can see, the only thing I tried to do is open a file and write the right stuff into that. I works great!!! It is such a simple hack, with so much added value to the script, that I think it is a great entry for the best hack of the month. It takes two minutes to cut and paste!!

Please Note:
It was Bill Stephenson's Affiliate code that made me think of this.

With kind regards,
Paul de Lange.

ps. You know what I am loving most of it? I have been trying all of the MySQL hacks because of the need for a simple pipe delimited address log from the order form. With a few simple queries in Access you can do anything with these variables.