[ic] loading arbitrary, un-templated page in Admin UI

Stewart Barnett stewbarnett at wsac.com
Tue Aug 17 13:58:41 EDT 2004

On 16 Aug 2004 at 18:48, david yee wrote:

> so....
> i have cobbled together a nicely laid-out receipt to display after an
> order has been shipped, so that our shipping folk may print it out and
> include it in the box to be delivered, but i don't want it to have all
> the standard UI stuff around it (i've written a separate stylesheet to
> handle just the items on the receipt).
> what i *do* want is for it to be loadable only from within the Admin
> UI by authorized users.  what part of the UI_STD_HEAD will perform
> that test for me?
> best
> david
> -- 
> david yee
> iamyee at gmail.com

Here is a solution for printing shipping labels that I'm sure alot of people have to 

I just add this line
[print_label [loop-code] labeldef]
to my orderview page near the shipping address. That generates a "Print Label" button.

add this usertag to the catalog

UserTag print_label Order ordernum template
UserTag print_label Routine <<EOR
sub {
my ($ordernum, $template) = @_;
$ordernum ||= 1;
$template ||= 'labeldef.html';
my $href = $Tag->area({
href => $template,
arg => $ordernum,
return qq{<input type="button" value="Print Label" 

create a template using the example at the end of this message

Tag Overview
Prints a shipping label using the browser.
[print_label ordernum template]
[print_label ordernum=1000 template=admin/labeldef]
Positional parameters: The first line shows the usage with positional parameters (given 
in order). The second line shows usage with named parameters.
Parameters Description Default
ordernum The ordernumber to print from none
template The filename of layout to print labeldef.html
Invalidates cache No
Macro No
Has end tag No
Tag expansion example:
[print_label 1000 shiplabel.html]
[print_label ordernum=1000 template=shiplabel.html]
ASP-like Perl call:
$Tag->print_label( { ordernum => 1000,
template => shiplabel.html} );

Quickly adds a print labelbutton to your pages without having to type the html each 
time. The template name can be passed by setting the appropriate parameter. The 
button launches a child window that will auto print itself and close itself when the print 
dialog is clear.
Pass the ordernumber of the order you want to call the print function.
Set to the filename that the print function should use as a template for the information 
you want to print.

Template example: labeldef.html
<head><title>Label Print</title></head>
[loop list="[cgi mv_arg]"]
__CITY__ __STATE__ __ZIP__<br>
[loop-data transactions fname] [loop-data transactions lname]<br>
[loop-data transactions address1]<br>
[if-loop-data transactions address2]
[loop-data transactions address2]<br>
[loop-data transactions city], [loop-data transactions state] [loop-data transactions 
<script language=JavaScript><!-- //
if (window.print) self.print();

*** usertag, print_label

More information about the interchange-users mailing list