[comment]
ui_template: Yes
ui_template_name: leftonly
[/comment]
[tmp members_only]1[/tmp]
[tmp page_title]__COMPANY__ -- [L]Process Order Return[/L][/tmp]
[control reset=1]
[control-set]
[component]search_box_small[/component]
[/control-set]
[control-set]
[component]cart_tiny[/component]
[/control-set]
[control-set]
[component]category_vertical[/component]
[/control-set]
[control-set]
[component][/component]
[/control-set]
[control-set]
[component]random[/component]
[size]3[/size]
[cols]3[/cols]
[/control-set]
[control reset=1]
@_LEFTONLY_TOP_@
[if !cgi return_items]
[L]No items were selected for return.[/L]
[L]Please use your browser's back button to return to the order and select at least one item from the order to return.[/L]
[else]
[set ret_num_items][/set]
[set qty_over][/set]
[perl tables="orderline"]
my @items = split /\0/, $CGI->{return_items};
my $num_items = @items;
$Scratch->{ret_num_items} = $num_items;
my $count = 0;
my $amount3 = 0;
my $total_qty = 0;
my $detail;
foreach (@items) {
my $code = @items[$count];
$detail .= $Tag->data('orderline', 'sku', $code) . "\t";
my $qty1 = $Tag->data('orderline', 'quantity', $code);
my $amount1 = $Tag->data('orderline', 'price', $code);
my $code = "qty-$code";
my $qty2 = $Values->{$code};
$detail .= "$qty2\t";
my $amount2 = $amount1 * $qty2;
$detail .= $Tag->currency( {}, $amount2 ) . "\n";
$amount3 = $amount2 + $amount3;
$total_qty = $qty2 + $total_qty;
$Scratch->{return_credit} = $amount3;
$Scratch->{total_qty} = $total_qty;
if($qty1 < $qty2) {
$Scratch->{qty_over} = 1;
}
$count ++;
}
$Tag->tmp( { name => 'return_detail' }, $detail );
[/perl]
[if scratch qty_over]
[L]You may not return more items than you originally purchased.[/L]
[L]Please use your browser's back to enter a more appropriate value.[/L]
[elsif scratch total_qty == 0]
[L]You need to indicated the quantity of items you wish to return.[/L]
[L]Please use your browser's back to enter a more appropriate value.[/L]
[/elsif]
[else]
[seti rma_number][counter etc/rma.number][/seti]
[L PROCESS_RETURNS_PAR1]Your return has been processed. Please ship the item(s) to the address
below and your account will be credited for the returned amount.
A return confirmation has also been emailed to you.[/L]
[L]Be sure to list the RMA number issued below on your shipping label.[/L]
__COMPANY__
__ADDRESS__
__CITY__
[L]RMA Number[/L]: |
[scratch rma_number] |
|
[L]Order Number[/L]: |
[value order_number] |
[L]Number Of Items[/L]: |
[scratch total_qty] |
[L]Approximate Credit[/L]: |
[currency][scratch return_credit][/currency] |
|
[L]Returned Items Detail[/L] |
[L]SKU[/L] |
[L]Quantity[/L] |
[L]Extension[/L] |
[loop delimiter="\n" arg="[scratch return_detail]"]
[loop prefix=line delimiter="\t" arg="[loop-code]"]
[line-code] |
[/loop]
[/loop]
[set name=return1 interpolate=1]
[comment] SEND REPORT OF NEW RETURN TO SHOP OWNER [/comment]
[email
to="__COMPANY__ <__ORDERS_TO__>"
subject="__COMPANY__ - RMA: [scratch rma_number]"
from="[value email] <[value email]>"
reply="[value email] <[value email]>"]
[L]Return request received.[/L]
[L]Company[/L]: [value company]
[L]Name[/L]: [value fname] [value lname]
[L]Email[/L]: [value email]
[L]Day Phone[/L]: [value phone_day]
[L]Evening Phone[/L]: [value phone_night]
[L]RMA Number[/L]: [scratch rma_number]
[L]Date Issued[/L]: [tag time]%Y%m%d %H:%M:%S[/tag]
[L]Order Number[/L]: [value order_number]
[L]Item Quantity[/L]: [scratch total_qty]
[L]Credit Amount[/L]: [currency][scratch return_credit][/currency]
[row 80]
[column width=25][/column]
[column width=30]
[L]Returned Items Detail[/L]
[/column]
[column width=25][/column]
[/row]
[row 80]
[column width=18][/column]
[column width=15 align=left]
[L]SKU[/L]
[/column]
[column width=15 align=left]
[L]Quantity[/L]
[/column]
[column width=15 align=left]
[L]Extension[/L]
[/column]
[/column width=17][/column]
[/row]
[loop delimiter="\n" arg="[scratch return_detail]"]
[row 80]
[column width=18][/column]
[loop prefix=line delimiter="\t" arg="[loop-code]"]
[column width=15 align=left]
[line-code]
[/column]
[/loop]
[/column width=17][/column]
[/row]
[/loop]
[/email]
[/set]
[set name=return1 interpolate=1]
[comment] SEND RETURN SUMMARY TO CUSTOMER [/comment]
[email
to="[value email]"
subject="__COMPANY__ - RMA: [scratch rma_number]"
from="__COMPANY__ <__ORDERS_TO__>"
reply="__COMPANY__ <__ORDERS_TO__>"]
[msg arg.0="__COMPANY__"]Hello and thank you for your interest in %s products.[/msg]
[L]We have received your return request and have issued you an RMA number.[/L]
[L]Please use the information below to process your return[/L]:
[L]Shipping Address[/L]:
__COMPANY__
__ADDRESS__
__CITY__
[L]Return Info[/L]:
[L]RMA Number[/L]: [scratch rma_number]
[L]Date Issued[/L]: [tag time]%Y%m%d %H:%M:%S[/tag]
[L]Order Number[/L]: [value order_number]
[L]Item Quantity[/L]: [scratch total_qty]
[L]Credit Amount[/L]: [currency][scratch return_credit][/currency]
[row 80]
[column width=25][/column]
[column width=30]
[L]Returned Items Detail[/L]
[/column]
[column width=25][/column]
[/row]
[row 80]
[column width=18][/column]
[column width=15 align=left]
[L]SKU[/L]
[/column]
[column width=15 align=left]
[L]Quantity[/L]
[/column]
[column width=15 align=left]
[L]Extension[/L]
[/column]
[/column width=17][/column]
[/row]
[loop delimiter="\n" arg="[scratch return_detail]"]
[row 80]
[column width=18][/column]
[loop prefix=line delimiter="\t" arg="[loop-code]"]
[column width=15 align=left]
[line-code]
[/column]
[/loop]
[/column width=17][/column]
[/row]
[/loop]
[/email]
[/set]
[seti return_number][counter etc/return.number][/seti]
[comment] ADD ENTRY TO RETURN DATABASE [/comment]
[seti add_return]
[tag flag write]order_returns[/tag]
[try]
[import table=order_returns type=LINE continue=NOTES]
code: [scratch return_number]
order_number: [value order_number]
session__MVC_FIELDMUNGE__: [data session id]
username: [data session username]
rma_number: [scratch rma_number]
nitems: [scratch total_qty]
total: [scratch return_credit]
return_date: [tag time]%Y%m%d %H:%M:%S[/tag]
update_date:
[/import]
[/try]
[catch] There was an error adding the new address entry. [/catch]
[/seti]
[comment] UPDATE ORDER STATUS IN TRANSACTIONS [/comment]
[seti update_status]
[tag flag write]transactions[/tag]
[data
table=transactions
column=status
key="[value order_number]"
value="returned"
]
[/seti]
[/else]
[/if]
[/else]
[/if]
@_LEFTONLY_BOTTOM_@