[ic] Re: Interchange - Modifying Orders

Aaron Rubin interchange-users@icdevgroup.org
Fri Sep 13 17:56:00 2002


Hi all,

I've been adding customer support features to our store. Modifying
shipping is one of the sections that are done but it only modifies the
order and doesn't authorize the new additional charges; I'm working on
that. 


Also completed are backordering items, note taking, items to order,
backordered reports, printing and invoicing, but modifying the orders is
a tough one and I haven't started on it yet. I'm happy to share code and
if any people want to collaborate on a serious order modification
system, please email me.

For modifying shipping (remember this doesn't authorize anything):
In order_status.html in the UI

<!-- --- UPDATE SHIPPING --- -->


<table><TR BGCOLOR="#FFFFFF">
<TD BGCOLOR="#999999" ALIGN=right>
<FORM METHOD=POST ACTION="[area ui]" NAME=transactions>
<INPUT TYPE=hidden NAME=mv_doit VALUE="set">
<INPUT TYPE=hidden NAME=mv_click VALUE="process_filter">
<INPUT TYPE=hidden NAME=mv_nextpage VALUE="__UI_BASE__/order_view">
<INPUT TYPE=hidden NAME=code VALUE="[cgi order]">
<INPUT TYPE=hidden NAME=mv_data_table VALUE="[value mv_data_table]">
<INPUT TYPE=hidden NAME=ui_meta_specific VALUE="[cgi ui_meta_specific]">
<INPUT TYPE=hidden NAME=mv_data_key VALUE="[value ui_data_key_name]">
<INPUT TYPE=hidden NAME=mv_update_empty VALUE="1">
<INPUT TYPE=hidden NAME=mv_data_fields VALUE="code status archived
deleted note ups_note packing_note">

	<FONT COLOR="#FFFFFF"><B>Shipping Quote</B></FONT>
</TD>
<TD VALIGN=TOP>
	<TABLE CELLSPACING=0 CELLMARGIN=0><TR><TD>Shipping Method:
<INPUT NAME="shipmode" SIZE=15 VALUE="[loop-data transactions
shipmode]"><BR>Shipping Price: <INPUT NAME="shipping" SIZE=5
VALUE="[loop-data transactions shipping]"><BR>
	Email customer? <input name=send_email type=checkbox checked>
<INPUT NAME="shipping_addby" type=hidden value="[value mv_username]">
	</td><td>
	 Additional Note: <textarea name="shipping_add" rows=5
cols=45></textarea>
	</td>
</TR></TABLE>


