Replacement for using CheckedOut event on multi page checkou

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Replacement for using CheckedOut event on multi page checkou

Post by jmestep » Tue Jun 02, 2009 3:59 pm

Mazhar, you and told us how to use the CheckedOut event of the one page checkout to get the order number after the order has been created.
I have some code I'm adapting to the multi page checkout and am unsure about where to put it on the PaymentPage scriplet. Is it possible to get the new order number on that page?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Replacement for using CheckedOut event on multi page checkou

Post by mazhar » Wed Jun 03, 2009 8:12 am

Judy those method CheckingOut and CheckedOut are basically handlers for events exposed by our payment forms. You can put this support in ConLib/PaymentPage very easily. All you need is to add those two handlers definitions to code file and then register those methods to respective events exposed by all payment forms. So first add following two methods to your code file

Code: Select all

protected void CheckingOut(object sender, CheckingOutEventArgs e)
{
        
}

protected void CheckedOut(object sender, CheckedOutEventArgs e)
{

}
Now you need to hook above handlers with payment forms. In ConLib/PaymentPage all payments forms are blinded to page in BindPage() method. For sample I am going to register for above two events for credit card payments. You can do so for all payment forms by updating code. So locate following code block in BindPage() method

Code: Select all

phPaymentForms.Controls.Add(new ASP.CreditCardPaymentForm());
creditCardAdded = true;
and then update it as below

Code: Select all

ASP.CreditCardPaymentForm ccPaymentForm = new ASP.CreditCardPaymentForm();
                            
ccPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut);
ccPaymentForm.CheckingOut += new CheckedOutEventHandler(CheckedOut);

phPaymentForms.Controls.Add(ccPaymentForm);
creditCardAdded = true;

Hopefully it will help you.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Replacement for using CheckedOut event on multi page checkou

Post by jmestep » Wed Jun 03, 2009 10:12 am

Oh, dear, this sounds like no fun. I've been working on it some this morning, then thought I would check the forum. All I need to do is pick up the new orderid and basket items from the payment page. I see that there is a checkoutResponse.OrderId on a Response.Redirect, but I haven't got the page event order figured out yet. Where is the best place to catch the OrderId?
I'm beginning to think it might be better to move the code to the Receipt page where I first had it and filter out any possible refreshes of the page that would run the routine to calculate my referral amount. I had it there first, then thought I should put it on the One page checkout because I needed to work with that. If I have to do something to each payment form, I think it might be better to move it back to the receipt page?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Replacement for using CheckedOut event on multi page checkou

Post by mazhar » Wed Jun 03, 2009 10:21 am

Its up to you. If you put it on RecieptPage then you may need some code make sure that code executes only once. If you want it here on payment page then you will need to make above changes and also need to load and process order between those two line of code

Code: Select all

checkoutResponse = Token.Instance.User.Basket.Checkout(checkoutRequest);
                Response.Redirect( "Receipt.aspx?OrderNumber=" + checkoutResponse.OrderNumber.ToString() + "&OrderId=" + checkoutResponse.OrderId.ToString());
This is the case when order total is 0 so all stuff is free no payments at all.

Post Reply