Tap into Order Workflow

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
FirstDivision
Ensign (ENS)
Ensign (ENS)
Posts: 12
Joined: Thu Jan 31, 2013 4:53 pm

Tap into Order Workflow

Post by FirstDivision » Tue Mar 05, 2013 12:01 pm

I've seen the email templates and how they can tie into order workflow states, but what if you need to perform custom processing on orders when they hit certain states? An example is if there is existing backoffice software that needs to be "fed" information via xml:

So...say I want to create a file called order_[ordernumber]_.xml when the order hits the "Order was placed" state and save it to a special folder on the server, how would I go about doing this? Is there a built-in way to accomplish something like this or does it require digging into CommerceBuilder via the CommerceBuilder source license?

Is there some other way/option I'm not aware of to get Able to communicate with outside software?

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

Re: Tap into Order Workflow

Post by mazhar » Wed Mar 06, 2013 9:40 am

Is there some other way/option I'm not aware of to get Able to communicate with outside software?
Gold R4 has the ability to export order in CSV and XML formats.
So...say I want to create a file called order_[ordernumber]_.xml when the order hits the "Order was placed" state and save it to a special folder on the server, how would I go about doing this? Is there a built-in way to accomplish something like this or does it require digging into CommerceBuilder via the CommerceBuilder source license?
In order to accomplish this one way could be to edit your Website/Conlib/Checkout/PaymentWidget.ascx.cs file and then locate following event handler

Code: Select all

private void HandleCheckoutResponse(object sender, CheckedOutEventArgs e)
{
................
................
}
You can place your custom code in HandleCheckoutResponse where first you need to see if checkout was successful and then do your custom processing on oder.

Code: Select all

if (e.CheckoutResponse.Success)
            {
                Order order = e.CheckoutResponse.Order;
                // YOUR CUSTOM CODES RELATED TO THIRD PARTY CAN BE HERE
            }

FirstDivision
Ensign (ENS)
Ensign (ENS)
Posts: 12
Joined: Thu Jan 31, 2013 4:53 pm

Re: Tap into Order Workflow

Post by FirstDivision » Wed Mar 06, 2013 10:32 am

Awesome, thank you mazhar. That looks like it should work.

How does this affect upgrading? I guess it's inevitable that when upgrading I would have to re-apply any custom code changes made to the user controls (or build my own and update my custom controls with any new logic added form Able in an update)?

So, let's say I wanted to investigate the CommerceBuilder Source option. Can I achieve the same thing as above with that? Would that be a way to make code customizations "disconnected" from the rest of the AbleCommerce install? If so that would be ideal, because I'd much rather be able to update when new Able releases become available and have as little extra work as possible.

Is there any official documentation about the CommerceBuilder in regards to using the source license to make customizations?

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

Re: Tap into Order Workflow

Post by mazhar » Wed Mar 06, 2013 11:31 am

How does this affect upgrading? I guess it's inevitable that when upgrading I would have to re-apply any custom code changes made to the user controls (or build my own and update my custom controls with any new logic added form Able in an update)?
Agreed I think at some point you will be needing to merge updates with your custom changes in user controls or pages.
So, let's say I wanted to investigate the CommerceBuilder Source option. Can I achieve the same thing as above with that? Would that be a way to make code customizations "disconnected" from the rest of the AbleCommerce install? If so that would be ideal, because I'd much rather be able to update when new Able releases become available and have as little extra work as possible.
The above task can be accomplished without commercebuilder source and in discontinued way. AbleCommerce Gold is making use of Windosr IOC container. This means there are some services that can be hooked by using configurations. The above solution was somthing rather simple and easy but same can be done by providing your custom Checkout service. In that service you can have your custom codes. I am going to attach a sample project containing example about how to provide custom checkout service where I am simply calling default checkout service to do the checkout. The project contains a config file called Windsor.Config, you need to place it under you Website/App_Data folder and then you need to copy AbleExtension dll to your bin folder. Then make a test checkout and order-{id}.xml file should appear under your app_data. You may need to set the CommerceBuilder reference in project. That will point to CommerceBuilder.dll you have in your Lib or Bin folder.

You can found the CommerceBuilder documentation here http://wiki.ablecommerce.com/index.php/ ... uilder_API

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

Re: Tap into Order Workflow

Post by mazhar » Wed Mar 06, 2013 11:34 am

BTW Here is post about how to upgrade havily customized site viewtopic.php?f=47&t=10082. This post was for AC 7 hopefully it will be handy for Gold too.

FirstDivision
Ensign (ENS)
Ensign (ENS)
Posts: 12
Joined: Thu Jan 31, 2013 4:53 pm

Re: Tap into Order Workflow

Post by FirstDivision » Wed Mar 06, 2013 12:52 pm

Awesome, thank you! Using SVN and then merging customizations into the new version makes perfect sense!

Post Reply