Originally Posted by
greg_beyer
I've been using Export Order for years, but after a ZC update to v 1.55, it's behaving a little differently than it used to. This is causing me difficulty when using the resulting CSV for UPS Worldship batch imports.
First, the file datetime name format now has a "-" separating the date from the time, i.e. Orders081517-1423.csv, which UPS Worldship doesn't like. It used to be simply in the format "Orders0815171423.csv". How can I change the file format? I realize I could tell my fulfillment people to remove the "-", when they save the CSV file but they're not computer people, and I want to have as few changes in the old process as possible.
Second, and even more problematic is that the header row is exporting with spaces between words:
Order ID,Customer Email,Delivery Name,Delivery Street,Delivery Suburb,Delivery City,Delivery State,Delivery Post Code,Delivery Country,Ship Dest Type
Looking at the database tables, the columns are named thusly: Order_ID,Customer_Email,Delivery_Name,Delivery_Street, etc. I need the headers to export as they are in the database (and as UPS Worldship can read them) with "_ " between header column words. How can I change the exported .CSV to respect the original table column names?
Thanks very much for any guidance.
Looks like during the upgrade of your plugins you wiped out the customizations you'd made to that plugin's code.
To fix the hyphen in the filename, you'll need to remove it from line 51:
Code:
$file = (isset($_POST['filename']) ? $_POST['filename'] : "Orders".date('mdy-Hi'). $file_extension ."");
And for the spaces that you want to be underscores, starting at line 181 you'll see the column headings at the end of most of the lines:
Code:
/******************Begin Set Header Row Information*****************************/
$str_header = "Order ID,Customer Email";
if ($_POST['split_name'] == 1) { //If name split is desired then split it.
$str_header = $str_header . ",First Name,Last Name";
} else {
$str_header = $str_header . ",Delivery Name";
}
$str_header = $str_header . ",Company,Delivery Street,Delivery Suburb,Delivery City,Delivery State,Delivery Post Code,Delivery Country,Ship Dest Type"; // swguy
if ($_POST['shipmethod'] == 1) { $str_header = $str_header . ",Shipping Method"; };
if ($_POST['shiptotal'] == 1) { $str_header = $str_header . ",Shipping Total"; };
if ($_POST['customers_telephone'] == 1) { $str_header = $str_header . ",Customers Telephone"; };
if ($_POST['order_total'] == 1) { $str_header = $str_header . ",Order Total"; };
if ($_POST['date_purchased'] == 1) { $str_header = $str_header . ",Order Date"; };
if ($_POST['order_comments'] == 1) { $str_header = $str_header . ",Order Notes"; };
if ($_POST['order_tax'] == 1) { $str_header = $str_header . ",Order Tax"; };
if ($_POST['order_subtotal'] == 1) { $str_header = $str_header . ",Order Subtotal"; };
if ($_POST['order_discount'] == 1) { $str_header = $str_header . ",Order Discount"; };
if ($_POST['payment_method'] == 1) { $str_header = $str_header . ",Payment Method"; };
if ($_POST['orders_status_export'] == 1) { $str_header = $str_header . ",Order Status"; };
if ($_POST['iso_country2_code'] == 1) { $str_header = $str_header . ",ISO Country Code 2"; };
if ($_POST['iso_country3_code'] == 1) { $str_header = $str_header . ",ISO Country Code 3"; };
// if ($_POST['abbr_state_code'] == 1) { $str_header = $str_header . ",Abbr State Code"; };
if ($_POST['product_details'] == 1) { // add to header row
if ($_POST['filelayout'] == 2) { // 1 Product Per row RADIO
$str_header = $str_header . ",Product Qty,Products Price,Product Name,Product Model,Product Attributes";
} else { // File layout is 1 OPR
/**************the following exports 1 OPR attribs****************/
$oID = zen_db_prepare_input($order_details->fields['orders_id']);
$oIDME = $order_details->fields['orders_id'];
$order = new order($oID);
for ($i = 0, $n = $max_products; $i < $n; $i++) {
$str_header = $str_header . ",Product " . $i . " Qty";
$str_header = $str_header . ",Product " . $i . " Price";
$str_header = $str_header . ",Product " . $i . " Name";
$str_header = $str_header . ",Product " . $i . " Model";
$str_header = $str_header . ",Product " . $i . " Attributes";
}
/*****************************************************************/
} // End if to determine which header to use
} // end Row header if product details selected
$str_header = $str_header . "\n";
/******************End Header Row Information*****************************/
You'll need to adjust those again to suit your needs.
Bookmarks