Forums / Addon Shipping Modules / UPS XML export to Worldship 9.0 import chokes on an "&"

UPS XML export to Worldship 9.0 import chokes on an "&"

Locked

Started by snowkrash on 11 Dec 2007, 11:09 AM · Views: 3,059

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
11 Dec 2007, 11:09 AM
#1
snowkrash avatar

snowkrash

New Zenner

Join Date:
Aug 2007
Posts:
65
Plugin Contributions:
0

UPS XML export to Worldship 9.0 import chokes on an "&"

Sorry, I mis-posted this in cofiguring shipping modules earlier.

UPS XML export to Worldship 9.0 import chokes on an "&" -- this is what I've figured out after a few hours of pain on the phone with UPS and my client.

I am using the UPS export XML mod and everything was working perfectly (when you install it, don't forget to change the database table names if yours are different... GoDaddy's auto install for Zen Cart suggests adding "zen_" to your database names, so if you do that, BE SURE that when you install mods with database names that you change the names to match what you have -- I learned that the hard way, and would have appreciated a little note about this in the install instructions for mods)... so Everything was working perfectly until:

One customer made a shipping address go to "Mr. & Mrs. Blah" -- The XML file chokes on ampersands that are not in quotes like this: "&"!

We cannot change the shipping address from the admin when we see an ampersand pop up -- OR CAN WE? If someone knows how to do this please help! So, if we can't change it in the admin, does anyone have a script to not allow the "&" to be input into any of those shipping address fields??? Is this something that already exists in the error-checking, but I can just add to it to check for an "&"

Any help is appreciated. When we try to export a ton of these a day, and the whole works comes to a grinding halt over this "&" it really messes up the day for everyone in our production line!

THANK YOU!!!!
:(
Kristin

16 Jan 2009, 4:35 PM
#2
haydeniv avatar

haydeniv

New Zenner

Join Date:
Feb 2005
Posts:
2
Plugin Contributions:
0

Re: UPS XML export to Worldship 9.0 import chokes on an "&"

I just did a simple str_replace() on the print_ups_xml.php file for the CompanyOrName and Attention xml fields. Here's what my file looks like starting at about line 140.
<ShipTo>
<CustomerID></CustomerID>
<CompanyOrName><?php if (!empty($order->delivery['company'])) echo str_replace("&","and",$order->delivery['company']); else echo str_replace("&","and",$order->delivery['name']); ?></CompanyOrName>
<Attention><?php

      if (!empty($order->delivery['company']))
           echo str_replace("&","and",$order->delivery['name']);
      ?></Attention>
      <Address1><?php echo $order->delivery['street_address']; ?> <?php echo $order->delivery['suburb']; ?></Address1>
      <Address2></Address2>
      <Address3></Address3>
      <CountryTerritory><?php echo ($order->delivery['country'] == 'United States') ? 'US': ''; ?></CountryTerritory>
      <PostalCode><?php echo $order->delivery['postcode']; ?></PostalCode>
      <CityOrTown><?php echo $order->delivery['city']; ?></CityOrTown>
      <StateProvinceCounty><?php echo $delivery_state; ?></StateProvinceCounty>
      <Telephone><?php echo $customer_phone; ?></Telephone>
      <FaxNumber></FaxNumber>
      <EmailAddress><?php echo $order->customer['email_address'];?></EmailAddress>
      <LocationID></LocationID>
      <ResidentialIndicator>1</ResidentialIndicator>
</ShipTo>

The key parts are:

echo str_replace("&","and",$order->delivery['company']);

and

echo str_replace("&","and",$order->delivery['name']);

and

echo str_replace("&","and",$order->delivery['name']);

Sorry about the crappy formatting. I can't figure out how to print out code nicely in this forum.