Welcome Guest, Not a member yet? Register   Sign In
Endicia
#5

[eluser]Dave Rau[/eluser]
Here's a quick dump of my file that generates the XML for Endicia; I'd really like to see your international piece for the customs form. Are you passing this info to Endicia for Mac?

Code:
// start XML here, Content-Disposition forces a download rather than display in browser
header('Content-type: application/xml');
header('Content-Disposition: attachment; filename="endicia-' . date("YMdHi") . '.xml"');
//echo "<pre>";
echo "<DAZzle Start=\"PRINTING\" Prompt=\"NO\" OutputFile=\"~/Documents/endicia-out-" . date("YMdHi") . ".xml\" Test=\"" . ( $endicia_test ? YES : NO ) . "\">\r\n";

$package_id = 1;
foreach ($orders as $cust) {

    // split customer fields up a bit
    extract($cust, EXTR_PREFIX_ALL, 'cust');
    $cust_postage = TRUE;

    // try to fit all lines on one label, if not possible loop back again
    while (count($cust_orders)) {

        echo "<Package ID=\"$package_id\">\r\n";
        $reference_id = date('ymdHis') . $package_id;
        echo "    <ReferenceID>$reference_id</ReferenceID>\r\n";
        if ($cust_address_country == 'United States') {
        echo "    <MailClass>PRIORITY</MailClass>\r\n";
        } else if ($cust_source == "shana") {
        echo "    <MailClass>PRIORITY</MailClass>\r\n";
        } else { echo "    <MailClass>NONE</MailClass>\r\n";
        }
        if ($cust_source == "shana") echo "    <Services DeliveryConfirmation=\"ON\"></Services>\r\n";
        $cust_postage = FALSE;

        // shana type orders will not have a customer name so "via shana" will be used instead
        $addressee = trim("$cust_first_name $cust_last_name\r\n$cust_address_street\r\n$cust_memo");
        if ($line = strtok($addressee, "\r\n")) echo "    <ToName>$line ($cust_weight)</ToName>\r\n";
        if ($line = strtok("\r\n")) echo "    <ToAddress1>$line</ToAddress1>\r\n";
        if ($line = strtok("\r\n")) echo "    <ToAddress2>$line</ToAddress2>\r\n";
        if ($line = strtok("\r\n")) echo "    <ToAddress3>$line</ToAddress3>\r\n";
        if ($line = strtok("\r\n")) echo "    <ToAddress4>$line</ToAddress4>\r\n";
        if ($line = strtok("\r\n")) echo "    <ToAddress5>$line</ToAddress5>\r\n";
        if ($line = strtok("\r\n")) echo "    <ToAddress6>$line</ToAddress6>\r\n";
        echo "    <ToCity>$cust_address_city</ToCity>\r\n";
        echo "    <ToState>$cust_address_state</ToState>\r\n";
        echo "    <ToPostalCode>$cust_address_zip</ToPostalCode>\r\n";
        if ($cust_address_country != 'United States') echo "    <ToCountry>$cust_address_country</ToCountry>\r\n";
        echo "    <Weight>$cust_weight</Weight>\r\n";
        echo "    <ReferenceID>$cust_custid</ReferenceID>\r\n";
        if ($cust_source == 'shana') $cust_description = "*shana order* ";
        else $cust_description = "";

        // this is where we print the orders, maybe one per label or five per label
        $num_orders = 0;
        while (count($cust_orders)) {
            extract(array_shift($cust_orders), EXTR_PREFIX_ALL, 'order');
            $order_size = strtoupper($order_size);
            if ($endicia_multiple) {
                $cust_description .= "{$order_qty}x $order_name $order_size\r\n";
                break;
            }
            $num_orders++;
            echo "    <CustomsQuantity{$num_orders}>$order_qty</CustomsQuantity{$num_orders}>\r\n";
            echo "    <CustomsWeight{$num_orders}>$order_weight</CustomsWeight{$num_orders}>\r\n";
            echo "    <CustomsDescription{$num_orders}>$order_name $order_size</CustomsDescription{$num_orders}>\r\n";

            if (num_orders >= 5) break;
        }

        if ($cust_description) echo "    <Description>$cust_description</Description>\r\n";

        echo "</Package>\r\n";
        $package_id++;

    }

}

echo "</DAZzle>\r\n";


Messages In This Thread
Endicia - by El Forum - 09-04-2008, 05:20 PM
Endicia - by El Forum - 09-05-2008, 07:44 AM
Endicia - by El Forum - 09-05-2008, 09:26 AM
Endicia - by El Forum - 09-06-2008, 05:40 PM
Endicia - by El Forum - 09-06-2008, 07:37 PM
Endicia - by El Forum - 09-07-2008, 02:38 AM
Endicia - by El Forum - 09-09-2008, 08:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB