Rune Grønkjærs Blog
Abonnér på mit feed

Upgrading to Tea Commerce 1.4

SORRY! We are doing it again! We have once and for all, following requests from you wonderful people in the Umbraco community, refactored the JavaScript API. What we’ve done now is to create a settings object that can be extended indefinitely.

First upgrade Tea Commerce

Go and download Tea Commerce at our Umbraco. Then install it as you do any package in Umbraco. Tea Commerce will update itself without you having to do anything else. After that you need to fix your own JavaScript files, where you use the Tea Commerce API. Below you can read about how.

All Tea Commerce’s Kit has been updated

All the Kit’s have been updated to use the new configuration of the Tea Commerce JavaScript API, so you will be able to download and look at them.

JavaScript API documentation has been updated

The JavaScript API documentation have been updated to show how to use the new API. So here you can find info about all methods that are not mentioned in this blog post.

What has changed?

In short, we moved all the voluntary parameters into a setting objects on ALL methods. You should be aware of the following parameters if you use them.
  • umbracoLanguageId
  • async
  • successfn
  • errorfn
  • dataType
  • properties

A few examples

Below I have included a few examples of how you can easily correct your method calls. Notice that I use two different approaches in the two examples, to add the settings object. Both options can be used in all methods.

addOrderLine

//BEFORE 1.4
TeaCommerce.addOrderLine(productid, quantity, true, function (data) {
    //Success function content
  }, function (data) {
    //Error function content
  }
);

//AFTER 1.4
TeaCommerce.addOrderLine(productid, quantity,
  {
  async: true,
  successfn: function (data) {
    //Success function content
  },
  errorfn: function (data) {
    //Error function content
  }
});

removeOrderLine

//BEFORE 1.4
TeaCommerce.removeOrderLine(productId, true, function (data) {
    //Success function content
  }
);

//AFTER 1.4
var settings = {
  async: true,
  successfn: function (data) {
    //When the server answers we update the orderline in the UI
    removeOrderLineFromUI(orderlineEle);
  } 
}
TeaCommerce.removeOrderLine(productId, settings);

Tea Commerce links

This post was written in Blog post. Ad permalink to favorites. Follow all comments with RSS feed for this posts. Drop a comment or a trackback: Trackback URL. | Læs denne side på dansk dansk version

Drop a comment

Your email is never published nor shared. Required fields are marked *

*
*

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Dansk version