As I'm writing this we only have the HTML API fully documentet. But Documentation is the main priority for us right now.
To answer your questions: 1. Use the TC.GetCurrencies([your store id]) method to get a list of all currencies. After that it's all about creating the select html. 2. You can then use jQuery to hook into the change event of the select box. When changed, use the Tea Commerce JavaScript API to change the currency: TC.setCurrentCurrency({currencyId:1});
To do that use the Tea Commerce JavaScript event model. You will get both before and after events on almost all API calls. You can hook into them like this:
TC.bind('beforeSetCurrentCurrency', function (data, jQForm) { alert('Done 1'); }); TC.bind('afterSetCurrentCurrency', function (data, jQForm) { alert('Done 2'); });
Your "data" object will be the object affected. In your case it will be the new currency.
NOTE: I found a small bug when creating your examples. I have fixed it in our own Tea Commerce build which will be available on the next release. In the meantime you will need to add async:true to your call, to get the afterSetCurrentCurrency event call. Like this:
Documentation for v2.0
Does anyone know where I can find some documentation for V2?
I am trying to do a couple of things:
Hi Michael,
Funny thing that you ask. We have just released the first part of the documentation portal:
http://documentation.teacommerce.net
As I'm writing this we only have the HTML API fully documentet. But Documentation is the main priority for us right now.
To answer your questions:
1. Use the TC.GetCurrencies([your store id]) method to get a list of all currencies. After that it's all about creating the select html.
2. You can then use jQuery to hook into the change event of the select box. When changed, use the Tea Commerce JavaScript API to change the currency:
TC.setCurrentCurrency({currencyId:1});
/Rune
I have some jquery which updates my product list that I want to call after setCurrentCurrency has succeeded. How can I tell this?
To do that use the Tea Commerce JavaScript event model. You will get both before and after events on almost all API calls. You can hook into them like this:
TC.bind('beforeSetCurrentCurrency', function (data, jQForm) {
alert('Done 1');
});
TC.bind('afterSetCurrentCurrency', function (data, jQForm) {
alert('Done 2');
});
Your "data" object will be the object affected. In your case it will be the new currency.
NOTE: I found a small bug when creating your examples. I have fixed it in our own Tea Commerce build which will be available on the next release. In the meantime you will need to add async:true to your call, to get the afterSetCurrentCurrency event call. Like this:
TC.setCurrentCurrency({currencyId:1, async:true});
Hope this helps
/Rune
How do I debug errors?
That depends on the bug i guess :)
Most bugs you will be able to debug in the browser console.
/Rune
is working on a reply...