Wiki source code of Price Formatting Guide
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | In this short guide, I will tell you how to use Spreadshirt's shop, country and currency data to format your prices correctly. | ||
| 2 | |||
| 3 | For formatting a price we need the following data: | ||
| 4 | |||
| 5 | * thousands separator . or , depending on the country | ||
| 6 | * decimal point -> , or . depending on the country | ||
| 7 | * currency symbol -> € or other depending on the currency | ||
| 8 | * price pattern -> currency symbol before or after price depending on the currency | ||
| 9 | * decimal count -> 1 or 2 decimal counts depending on the currency | ||
| 10 | |||
| 11 | Where do we get this data from? A shop, such as [[shop 205909>>http://api.spreadshirt.net/api/v1/shops/205909]], is actually configured for a specific country and currency. A sample payload is illustrated below: | ||
| 12 | |||
| 13 | {{code}} | ||
| 14 | |||
| 15 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 16 | <shop xmlns:xlink="http://www.w3.org/1999/xlink" | ||
| 17 | xmlns="http://api.spreadshirt.net" | ||
| 18 | xlink:href="http://api.spreadshirt.net/api/v1/shops/205909" id="205909"> | ||
| 19 | <user xlink:href="http://api.spreadshirt.net/api/v1/users/40000" id="40000"/> | ||
| 20 | <country xlink:href="http://api.spreadshirt.net/api/v1/countries/1" id="1"/> | ||
| 21 | <language xlink:href="http://api.spreadshirt.net/api/v1/languages/1" id="1"/> | ||
| 22 | <currency xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"/> | ||
| 23 | ... | ||
| 24 | </shop> | ||
| 25 | |||
| 26 | {{/code}} | ||
| 27 | |||
| 28 | The currency, such as [[currency 1>>http://api.spreadshirt.net/api/v1/currencies/1]] defines the currency symbol, the price pattern and the decimal count. | ||
| 29 | |||
| 30 | {{code}} | ||
| 31 | |||
| 32 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 33 | <currency xmlns:xlink="http://www.w3.org/1999/xlink" | ||
| 34 | xmlns="http://api.spreadshirt.net" | ||
| 35 | xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"> | ||
| 36 | <plain>EUR</plain> | ||
| 37 | <isoCode>EUR</isoCode> | ||
| 38 | <symbol>€</symbol> | ||
| 39 | <decimalCount>2</decimalCount> | ||
| 40 | <pattern>% $</pattern> | ||
| 41 | </currency> | ||
| 42 | |||
| 43 | {{/code}} | ||
| 44 | |||
| 45 | The country, such as [[country 1>>http://api.spreadshirt.net/api/v1/countries/1]] defines the thousands separator and the decimal point. | ||
| 46 | |||
| 47 | {{code}} | ||
| 48 | |||
| 49 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 50 | <country xmlns:xlink="http://www.w3.org/1999/xlink" | ||
| 51 | xmlns="http://api.spreadshirt.net" | ||
| 52 | xlink:href="http://api.spreadshirt.net/api/v1/countries/1" id="1"> | ||
| 53 | <isoCode>DE</isoCode> | ||
| 54 | <thousandsSeparator>.</thousandsSeparator> | ||
| 55 | <decimalPoint>,</decimalPoint> | ||
| 56 | <length> | ||
| 57 | <unit>cm</unit> | ||
| 58 | <unitFactor>1.0</unitFactor> | ||
| 59 | </length> | ||
| 60 | <currency xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"/> | ||
| 61 | </country> | ||
| 62 | |||
| 63 | {{/code}} |