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

[eluser]Chris Newton[/eluser]
Does anyone have any experience using Endicia (for auto postage label generation) If so, respond here, or PM me. I need to create libraries to handle endicia stuff and there's nothing prebuilt out there. Sending & receiving endicia stuff aren't that tough, but it looks like actually creating a label from the generated XML is going to be a bit of a pain, and I'm a bit short on time to guarantee that I'll get it done in the next few weeks. Any help free, paid, or otherwise would be greatly appreciated.
#2

[eluser]Dave Rau[/eluser]
Hey mahuti, I've got some code at home that generates Endicia XML for postage labels, I can post some code later tonight. One thing I'm stuck on is international shipping since Endicia for Mac doesn't seem to support customs info via XML, but the Windows counterpart called Dazzle does. Talk about lame! I've tried running Dazzle on an intel Mac and the interface is completely and totally useless. I can't believe Endicia and Dazzle are created by the same company.

Do you have any info about Endicia and XML regarding customs info? Maybe a new version is out or there is a workaround that I'm unaware of.

I'll post some code for you later, but it will be basic PHP. Will that be helpful?
#3

[eluser]Chris Newton[/eluser]
OH sure, anything you have will be better than what i have.

As for what I'll be using to create the postage labels... PHP. I'm going to have to take the XML back from Endicia using their label server and generate an HTML / PDF doc on the fly. So.... if I get that (at least basically done) that'll pretty well solve your issue as well.
#4

[eluser]Chris Newton[/eluser]
I have a working generator now. Basically it hits endicia's label server and can spit out a JPG on the fly. I'm pretty sure it can do international & customs as well. I don't have time to look into it now, but when we have our stuff wrapped up, I'll see about posting the code somewhere publicly available.
#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";
#6

[eluser]Chris Newton[/eluser]
I'm not passing it to anything. I'm hitting http://www.endicia.com/Developers/LabelServer/ and spitting out a JPG of the XML generated label on my server.

If Endicia for the Mac is problem causing, you could do something like I'm doing to generate JPGs on the fly and output them to a watched folder. Run a cron job to print them or FTP them directly to your mac, or run it on a server on your mac and use something like Hazel to watch a folder and then print the output.

For ref:
http://www.endicia.com/Features/InternationalMail/
The Endicia API has some pretty straightforward guidlines on generating international mail. The main trick is to then get the XML back and turn it into an image. What I've got going takes care of that part.

I'll take a look at your code, thanks for posting. I think we're doing 2 totally different solutions here to the same problem. I've attached a low-res version of the file I'm generating for reference.
#7

[eluser]Dave Rau[/eluser]
Well, I'm taking a queue of orders and trying to accomplish batch label printing for 20-50 orders a day. About 10+ of which are international and require the customs info. I'll check out that link later tonight, thanks. I'm also interested in any code you'd like to share.




Theme © iAndrew 2016 - Forum software by © MyBB