Wiki source code of GetTracking (OLD)
Last modified by Outhman Moustaghfir on 2024/02/26 17:12
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
2.2 | 1 | = Introduction = |
![]() |
1.2 | 2 | |
3 | In this section, we will go throw an XSL function to get trackings by trkID or using Keys/Values. | ||
4 | |||
![]() |
2.2 | 5 | = Parameters = |
![]() |
1.2 | 6 | |
7 | GetTracking uses 5 params to help retrieve trackings in question. | ||
8 | |||
9 | 1. trackingType: it refers to type of tracking wanted. (eg : order , product, baseArticle ...) | ||
10 | 1. keys: it can handle 2 values, "trkID" or keys separated by ';' (eg: 'orderNumber;City;Phone') if the key contains '_' at the first character, it means we look for metadata (_statusTracking, _creationDate ...) | ||
11 | **NB:** all metadata will be explained in detail in another paragraph. | ||
12 | 1. values: the values must be ordered the same as 'keys'. if we're searching by 'trkID', 'values' should contain trkIDs separated by space ' '. eg : '121ee 123DD 55evr om432' | ||
13 | In the other case where we use values depending on keys, they must be separated by ';' as shown below : | ||
14 | if we take the last example in 'keys' param, 'orderNumber;City;Phone' , 'values' will be by example '1243;Paris;06070706053' . | ||
![]() |
2.1 | 15 | 1. limit: it defines the max number of tracking to retrieve. **it's optional.** |
![]() |
2.3 | 16 | 1. order: whether you want to order the list of trackings in a descending way or not by a certain key order. The default value is 'trkID' and it's optional as long as you fill the limit value. |
![]() |
1.2 | 17 | |
18 | = Uses = | ||
19 | |||
![]() |
2.1 | 20 | We suppose that we have a tracking type named Product. It has 3 data (Name, Brand, and Country). |
![]() |
1.2 | 21 | |
![]() |
2.1 | 22 | if we want to get Product by key values |
23 | |||
![]() |
2.3 | 24 | {{code language="XML"}}<xsl:value-of select="ixf:GetTracking('Product', 'Name;Brand;_statusTracking' , 'Laptop;Dell;Delivered')"></xsl:value-of>{{/code}} |
![]() |
2.1 | 25 | |
![]() |
2.3 | 26 | Searching by trkIDs : |
27 | |||
28 | {{code language="XML"}} | ||
![]() |
3.1 | 29 | <xsl:value-of select="ixf:GetTracking('Product', 'trkID' , '632061bef8aef457701a28d2 632061e5f8aef457701a28d3 63206213f8aef457701a28d4')"></xsl:value-of> |
![]() |
2.3 | 30 | {{/code}} |
31 | |||
![]() |
2.5 | 32 | Set the limit value to get only 4 elements : |
![]() |
2.3 | 33 | |
![]() |
2.5 | 34 | {{code language="XML"}} |
35 | <xsl:value-of select="ixf:GetTracking('Product', 'Name;Brand;_statusTracking' , 'Laptop;Dell;Delivered' , 4)"></xsl:value-of> | ||
36 | {{/code}} | ||
![]() |
2.3 | 37 | |
![]() |
2.6 | 38 | Add an order by Country : |
![]() |
2.5 | 39 | |
![]() |
2.6 | 40 | {{code language="XML"}} |
41 | <xsl:value-of select="ixf:GetTracking('Product', 'Name;Brand;_statusTracking' , 'Laptop;Dell;Delivered' , 4, 'Country')"></xsl:value-of> | ||
42 | {{/code}} | ||
![]() |
2.5 | 43 | |
![]() |
2.7 | 44 | if you want to add an order without filling the limit, you must put 0 as a value to it : |
![]() |
2.6 | 45 | |
46 | {{code language="XML"}} | ||
47 | <xsl:value-of select="ixf:GetTracking('Product', 'Name;Brand;_statusTracking' , 'Laptop;Dell;Delivered' , 0, 'Country')"></xsl:value-of> | ||
48 | {{/code}} | ||
49 | |||
![]() |
1.2 | 50 |