USPS Click N Ship Link in Vendor Email

Goal: For vendor to receive email after sale with a link which they can click which will auto-fill USPS Click n Ship with Origin & Destination information. Luckily vendor emails can be simply enabled in the Admin Panel, the code for the USPS link needs to be written and attached to email. This will drastically speed up the online postage process for the vendor.



What’s currently complete: Everything besides total weight calculation of all products on invoice.



Problem: The code is nearly complete, however I am wondering if anyone knows where I can quickly access the total weight of an invoice in the CS Cart Database. I’m not sure if a total weight is stored anywhere, or if logic needs to be written to add weights of all products in Invoice.



I am working on this problem this evening, please reply if you have thoughts or suggestions.



Thanks

Hello, husseinsharif!



Unfortunately, there is no total weight information in CS-Cart database. But you can find weight info in {$order_info.shipping…} You will need to sum up product weights if more than one product is to be shipped.



Best regards, Alt-team

Great - thanks for this info. Perhaps I'm new, but I'm not understanding $order_info thoroughly



Is $order_info.shipping an array which contains info regarding a specific order for shipping?



Any idea where $order_info is assembled so I can take a look at the code and understand how it's all put together?



I am working within invoice.tpl by the way.



Your help is greatly appreciated



Hussein

Yes, you are right, $order_info.shipping is an array which contains info regarding a specific order for shipping. $order_info.shipping variable is in invoice.tpl file (skins/basic/mail/orders/invoice.tpl).

Try to find this piece of code

```php {if $tracking_number_exists}


{$lang.tracking_number}:

{foreach from=$order_info.shipping item="shipping" name="f_shipp"}
{if $shipping.tracking_number}{$shipping.tracking_number}{if !$smarty.foreach.f_shipp.last},{/if}{/if}
{/foreach} ```
You need to do some programming to add total weight calculation on invoice.

Best regards, Alt-team

Thank you Alt-Team for your informative responses. Your information + Smarty Template debugging helped me solve the problem.



I've found and inserted the total product weight of the invoice into the USPS link…



at this point, the link in the order completion email fully auto-populates the USPS Click N Ship form with the information already provided to CS Cart from the customer.



If anyone would like this code - please let me know!