Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Rapid data entry into UPS Worldship (2 clicks and a paste)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-26-2004, 09:37 PM
 
gardel gardel is offline
 

Member
  
Join Date: May 2004
Location: San Francisco
Posts: 20
 

Default Rapid data entry into UPS Worldship (2 clicks and a paste)

I really needed a way to facilitate entry of new orders into UPS Worldship. The following mod allows me to enter each field in the shipping information in Worldship with 2 left clicks and a Ctrl-V. It has drastically cut down the time it takes to create a single shipping label (for a domestic order, I can now do it in 10 seconds) and virtually eliminated entry errors in Worldship.

To do it, in xcart 3.5.7 (this will work on other versions, I am relatively certain), I inserted some javascript (put together from a few different javascript depositories) into main/order_invoice_print.tpl, and modified the invoice template.

If you're administering your store in Windows and you're interested in trying it (backup the files you'll be editing first, of course), here's the method:


Make a copy of mail/order_invoice.tpl and save it as mail/custom_order_invoice.tpl.



Enter the following bit of javascript in main/order_invoice_print.tpl. A good place to copy this code would be between the <body> and the <pre> statements near the top.


Code:
{literal} <script language="javascript" type="text/javascript"> <!-- function copy_clip(the_text) { if (window.clipboardData) { window.clipboardData.setData("Text", the_text); } else if (window.netscape) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return; var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) return; trans.addDataFlavor('text/unicode'); var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); var copytext=the_text; str.data=copytext; trans.setTransferData("text/unicode",str,copytext.length*2); var clipid=Components.interfaces.nsIClipboard; if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } } //--> </script> {/literal}


Also, in main/order_invoice_print.tpl, find the following line:

Code:
{ include file="mail/order_invoice.tpl" order=$orders_data[oi].order customer=$orders_data[oi].customer products=$orders_data[oi].products giftcerts=$orders_data[oi].giftcerts}

Replace it with:

Code:
{ include file="mail/custom_order_invoice.tpl" order=$orders_data[oi].order customer=$orders_data[oi].customer products=$orders_data[oi].products giftcerts=$orders_data[oi].giftcerts}

Now you'll need to edit lines in the mail/custom_order_invoice.tpl file you created. If you haven't changed your invoice template, you can just replace all of mail/custom_order_invoice.tpl with the following:

Code:
{* $Id: custom_order_invoice.tpl,v 1.0.0.0 2004/06/22 12:05:34 svowl Exp $ *} {config_load file="$skin_config"} {$lng.lbl_order_id}: #{$order.orderid} {$lng.lbl_order_date}: {$order.date|date_format:$config.Appearance.date_format} {$lng.lbl_order_status}: {include file="main/order_status.tpl" status=$order.status mode="static"} {if $order.tracking} {$lng.lbl_tracking_number}: {$order.tracking} {/if} {if $order.reg_numbers} {section name=rn loop=$order.reg_numbers} {if %rn.first%} {$lng.lbl_registration_number}: {/if} {$order.reg_numbers[rn]} {/section} {/if} {$lng.lbl_customer_info}: --------------------- {$lng.lbl_first_name}: {$order.firstname} {$lng.lbl_last_name}: {$order.lastname} <span onclick='return copy_clip("{$order.phone}")'> {$lng.lbl_phone}: {$order.phone} </span> {$lng.lbl_fax}: {$order.fax} {$lng.lbl_email}: {$order.email} {$lng.lbl_url}: {$order.url} {$lng.lbl_billing_address}: ---------------- {$lng.lbl_first_name}: {$order.b_firstname} {$lng.lbl_last_name}: {$order.b_lastname} {$lng.lbl_address}: {$order.b_address} {$lng.lbl_city}: {$order.b_city} {$lng.lbl_state}: {$order.b_statename} {$lng.lbl_country}: {$order.b_countryname} {$lng.lbl_zip_code}: {$order.b_zipcode} {$lng.lbl_shipping_address}: ----------------- <span onclick='return copy_clip("{$order.s_firstname} {$order.s_lastname}")'> {$lng.lbl_first_name}: {$order.s_firstname} {$lng.lbl_last_name}: {$order.s_lastname} </span> <span onclick='return copy_clip("{$order.s_address}")'> {$lng.lbl_address}: {$order.s_address} </span> <span onclick='return copy_clip("{$order.s_city}")'> {$lng.lbl_city}: {$order.s_city} </span> <span onclick='return copy_clip("{$order.s_statename}")'> {$lng.lbl_state}: {$order.s_statename} </span> {$lng.lbl_country}: {$order.s_countryname} <span onclick='return copy_clip("{$order.s_zipcode}")'> {$lng.lbl_zip_code}: {$order.s_zipcode} </span> {if $config.Email.show_cc_info eq "Y" and $show_order_details eq "Y"} {$lng.lbl_credit_card_information}: ------------------------ {$order.details} {/if} {include file="mail/order_data.tpl"}

The best way to use the click-and-paste functionality with UPS Worldship is as follows:

1. In admin, go to Orders. Enter the "Order status" of the orders you are going to ship (Processed is a good choice). Click on the "Search" button;

2. Go to the bottom of the page with your order list and click on the "Go" button next to "Print All";

3. Open UPS Worldship;

4. Arrange your browser window on one side of the screen as narrowly as you can while still seeing all the shipping information rows within the browser;

5. Put UPS Worldship on the other side of the screen. With enough resolution, you can have your Worldship and browsers on the screen together with no overlap between them;

6. With each order, you can now do the following:

In your browser, left click anywhere on the rows containing the shipping first name and the shipping last name. This will store the receipients name in the form "Firstname Lastname" to your clipbooard. Left click on the Name field in Worldship. Enter Ctrl-V and the name is pasted in the field.

Now left-click on the shipping address in the browser window, left click on the address in the Worldship window, press Ctrl-V and the address is pasted.

If it's a US order, you repeat the above for zip code, and for the recipient's phone number (Worldship fills in city and state automatically).

You've just entered the recipient's shipping information with a few clicks.

If you have changed the invoice template in xcart (and you probably should as what comes in the default distributiuon of xcart is both incomplete and very ugly), you'll have to make the changes to mail/custom_order_invoice.tpl (or whatever template you are now using to display invoices in main/order_invoice_print.tpl) manually for all the shipping fields.

It's quite easy to so. Wherever you display a portion of the shipping address you want to click, surround it with a <SPAN> like this (an example for a modified invoice template that has added the recipient's company information):

Code:
<span onclick='return copy_clip("{$order.company}")'>{$order.company}</span>

The above does not change the way an invoice displays on the screen nor the way it prints at all. In fact, there is nothing that tells you that clicking on, say the zip code, will save the zip code in your clipboard.

I hope this helps some of you until someone develops true integration between xcart and UPS Worldship
Reply With Quote
  #2  
Old 04-30-2005, 11:00 AM
 
jefferymac jefferymac is offline
 

Newbie
  
Join Date: Apr 2005
Posts: 2
 

Default Does it work in 4.x?

Can anyone confirm whether or not this mod works in 4.x?
__________________
Version 4.0.13
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:51 PM.

   

 
X-Cart forums © 2001-2020