[ic] How to execute a usertag by clicking on a link or buttonwithin a page?

Tim Good tim.g at edsd.com
Thu May 13 12:14:52 EDT 2004


> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org 
> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf 
> Of Stefan Hornburg
> Sent: Thursday, May 13, 2004 9:46 AM
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] How to execute a usertag by clicking on a 
> link or buttonwithin a page?
> 
> 
> On Thu, 13 May 2004 09:36:43 -0600
> "Tim Good" <draco at edsd.com> wrote:
> 
> > Hello list,
> > 
> > What is the best way to execute a usertag by clicking on a link or 
> > button within a page? If I have [tag foo] and want to call this tag 
> > without leaving the page and return
> > the results to the page without leave page. This would appear to the
> > user as a link or
> > button and when they would click on it it would execute the tag. 
> > 
> > For instance:
> > 
> > <A HREF="[area href='admin/flex_select' 
> >    
> > 
> form='deleterecords=1&ui_delete_id=[sql-code]&mv_data_table=orderline
> >  
> > 
> &mv_click=db_maintenance&mv_action=back&mv_nextpage=@@MV_PAGE@@?order=
> > [l
> > oop-code]']"
> >    onClick="return confirm('Are you sure you want to delete item
> > [sql-code]?')">
> > 
> > Can be used to remove an item from an order where [sql-code] = item 
> > sku. However I would like to replace the [area] tag with my usertag 
> > and keep user on same page. Hope this makes sense.
> 
> No, it doesn't make sense. 
> 
> 	Racke
> 
Racke,

Sorry, I am not always good at explaining things.

What I want to do is be able to remove an item from an existing order.
I have searched the maillists and have not found that interchange has
this capability. So I am looking to add this capability. This would be
implemented in the Admin UI, specifically in the order_view page. I
would
like it to work similar to the entry page where the items are listed in
the cart. 
Except this would remove items from an existing order within the
order_view page
and recalulate the totals for the order in the transaction table and
other custom 
tables.

Senerio: 

User enters order with several items. Customer changes their mind on
which
items they would like. User then needs to log into Admin UI and change
the 
items in the order.

1) Am I recreating the wheel?

2) If I have a usertag (not a seasoned perl programmer and work in
progress
    so open for critque):

UserTag delitem Order curo
UserTag delitem PosNumber 2
UserTag delitem addAttr
UserTag delitem Routine <<EOR
sub {
        my ($curo,$delitem) = @_;
    
        my ($sql, $results, $deliteminfo, $itemsub, $iteminstall,
$totcst);
          
        $sql = "select * from orderline where order-number = $curo and
sku = $delitem";
        $deliteminfo = $Tag->query({ table=>'orderline', sql=>$sql,
wantarray=>1 });

        $sql = "delete from orderline where order_number = $curo and sku
= $delitem";
        $results = $Tag->query({ table=>'orderline', sql=>$sql });

        $totcst = o;
        $itemsub = $deliteminfo->[0]->[10];
        $iteminstall = $deliteminfo->[0]->[24];
        $totcst -= $itemsub + iteminstall;
        $sql = "update tranactions set total_cost = $totcst where
order_number = $curo";
        $results = $Tag->query({ table=>'transactions', sql=>$sql });
        
        return "@@MV_PAGE@@?order=$curo";
        
}
EOR

Can I use it in the order_view page at location below ... like this and
bring them back to order_view page?:

<!-- CUSTOMERS ORDER GRID -->
         <table width="100%" border=0 cellpadding=0 cellspacing=1
class=rseparator>
            <tr>
               <td width="3%" class=rhead style="padding:
5px">[L]Delete[/L]</td>
               <td width="14%" class=rhead style="padding:
5px">[L]Status[/L]</td>
               <td width="14%" class=rhead style="padding:
5px">[L]SKU[/L]</td>
               <td width="14%" class=rhead style="padding:
5px">[L]Name[/L]</td>
               <td width="14%" class=rhead style="padding: 5px;
text-align: right">[L]Qty[/L]</td>
               <td width="14%" class=rhead style="padding: 5px;
text-align: right">[L]Unit Price[/L]</td>
               <td width="14%" class=rhead style="padding: 5px;
text-align: right">[L]Extention[/L]</td>
            </tr>
[query list=1 table=orderline sql="select * from orderline where
order_number = '[loop-code]'"]
            <tr class="[sql-alternate
2]rowalt[else]rownorm[/else][/sql-alternate]" valign=top>
      ********my tag*******         <td><A
HREF="@@MV_PAGE@@?order=[loop-code]"
                            onClick="[delitem curo='[loop-code]'
delitem='[sql-code]']">
                   <IMG src="delsm.gif" ALT="DELETE [sql-code]"
BORDER=0></A>
               </td>
               <td style="padding: 5px">[page href="admin/order_status"
 
form="order=[loop-code]"
 
]
                [display    table=orderline
                            column=status
                            key="[sql-code]"
                            type=display
                ]</A>
[calc]
        $total_weight += ([field field=weight key="[sql-param sku]"] + 0
|| 0) * [sql-data orderline quantity];
        return;
[/calc]
               <td style="padding: 5px">[sql-param sku]</td>
               <td style="padding: 5px">
[sql-filter 30.][sql-param description][/sql-filter]
[if-sql-param size]
<br>[L]Size[/L]: [sql-param size]
[/if-sql-param]
[if-sql-param color]
<BR>
[L]Color[/L]: [sql-param color]
[/if-sql-param]

[if-sql-param options]
<BR>
[L]Options[/L]: [sql-param options]
[/if-sql-param]
                           </td>
               <td align=right style="padding: 5px">[sql-param
quantity]</td>
               <td align=right style="padding: 5px">[currency][sql-param
price][/currency]</td>
               <td align=right style="padding: 5px">[currency][sql-param
subtotal][/currency]</td>
            </tr>
[/query]

Thanks, 
Tim




More information about the interchange-users mailing list