PageRenderTime 56ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/example/index.php

https://github.com/Dante2000/spreadshirt-api-php
PHP | 195 lines | 185 code | 10 blank | 0 comment | 1 complexity | c60f20b2c362605d62cd5c83fecd304a MD5 | raw file
  1. <?php
  2. error_reporting(E_ALL|E_STRICT);
  3. ini_set('display_errors', 1);
  4. require_once("../api/spreadshirt.php");
  5. $spreadshirt = new SpreadshirtApi();
  6. ?>
  7. <!DOCTYPE html>
  8. <html lang="de">
  9. <head>
  10. <meta charset="utf-8" />
  11. <title>Spreadshirt API PHP Example</title>
  12. </head>
  13. <body>
  14. <h1>Example Spreadshirt API for PHP</h1>
  15. <div>
  16. <h2>Retrieve Country List - getCountries()</h2>
  17. <table>
  18. <?php foreach ( $spreadshirt->getCountries() as $country) { ?>
  19. <tr>
  20. <td><?php print_r ( $country->name ) ; ?></td>
  21. <td><?php print_r ( $country->isoCode ) ; ?></td>
  22. <td><?php print_r ( $country->thousandsSeparator ) ; ?></td>
  23. <td><?php print_r ( $country->decimalCount ) ; ?></td>
  24. <td><?php print_r ( $country->length ) ; ?></td>
  25. <td><?php print_r ( $country->currency ) ; ?></td>
  26. </tr>
  27. <?php } ?>
  28. </table>
  29. </div>
  30. <div>
  31. <h2>Retrieve Country Entity - getCountry()</h2>
  32. <?php $country = $spreadshirt->getCountry(1); ?>
  33. <table>
  34. <tr>
  35. <td><?php print_r ( $country->name ) ; ?></td>
  36. <td><?php print_r ( $country->isoCode ) ; ?></td>
  37. <td><?php print_r ( $country->thousandsSeparator ) ; ?></td>
  38. <td><?php print_r ( $country->decimalCount ) ; ?></td>
  39. <td><?php print_r ( $country->length ) ; ?></td>
  40. <td><?php print_r ( $country->currency ) ; ?></td>
  41. </tr>
  42. </table>
  43. </div>
  44. <div>
  45. <h2>Retrieve Currency List - getCurrencies()</h2>
  46. <table>
  47. <?php foreach ( $spreadshirt->getCurrencies() as $currency) { ?>
  48. <tr>
  49. <td><?php print_r ( $currency->plain ) ; ?></td>
  50. <td><?php print_r ( $currency->isoCode ) ; ?></td>
  51. <td><?php print_r ( $currency->symbol ) ; ?></td>
  52. <td><?php print_r ( $currency->decimalCount ) ; ?></td>
  53. <td><?php print_r ( $currency->pattern ) ; ?></td>
  54. </tr>
  55. <?php } ?>
  56. </table>
  57. </div>
  58. <div>
  59. <h2>Retrieve Currency Entity - getCurrency()</h2>
  60. <?php $currency = $spreadshirt->getCurrency(1); ?>
  61. <table>
  62. <tr>
  63. <td><?php print_r ( $currency->plain ) ; ?></td>
  64. <td><?php print_r ( $currency->isoCode ) ; ?></td>
  65. <td><?php print_r ( $currency->symbol ) ; ?></td>
  66. <td><?php print_r ( $currency->decimalCount ) ; ?></td>
  67. <td><?php print_r ( $currency->pattern ) ; ?></td>
  68. </tr>
  69. </table>
  70. </div>
  71. <div>
  72. <h2>Retrieve Language List - getLanguages()</h2>
  73. <table>
  74. <?php foreach ( $spreadshirt->getLanguages() as $language) { ?>
  75. <tr>
  76. <td><?php print_r ( $language->isoCode ) ; ?></td>
  77. <td><?php print_r ( $language->name ) ; ?></td>
  78. </tr>
  79. <?php } ?>
  80. </table>
  81. </div>
  82. <div>
  83. <h2>Retrieve Language Entity - getLanguage()</h2>
  84. <?php $language = $spreadshirt->getLanguage(1); ?>
  85. <table>
  86. <tr>
  87. <td><?php print_r ( $language->isoCode ) ; ?></td>
  88. <td><?php print_r ( $language->name ) ; ?></td>
  89. </tr>
  90. </table>
  91. </div>
  92. <div>
  93. <h2>Retrieve User Entity - getUser()</h2>
  94. <?php $user = $spreadshirt->getUser(40000); ?>
  95. <table>
  96. <tr>
  97. <td><?php print_r ( $user->name ) ; ?></td>
  98. <td><?php print_r ( $user->userWebSites ) ; ?></td>
  99. <td><?php print_r ( $user->memberSince ) ; ?></td>
  100. <td><?php print_r ( $user->country ) ; ?></td>
  101. <td><?php print_r ( $user->language ) ; ?></td>
  102. <td><?php print_r ( $user->currency ) ; ?></td>
  103. <td><?php print_r ( $user->productTypes ) ; ?></td>
  104. <td><?php print_r ( $user->printTypes ) ; ?></td>
  105. <td><?php print_r ( $user->fontFamilies ) ; ?></td>
  106. <td><?php print_r ( $user->productTypeDepartments ) ; ?></td>
  107. <td><?php print_r ( $user->designCategories ) ; ?></td>
  108. <td><?php print_r ( $user->designs ) ; ?></td>
  109. <td><?php print_r ( $user->products ) ; ?></td>
  110. <td><?php print_r ( $user->shops ) ; ?></td>
  111. <td><?php print_r ( $user->currencies ) ; ?></td>
  112. <td><?php print_r ( $user->languages ) ; ?></td>
  113. <td><?php print_r ( $user->countries ) ; ?></td>
  114. </tr>
  115. </table>
  116. </div>
  117. <div>
  118. <h2>Retrieve User Shop List - getShops()</h2>
  119. <table>
  120. <?php foreach ( $spreadshirt->getShops(40000) as $shop) { ?>
  121. <tr>
  122. <td><?php print_r ( $shop->type ) ; ?></td>
  123. <td><?php print_r ( $shop->name ) ; ?></td>
  124. <td><?php print_r ( $shop->user ) ; ?></td>
  125. <td><?php print_r ( $shop->country ) ; ?></td>
  126. <td><?php print_r ( $shop->language ) ; ?></td>
  127. <td><?php print_r ( $shop->currency ) ; ?></td>
  128. <td><?php print_r ( $shop->address ) ; ?></td>
  129. <td><?php print_r ( $shop->passwordRestricted ) ; ?></td>
  130. <td><?php print_r ( $shop->shippingUseCase ) ; ?></td>
  131. <td><?php print_r ( $shop->defaultShippingType ) ; ?></td>
  132. <td><?php print_r ( $shop->discountSupported ) ; ?></td>
  133. <td><?php print_r ( $shop->defaultShippingType ) ; ?></td>
  134. <td><?php print_r ( $shop->productTypes ) ; ?></td>
  135. <td><?php print_r ( $shop->printTypes ) ; ?></td>
  136. <td><?php print_r ( $shop->fontFamilies ) ; ?></td>
  137. <td><?php print_r ( $shop->productTypeDepartments ) ; ?></td>
  138. <td><?php print_r ( $shop->designCategories ) ; ?></td>
  139. <td><?php print_r ( $shop->designs ) ; ?></td>
  140. <td><?php print_r ( $shop->articleCategories ) ; ?></td>
  141. <td><?php print_r ( $shop->articles ) ; ?></td>
  142. <td><?php print_r ( $shop->products ) ; ?></td>
  143. <td><?php print_r ( $shop->currencies ) ; ?></td>
  144. <td><?php print_r ( $shop->languages ) ; ?></td>
  145. <td><?php print_r ( $shop->countries ) ; ?></td>
  146. <td><?php print_r ( $shop->baskets ) ; ?></td>
  147. </tr>
  148. <?php } ?>
  149. </table>
  150. </div>
  151. <div>
  152. <h2>Retrieve Shop Entity - getShop()</h2>
  153. <?php $shop = $spreadshirt->getShop(40000); ?>
  154. <table>
  155. <tr>
  156. <td><?php print_r ( $shop->type ) ; ?></td>
  157. <td><?php print_r ( $shop->name ) ; ?></td>
  158. <td><?php print_r ( $shop->user ) ; ?></td>
  159. <td><?php print_r ( $shop->country ) ; ?></td>
  160. <td><?php print_r ( $shop->language ) ; ?></td>
  161. <td><?php print_r ( $shop->currency ) ; ?></td>
  162. <td><?php print_r ( $shop->address ) ; ?></td>
  163. <td><?php print_r ( $shop->passwordRestricted ) ; ?></td>
  164. <td><?php print_r ( $shop->shippingUseCase ) ; ?></td>
  165. <td><?php print_r ( $shop->defaultShippingType ) ; ?></td>
  166. <td><?php print_r ( $shop->discountSupported ) ; ?></td>
  167. <td><?php print_r ( $shop->defaultShippingType ) ; ?></td>
  168. <td><?php print_r ( $shop->productTypes ) ; ?></td>
  169. <td><?php print_r ( $shop->printTypes ) ; ?></td>
  170. <td><?php print_r ( $shop->fontFamilies ) ; ?></td>
  171. <td><?php print_r ( $shop->productTypeDepartments ) ; ?></td>
  172. <td><?php print_r ( $shop->designCategories ) ; ?></td>
  173. <td><?php print_r ( $shop->designs ) ; ?></td>
  174. <td><?php print_r ( $shop->articleCategories ) ; ?></td>
  175. <td><?php print_r ( $shop->articles ) ; ?></td>
  176. <td><?php print_r ( $shop->products ) ; ?></td>
  177. <td><?php print_r ( $shop->currencies ) ; ?></td>
  178. <td><?php print_r ( $shop->languages ) ; ?></td>
  179. <td><?php print_r ( $shop->countries ) ; ?></td>
  180. <td><?php print_r ( $shop->baskets ) ; ?></td>
  181. </tr>
  182. </table>
  183. </div>
  184. </body>
  185. </html>