[comment] ui_template: Yes ui_template_name: leftonly [/comment] [tmp members_only]1[/tmp] [tmp page_title]__COMPANY__ -- [L]Order History[/L][/tmp] [control reset=1] [control-set] [component]search_box_small[/component] [/control-set] [control-set] [component]category_vertical[/component] [/control-set] [control-set] [component]cart_tiny[/component] [/control-set] [control reset=1] @_LEFTONLY_TOP_@ [tmp ugly_dbm][/tmp] [calc] return if $Config->{Database}{transactions}{Class} =~ /DBI/; $Scratch->{ugly_dbm} = 1; return; [/calc] [if scratch ugly_dbm] [index table=transactions export-only=1] [index table=orderline export-only=1] [/if] [query table=transactions arrayref=orders sql="SELECT code,status,tracking_number,nitems,subtotal,shipping,handling,total_cost,payment_method,order_date FROM transactions WHERE username = '[data base=session field=username filter=sql]' ORDER by code "] [/query] [mvasp tables=transactions] <% my $uid = $Session->{username}; if (! $uid) { $Document->write ("You are not logged in."); return; } my $orders = $Tmp->{orders}; if(! $orders or scalar @$orders == 0) { $Document->write( "No pending orders for $uid."); return; } HTML ""; my $header_template = <<'EOF'; EOF my $line_template = <<'EOF'; EOF my %hash; my @fields = qw/order_number status tracking_number nitems subtotal shipping handling total_cost payment_method order_date/; my $row; my %summary; my $first; my $record; HTML $header_template; foreach $record (@$orders) { my $line = $line_template; @hash{@fields} = @$record; $hash{detail_url} = $Tag->area( { href => 'query/order_detail', arg => $hash{order_number}, }); my $status = errmsg($hash{status}); my $tracking; if($hash{tracking_number}) { $tracking = $hash{tracking_number}; } elsif($hash{status} =~ /\d/) { $status = errmsg('shipped'); $tracking = $hash{status}; } if($status) { $hash{status} = <$hash{status} EOF } if($tracking) { Debug("found tracking $tracking"); my @ids = grep /\S/, split /\s+/, $tracking; my $tpl = $Variable->{TRACKING_NUMBER_QUERY} || <UPS {TRACKING_NUMBER} EOF for(@ids) { Debug("found id $_"); my $val = $tpl; $val =~ s/{TRACKING_NUMBER}/$_/g; $hash{status} .= $val; } } for(qw/subtotal shipping total_cost/) { $hash{$_} = $Tag->currency ({ body=> $hash{$_} }); } if($hash{handling}) { $hash{handling} = "
(handling " . $Tag->currency ({ body=> $hash{handling} }) . ")"; } else { $hash{handling} = ''; } $line =~ s/\$(\w+)/$hash{$1}/g; HTML $line; } HTML "
[L]DATE[/L] [L]ORDER ID[/L] [L]QTY
TOTAL[/L]
[L]PAYMENT
METHOD[/L]
[L]SUBTOTAL[/L] [L]SHIPPING
HANDLING[/L]
[L]TOTAL[/L] [L]STATUS[/L]
$order_date $order_number $nitems $payment_method  $subtotal $shipping$handling $total_cost $status
"; %> [/mvasp]
@_LEFTONLY_BOTTOM_@