Adding Code to Shipping.php

edited June 2013 in Shopping Cart plugin

Help! I need to have the ability to write the shipping address information to a .csv file so that I can import it to UPS.  Below is the code that I have written but can't seem to get it to work:  2 questions...  Am I using the correct fields and where should I put this in the shipping.php file?

 <?php
     $fname = $_POST['wpcoshipping[fname]'];
     $lname = $_POST['wpcoshipping[lname]'];
     $email = $_POST['wpcoshipping[email]'];
     $phone = $_POST['wpcoshipping[phone]'];
     $address = $_POST['wpcoshipping[address]'];
     $address2 = $_POST['wpcoshipping[address2]'];
     $city = $_POST['wpcoshipping[city]'];
     $state = $_POST['wpcoshipping[state]'];
     $country = $_POST['wpcoshipping[country]'];
     $zipcode = $_POST['wpcoshipping[zipcode]'];

     //the data
     $upsdata = $fname . "," . $lname . "," . $address . "," . $address2 . "," . "," . $city . "," . $state . "," . $zipcode . "," . $country . "," . $phone . "," . "," . $email . "," . "," . "," . "," . "," . "," ."\n";

     //open the file and choose the mode
     $fh = fopen("shipping.cvs", "a");
     fwrite($fh, $upsdata);

     //close the file
     fclose($fh);
     ?>

Comments

Sign In or Register to comment.