Our client does not want to have a one page checkout.
Instead they want to have the payment information moved to a new page that shows a summary of the customer order and display the payment methods.
So basically one page checkout page should have a continue button that should redirect the user to the payment page where they can view a summary of the order, select a payment method and place the order.
I found Conlib/PaymentPage.ascx to be doing a similar thing. It displays a summary of customer order and the payment methods. I initially thought to just add a button to this page that would redirect to the payment page on the click event but then I figured out that in case of anonymous users, one page checkout control is also firing logic to create a new user. If I just redirect the user to the payment page, the logic to create a new customer won't be fired. I customized the code a bit to take into account this aspect. The problem that is trobling me now is that once the new user is created, the basket shipment information is not getting updated for the new user. I thought the line of code "User.Migrate(oldUser, newUser, true);" in the function "CheckedOut" would migrate all the basket information of the anonymous user to the new user but it's not doing that. When I redirect to payment page, I cannot see the shipment information at all.
I might be able to do what I want by adding some more custom code but I would like to find out if Able-Commerce has any recommended way for this scenario.
Thanks.
Multiple Page Checkout
Re: Multiple Page Checkout
It should work, A few days back I wrote some code for a forum post available here
viewtopic.php?f=44&t=9561
I used Basket class's Transfer method and it worked great. Something like
You can give a try to this as well.
viewtopic.php?f=44&t=9561
I used Basket class's Transfer method and it worked great. Something like
Code: Select all
Basket.Transfer(userId, Token.Instance.User.UserId)
Re: Multiple Page Checkout
I have looked into this example and tried it but Basket.Transfer just copies the basket information for the new user which "User.Migrate" is already doing. It does not copies over the shipment information which I require on the payment page. I have done something like the following to achieve what I want. I would like to have a review of this code.
After the following lines of code in Conlib/OnePageCheckout.ascx.cs
User.Migrate(oldUser, newUser, true);
Token.Instance.InitUserContext(newUser);
I added the following
BasketShipment shipment = new BasketShipment();
shipment.BasketId = oldUser.Basket.Shipments[0].BasketId;
shipment.WarehouseId = oldUser.Basket.Shipments[0].WarehouseId;
shipment.ShipMethodId = oldUser.Basket.Shipments[0].ShipMethodId;
shipment.AddressId = oldUser.Basket.Shipments[0].AddressId;
shipment.ShipMessage = oldUser.Basket.Shipments[0].ShipMessage;
shipment.Save();
string sql = String.Format("update ac_BasketItems set basketShipmentId = {0} where basketId = {1}", shipment.BasketShipmentId, shipment.BasketId);
Microsoft.Practices.EnterpriseLibrary.Data.Database database = Token.Instance.Database;
database.ExecuteNonQuery(CommandType.Text, sql);
So all I am doing is that once the new user is created and his basket is updated(User.Migrate), I add a shipment record based on the shipment information of the old(anonymous) user and then I update the BasketShipmentId I just created in the "ac_BasketItems" table. After the basket shipment is created for the new user, I redirect to payment page and the payment page(Conlib/PaymentPage.ascx) now displays the shipment information.
After the following lines of code in Conlib/OnePageCheckout.ascx.cs
User.Migrate(oldUser, newUser, true);
Token.Instance.InitUserContext(newUser);
I added the following
BasketShipment shipment = new BasketShipment();
shipment.BasketId = oldUser.Basket.Shipments[0].BasketId;
shipment.WarehouseId = oldUser.Basket.Shipments[0].WarehouseId;
shipment.ShipMethodId = oldUser.Basket.Shipments[0].ShipMethodId;
shipment.AddressId = oldUser.Basket.Shipments[0].AddressId;
shipment.ShipMessage = oldUser.Basket.Shipments[0].ShipMessage;
shipment.Save();
string sql = String.Format("update ac_BasketItems set basketShipmentId = {0} where basketId = {1}", shipment.BasketShipmentId, shipment.BasketId);
Microsoft.Practices.EnterpriseLibrary.Data.Database database = Token.Instance.Database;
database.ExecuteNonQuery(CommandType.Text, sql);
So all I am doing is that once the new user is created and his basket is updated(User.Migrate), I add a shipment record based on the shipment information of the old(anonymous) user and then I update the BasketShipmentId I just created in the "ac_BasketItems" table. After the basket shipment is created for the new user, I redirect to payment page and the payment page(Conlib/PaymentPage.ascx) now displays the shipment information.
Re: Multiple Page Checkout
All you need to do in order to enable multi page checkout is to set the content scriptlet of the Checkout/Default.aspx page to 'Checkout Page with Login'.
Re: Multiple Page Checkout
This is helpful but not fits my situation. This multiple page checkout forces the users to create an account and fill in their shipping information before proceeding to checkout. We do not want to force the user to create an account before proceeding to checkout. The one page checkout that I am using is still good enough as it allows anonumous checkout. I just want to take the payment option out of that page and redirect the users to a payment page and the payment page should display them a summary of the order and the payment options.