Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michael Sims 119 posts 387 karma points
    Apr 30, 2013 @ 12:20
    Michael Sims
    0

    Documentation for v2.0

    Does anyone know where I can find some documentation for V2?

    I am trying to do a couple of things:

    1. A razor script that writes out a select box with the list of currencies and the current one selected
    2. A jquery callback that sets the current currency on the page when the dropdown is changed and then updates the prices for all the displayed products.

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 12:40
    Rune Grønkjær
    0

    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

  • Michael Sims 119 posts 387 karma points
    Apr 30, 2013 @ 13:08
    Michael Sims
    0

    I have some jquery which updates my product list that I want to call after setCurrentCurrency has succeeded. How can I tell this?

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 13:26
    Rune Grønkjær
    0

    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

  • Michael Sims 119 posts 387 karma points
    Apr 30, 2013 @ 16:38
    Michael Sims
    0

    How do I debug errors?

  • Rune Grønkjær 1372 posts 3103 karma points
    May 01, 2013 @ 08:36
    Rune Grønkjær
    0

    That depends on the bug i guess :)

    Most bugs you will be able to debug in the browser console.

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft