Wiki source code of Price Formatting Guide

Version 4.1 by mbs on 2010/09/30 14:14

Show last authors
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 = Formatting Rules =
4
5 For formatting a price we need the following data:
6
7 * **thousands separator** . or , depending on the country
8 * **decimal point** , or . depending on the country
9 * **currency symbol** € or other depending on the currency
10 * **price pattern** currency symbol before or after price depending on the currency
11 * **decimal count** 1 or 2 decimal counts depending on the currency
12
13 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:
14
15 {{code}}
16
17 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
18 <shop xmlns:xlink="http://www.w3.org/1999/xlink"
19 xmlns="http://api.spreadshirt.net"
20 xlink:href="http://api.spreadshirt.net/api/v1/shops/205909" id="205909">
21 <user xlink:href="http://api.spreadshirt.net/api/v1/users/40000" id="40000"/>
22 <country xlink:href="http://api.spreadshirt.net/api/v1/countries/1" id="1"/>
23 <language xlink:href="http://api.spreadshirt.net/api/v1/languages/1" id="1"/>
24 <currency xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"/>
25 ...
26 </shop>
27
28 {{/code}}
29
30 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**.
31
32 {{code}}
33
34 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
35 <currency xmlns:xlink="http://www.w3.org/1999/xlink"
36 xmlns="http://api.spreadshirt.net"
37 xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1">
38 <plain>EUR</plain>
39 <isoCode>EUR</isoCode>
40 <symbol>€</symbol>
41 <decimalCount>2</decimalCount>
42 <pattern>% $</pattern>
43 </currency>
44
45 {{/code}}
46
47 The **country**, such as [[country 1>>http://api.spreadshirt.net/api/v1/countries/1]] defines the **thousands separator** and the **decimal point**.
48
49 {{code}}
50
51 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
52 <country xmlns:xlink="http://www.w3.org/1999/xlink"
53 xmlns="http://api.spreadshirt.net"
54 xlink:href="http://api.spreadshirt.net/api/v1/countries/1" id="1">
55 <isoCode>DE</isoCode>
56 <thousandsSeparator>.</thousandsSeparator>
57 <decimalPoint>,</decimalPoint>
58 <length>
59 <unit>cm</unit>
60 <unitFactor>1.0</unitFactor>
61 </length>
62 <currency xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"/>
63 </country>
64
65 {{/code}}
66
67 = Example =
68
69 {{code}}
70
71
72
73 {{/code}}