"LIBRARYMAIL",54=>"BOUNDPRINTEDMATTER",53=>"FIRST",52=>"PRIORITY",51=>"PARCELPOST",50=>"EXPRESS",56=>"MEDIAMAIL",57=>"INTLGEM",58=>"PARCELPOST",59=>"PRIORITY",60=>"INTLGXG",61=>"INTLGXGNODOC",62=>"MEDIAMAIL",63=>"MEDIAMAIL",69=>"PRIORITY",70=>"PRIORITY",100=>"INTLGPM",102=>"INTLAIRLETTER",111=>"INTLGPMFRSMALL",112=>"INTLGPMFRSMALL",130=>"INTLGPMFRLARGE",131=>"INTLGPM"); // product IDs from products we ship from the office. // Not necessary if everything you ship is local, however this is useful if you have drop-shipped products in your store $shipfromlocal = array(2,3,4,17,18); // Each product ID along with a brief description suitable for customs forms $customsdesc = array(2=>"Book",3=>"Compact Disc",4=>"T-Shirt",17=>"Book",18=>"Books"); ob_start(); $result = mysql_query("SELECT o.orderid,o.shippingid,o.total,o.s_firstname,o.s_lastname,o.s_address,o.s_city,o.s_state,o.s_country,o.s_zipcode,o.phone,o.email,SUM(p.weight) as weight FROM xcart_orders o,xcart_order_details d,xcart_products p LEFT JOIN xcart_shipping s ON o.shippingid=s.shippingid WHERE s.code='USPS' AND o.status='P' AND d.orderid=o.orderid AND d.productid=p.productid AND d.productid IN (".implode(",",$shipfromlocal).") GROUP BY o.orderid"); ?> ".$methods[$row[shippingid]]." 0 FALSE FALSE $row[weight] "; if ($row[s_country]=="US") { echo " "; } else { echo " "; } echo "$row[total] Product Description "; if ($row[s_country]!="US") { echo "United States CN22 "; $details = mysql_query("SELECT d.amount,p.weight,d.productid,d.price FROM xcart_order_details d,xcart_products p WHERE d.productid=p.productid AND d.productid IN (".implode(",",$shipfromlocal).") AND d.orderid=".intval($row[orderid])); $customcount = 1; while ($row2 = mysql_fetch_array($details)) { echo "$row2[amount] ".($row2[weight]*16)." ".$customsdesc[$row2[productid]]." $row2[price] "; $countryquery = mysql_query("SELECT value FROM xcart_languages WHERE name='country_".$row[s_country]."' AND topic='Countries'"); $countryname = mysql_result($countryquery,0,"value"); echo "$countryname "; $customcount++; } } echo "$row[orderid] $row[s_firstname] $row[s_lastname] ".str_replace("\x0A"," ",ucwords(trim($row[s_address])))." ".ucwords(trim($row[s_city]))." $row[s_state] $row[s_zipcode] $row[email] $row[s_country] "; $counter++; } ?>