Hi,
I'm working on some code that allows me to print first class and priority delivery confirmation labels with the address and delivery confirmation label from the zen cart admin using the usps api. These labels do not have the postage printed on them, but it can be easily printed using dymo stamps (free w dymo label printer) or endicia instapostage ($10/month). One advantage of using this over the other contribution is you don't leave the admin page and you can print first class labels.
I will attach the code I have so far.
I would like others to look at it and see if they could use or if they could improve it in any way.
These are the things I would like to add to it:
1. Ability to save label
2. Ability to save tracking number
3. Print Multiple Labels
4. Print international labels.
More information about the api can be found here: http://www.usps.com/webtools/_pdf/De...nfirmation.pdf
or
http://www.usps.com/webtools/htm/Del...nfirmation.htm
This is set to only prints sample labels now and you will need a usps account number and you will need to be approved. More information about this can be found in the above links.
How to Install: (not on a live store)
In admin/orders.php
After this line (approx 394)
Code:
<tr>
<td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td>
<td class="main"><?php echo $order->info['payment_method']; ?></td>
</tr>
Add this:
Code:
<tr>
<td class="main"><strong>Delivery Confirmation Label</strong></td>
<td class="main">
<?
$address = $order->delivery; ?>
<form action="uspslabel.php" method="post">
<input type="hidden" name="name" value="<? echo $address['name']; ?>">
<input type="hidden" name="address" value="<? echo $address['street_address']; ?>">
<input type="hidden" name="city" value="<? echo $address['city']; ?>">
<input type="hidden" name="state" value="<? echo $address['state']; ?>">
<input type="hidden" name="zip" value="<? echo $address['postcode']; ?>">
<input type="hidden" name="orderid" value="<? echo $oID; ?>">
<input type="hidden" name="email" value="<? echo $order->customer['email_address']; ?>">
<input type="submit" value="Generate Delivery confirm label (US ONLY)">
</form>
</td>
</tr>
Edit the attached uspslabel.php.txt file and enter in your information where all the capitol letters appear. Remove the .txt ending.
Then, upload the uspslabel.php file to the /admin directory.
If you are interested, please look this over and provide feedback. If anyone can help improve this script please post here.
This is very basic, so please excuse the roughness of the code.
Bookmarks