Do I need the API source?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Do I need the API source?

Post by nickc » Wed Sep 24, 2008 12:14 pm

I'd say you don't need the source.
Your application is going to need a separate data store, binding to Able data via BasketId or OrderId.

The other thing to consider is the legal aspect of Able source purchase - the license stipulates that any modifications you make to the source belong to Able.

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Do I need the API source?

Post by nickc » Wed Sep 24, 2008 2:07 pm

I have used the Digital Good/download aspect of Able products to allow site users to obtain "customized" pdf content:
- In product setup, associated placeholder digital good (generic "digitalgood.txt" file allowing for rule enforcement)
- In product setup, use product template to collect fields that are inserted into pdf (name, address, url, etc.)
- In product setup, use ModelNumber field to store name of my pdf template
- Site user adds product to basket and checks out - Able natively includes link to digital good in invoice, email to user
- I override behavior of download in /members/download.ashx:

Code: Select all

                                // original Able DG call:
                                // DownloadHelper.SendFileDataToClient(context, digitalGood);
                                
                                // get the rebate form to send (Product.ModelNumber)
                                OrderItem item = OrderItemDataSource.Load(oidg.OrderItemId);
                                CommerceBuilder.Products.Product product = CommerceBuilder.Products.ProductDataSource.Load(item.ProductId);

                                // create a new customizer object
                                Customizer customizer = new Customizer("obscured");
                                
                                // get the users' info
                                CommerceBuilder.Users.User user = CommerceBuilder.Users.UserDataSource.Load(order.UserId);
                                CommerceBuilder.Orders.OrderShipment shipment = CommerceBuilder.Orders.OrderShipmentDataSource.Load(item.OrderShipmentId);
                                
                                // establish the necessary parameters
                                customizer.Parameters.Add("T", product.ModelNumber); ...

                                // make request
                                customizer.Load(HttpContext.Current.Response);
Not to recommend this specific technique, but to point out there are lots of places to save values in Able (user.settings, e.g.) and the current user, basket, order, etc. are almost always available via Token.Instance, including their associated bound collections.
Really, the only thing you can't easily do without source is add methods or properties to their business objects - which you don't really want anyway.

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Do I need the API source?

Post by nickc » Thu Sep 25, 2008 10:45 am

Say you wanted to have your custom layer object bound directly to an Able user (or order) object.
You would add a collection (CommerceBuilder.Users.User.LayerObjectsCollection) as a property with inherited/overridden CollectionBase methods (Add, Remove, Save, etc.) and then your object could be made available when the User object is instantiated.

Post Reply