[if-mm advanced order]
	[button form=transactions bold=1 text="[L]Update Shipping[/L]"]
	Log("LOGGING 0");
	mv_todo=back
	order=[cgi code]
	[tag flag write]transactions orderhistory[/tag]
	Log("LOGGING 1");
	[perl interpolate=1 tables="orderhistory transactions userdb
__UI_META_TABLE__"]
		my $tdb = $Db{transactions}
			or die "No transactions database!\n";
		my $udb = $Db{userdb}
			or die "No userdb database!\n";
		my $hdb = $Db{orderhistory}
			or die "No orderhistory database!\n";



		my $on = $Scratch->{ship_notice_order_number} =
$CGI->{code};
		my $r2 = $tdb->field($on, 'order_number');
Log("R2=$r2");
		delete $Scratch->{ship_notice_email};
		delete $Scratch->{send_email};


		my $send_email = $CGI->{send_email};
			Log("Send email? $send_email");
Log("Order number=$on username=$user");

$Scratch->{shipping_add} = $CGI->{shipping_add};
$Scratch->{shipping_addby} = $CGI->{shipping_addby};
$Scratch->{shipmode} = $CGI->{shipmode};
		if($send_email) {
			$Scratch->{send_email} = $send_email;
			$Scratch->{ship_notice_email} = $tdb->field($r2,
'email')
		}

			$tdb->set_field($r2, 'shipping',
$CGI->{shipping});
			$tdb->set_field($r2, 'shipmode',
$CGI->{shipmode});
			my $tprice = $tdb->field($on, 'shipping') +
$tdb->field($on, 'subtotal') + $tdb->field($on, 'salestax');
			Log("tprice=$tprice");
			$tdb->set_field($r2, 'total_cost', $tprice);




my $t2 = [item-increment] + 1;
	Log("t2=$t2");
$hdb->query({sql => "insert into orderhistory
(code,store_id,order_number,session,information,updated_by,update_date)
values ('$r2-$t2','','$r2','','Shipping quote: $CGI->{shipping} for
$CGI->{shipmode}<P>
$CGI->{shipping_add}','$CGI->{shipping_addby}','[tag time]%Y-%m-%d
%H:%M:%S[/tag]')"});


			$Scratch->{ship_notice_username} = $user;
	Log("LOGGING 3");
	Log("ship_notice $Scratch->{ship_notice_email}");
			$tdb->set_field($r2, 'shipping',
$CGI->{shipping});



		my $ship_mesg;
		my $g_status;
		my %shipping;


		my $minor_mesg = '';

		my $email_mesg = $Scratch->{send_email}
						? "Shipping email sent."
						: "No email copy sent as
you selected.";



		$Scratch->{ui_message} = "$ship_mesg $email_mesg";

		return;
	[/perl]

	[if scratch send_email]
	[email-raw][include etc/update_shipping][/email-raw]
[/if]

	[/button] <BR>
	</td></tr></table>
</form>
<!-- --- END Update Shipping --- -->

The way I get the key for the insert into orderhistory is ridiculous, I
know but I kept getting glitches. If anyone can send me a way that
works, please help me out.

update_shipping is whatever you'd like, I have


[loop list="[scratch ship_notice_order_number]"]
To: [scratch ship_notice_email]
Subject: Reply required: Shipping charges - ... ORDER [loop-data
transactions order_number]
From: ...
Reply-to: ...

Dear [loop-data transactions fname] [loop-data transactions lname],


[set my_smode][loop-data transactions shipmode][/set][if type=explicit
compare="($Scratch->{my_smode} =~ 'FLATD')"]Ground[elsif type=explicit
compare="($Scratch->{my_smode} =~ '1DA')"]Next Day Air[elsif
type=explicit compare="($Scratch->{my_smode} =~ '2DA')"]2nd Day
Air[/elsif][/elsif][else][loop-data transactions shipmode] [/else][/if]
shipping for your order, ORDER [loop-data transactions order_number] is
[currency][loop-data transactions shipping][/currency], making your
total [currency][loop-data transactions total_cost][/currency].
[scratch shipping_add]

Please reply to this message or call us at ... to confirm the charges.
Your order will not ship without confirmation of the shipping charges.

Thank you for your patronage.

--
Customer Support Agent - [scratch shipping_addby]
...


[/loop]


Aaron

-----Original Message-----
From: interchange-users-admin@icdevgroup.org
[mailto:interchange-users-admin@icdevgroup.org] On Behalf Of David
Etheredge
Sent: Friday, September 13, 2002 4:29 PM
To: rchilson@treadstar.com
Cc: interchange-users@interch
Subject: [ic] Re: Interchange - Modifying Orders


Greetings Roy,

As of yet, I have not been able to do this. It is a problem for me. What
I have had to do is to charge regular price and then issue credit
through my payment processor. Messy!!!

Let me know if you find anything.

David



----- Original Message -----
From: "Roy Chilson" <rchilson@treadstar.com>
To: <cpu.dave@att.net>
Sent: Friday, September 13, 2002 9:22 AM
Subject: Interchange - Modifying Orders


> Hello  David,
>
> I ran across your question in the interchange-users group and was 
> quite disappointed in that it appears that no one had responded to 
> your question. I too am trying to figure this out and wondered if 
> perhaps you had come upon a solution. Basically what I want to be able

> to do is override the pricing that is in the database for customer 
> orders and to override the shipping options as well. Any help that you

> can offer would be greatly appreciated.
>
> Thanks,
>
> Roy Chilson
>
> Message: 6
> From: "David Etheredge" cpu.dave@att.net
> To: "interchange-users@interch" 
> <interchange-users@interchange.redhat.com>
> Date: Mon, 22 Jul 2002 11:26:29 -0000
> Subject: [ic] Modifying Orders
> Reply-To: interchange-users@icdevgroup.org
> Occasionally, I need to modify orders... Add an Item, Change shipping,

> etc. What is the best way or how can it be done. I have tried using 
> the cart, but I can not find how to make these changes.
> Thanks,
> David
>

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users