Advertisement
Guest User

Untitled

a guest
Jan 14th, 2022
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.52 KB | None | 0 0
  1. <?php
  2. if( !defined("ABSPATH") ) exit;
  3.  
  4. $order = wc_get_order($_GET["order_ids"]);
  5.  
  6. $order_data = $order->get_data();
  7. $order_items = $order->get_items();
  8. $user_data = get_user_meta($order_data["customer_id"]);
  9. ?>
  10.  
  11. <div id="document">
  12. <header>
  13. <div id="distributore">
  14. <p><strong>Distributore</strong></p>
  15. <p></p>
  16. <p></p>
  17. <p></p>
  18. <p>Partita IVA:</p>
  19. <p>Codice fiscale:</p>
  20. <p>&nbsp;</p>
  21. </div>
  22.  
  23. <div id="spedisci-a">
  24. <p><strong>Spedisci a</strong></p>
  25. <p><?php echo $order_data["shipping"]["first_name"]?> <?php echo $order_data["shipping"]["last_name"]?></p>
  26. <p>C/O <?php echo $order_data["shipping"]["company"]?></p>
  27. <p><?php echo $order_data["shipping"]["address_1"]?></p>
  28. <p><?php echo $order_data["shipping"]["postcode"]?> <?php echo $order_data["shipping"]["city"]?></p>
  29. <p>&nbsp;</p>
  30. <p>&nbsp;</p>
  31. </div>
  32.  
  33. <div id="fattura-a">
  34. <p><strong>Fattura a</strong></p>
  35. <p><?php echo $order_data["billing"]["company"]?></p>
  36. <p><?php echo $order_data["billing"]["address_1"]?></p>
  37. <p><?php echo $order_data["billing"]["postcode"]?> <?php echo $order_data["billing"]["city"]?></p>
  38. <p>Partita IVA: <?php echo $user_data["dati_aziendali_partita_iva"][0]?></p>
  39. <p>Codice SDI: <?php echo $user_data["dati_aziendali_codice_sdi"][0]?></p>
  40. <p>Telefono: <?php echo $order_data["billing"]["phone"]?></p>
  41. </div>
  42.  
  43. <div style="clear: both"></div>
  44. </header>
  45.  
  46. <?php
  47. $items = array();
  48.  
  49. $quantity = 0;
  50.  
  51. foreach( $order_items as $item ) {
  52. $item_data = $item->get_data();
  53. // $item_meta_data = $item->get_formatted_meta_data("_", true);
  54. $product = $item->get_product();
  55.  
  56. $product_id = $item_data["product_id"];
  57.  
  58. $color = $item->get_meta("pa_colore", true);
  59. $size = $item->get_meta("pa_taglia", true);
  60.  
  61. if( array_key_exists($product_id, $items) == false || array_key_exists($color, $items[$product_id]) == false ) {
  62. $items[$product_id][$color]["image"] = $product->get_image();
  63. $items[$product_id][$color]["code"] = $product->get_sku();
  64. $items[$product_id][$color]["color"] = $item->get_meta("pa_colore", true);
  65. $items[$product_id][$color]["name"] = $product->get_title();
  66. $items[$product_id][$color]["s"] = 0;
  67. $items[$product_id][$color]["m"] = 0;
  68. $items[$product_id][$color]["l"] = 0;
  69. $items[$product_id][$color]["xl"] = 0;
  70. $items[$product_id][$color]["2xl"] = 0;
  71. $items[$product_id][$color]["whs"] = $product->get_price();
  72. $items[$product_id][$color]["rrp"] = $item->get_meta("pa_rrp", true);
  73. $items[$product_id][$color]["total"] = 0;
  74.  
  75. $items[$product_id][$color]["total"] = $items[$product_id][$color]["total"] + ($product->get_price() * $item->get_quantity());
  76. $items[$product_id][$color][$size] = $items[$product_id][$color][$size] + $item->get_quantity();
  77.  
  78. $quantity = $quantity + $item->get_quantity();
  79. } else {
  80. $items[$product_id][$color]["total"] = $items[$product_id][$color]["total"] + ($product->get_price() * $item->get_quantity());
  81. $items[$product_id][$color][$size] = $items[$product_id][$color][$size] + $item->get_quantity();
  82.  
  83. $quantity = $quantity + $item->get_quantity();
  84. }
  85. }
  86. ?>
  87.  
  88. <table>
  89. <thead>
  90. <tr>
  91. <th class="thumb">&nbsp;</th>
  92. <th class="code">Codice / Opzione</th>
  93. <th colspan="6" class="desc">Descrizione</th>
  94. <!--
  95. <th class="size"></th>
  96. <th class="size"></th>
  97. <th class="size"></th>
  98. <th class="size"></th>
  99. <th class="size"></th>
  100. -->
  101. <th class="qty">Qt&agrave;</th>
  102. <th class="whs">WHS</th>
  103. <th class="rrp">RRP</th>
  104. <th class="total">Totale</th>
  105. </tr>
  106. </thead>
  107.  
  108. <tbody>
  109. <?php
  110. foreach( $items as $item ) {
  111. foreach( $item as $product ) {
  112. ?>
  113. <tr>
  114. <td rowspan="2" class="thumb"><?php echo $product["image"]?></td>
  115. <td class="code"><?php echo $product["code"]?></td>
  116. <td rowspan="2" class="desc"><?php echo $product["name"]?></td>
  117. <td class="size"><strong>S</strong></td>
  118. <td class="size"><strong>M</strong></td>
  119. <td class="size"><strong>L</strong></td>
  120. <td class="size"><strong>XL</strong></td>
  121. <td class="size"><strong>2XL</strong></td>
  122. <td rowspan="2" class="qty"><?php echo $quantity?></td>
  123. <td rowspan="2" class="whs"><?php echo $product["whs"]?> &euro;</td>
  124. <td rowspan="2" class="rrp"><?php echo $product["rrp"]?> &euro;</td>
  125. <td rowspan="2" class="total"><?php echo $product["total"]?> &euro;</td>
  126. </tr>
  127.  
  128. <tr>
  129. <!--
  130. <td class="thumb"></td>
  131. -->
  132. <td class="code"><?php echo $product["color"]?></td>
  133. <!--
  134. <td class="desc"></td>
  135. -->
  136. <td class="size"><?php echo $product["s"]?></td>
  137. <td class="size"><?php echo $product["m"]?></td>
  138. <td class="size"><?php echo $product["l"]?></td>
  139. <td class="size"><?php echo $product["xl"]?></td>
  140. <td class="size"><?php echo $product["2xl"]?></td>
  141. <!--
  142. <td class="qty"></td>
  143. <td class="whs"></td>
  144. <td class="rrp"></td>
  145. <td class="total"></td>
  146. -->
  147. </tr>
  148. <?php
  149. }
  150. }
  151. ?>
  152. </tbody>
  153.  
  154. <tfoot>
  155. <tr>
  156. <th class="thumb">&nbsp;</th>
  157. <th class="code">&nbsp;</th>
  158. <th colspan="6" class="desc">&nbsp;</th>
  159. <!--
  160. <th class="size"></th>
  161. <th class="size"></th>
  162. <th class="size"></th>
  163. <th class="size"></th>
  164. <th class="size"></th>
  165. -->
  166. <th class="qty"><?php echo $quantity?></th>
  167. <th class="whs">&nbsp;</th>
  168. <th class="rrp">&nbsp;</th>
  169. <th class="total"><?php echo $item["order_price"]; ?> &euro;</th>
  170. </tr>
  171. </tfoot>
  172. </table>
  173.  
  174. <div id="details">
  175. <h2>Ordine #<?php echo $order_data["id"]?></h2>
  176.  
  177. <table id="order">
  178. <tr>
  179. <td colspan="3"><strong>Merce:</strong></td>
  180. <!--
  181. <td></td>
  182. <td></td>
  183. -->
  184. </tr>
  185.  
  186. <tr>
  187. <td colspan="2">Valore imponibile</td>
  188. <!--
  189. <td></td>
  190. -->
  191. <td class="right"><?php echo $order_data["total"]?> &euro;</td>
  192. </tr>
  193.  
  194. <tr>
  195. <td colspan="2">I.V.A. 22%</td>
  196. <!--
  197. <td></td>
  198. -->
  199. <td class="right"><?php echo $order_data["total_tax"]?> &euro;</td>
  200. </tr>
  201.  
  202. <tr>
  203. <td colspan="2"><strong>Totale documento</strong></td>
  204. <!--
  205. <td></td>
  206. -->
  207. <td class="right"><strong><?php echo $order_data["total"] + $order_data["total_tax"]?> &euro;</strong></td>
  208. </tr>
  209.  
  210. <tr>
  211. <td>&nbsp;</td>
  212. <td>&nbsp;</td>
  213. <td>&nbsp;</td>
  214. </tr>
  215.  
  216. <tr>
  217. <td colspan="3"><strong>Condizioni di pagamento:</strong></td>
  218. <!--
  219. <td>&nbsp;</td>
  220. <td>&nbsp;</td>
  221. -->
  222. </tr>
  223.  
  224. <tr>
  225. <td colspan="2"><?php echo $order_data["payment_method_title"]?></td>
  226. <!--
  227. <td>&nbsp;</td>
  228. -->
  229. <td class="right"><?php echo $order_data["total"] + $order_data["total_tax"]?> &euro;</td>
  230. </tr>
  231.  
  232. <tr>
  233. <td>&nbsp;</td>
  234. <td>&nbsp;</td>
  235. <td>&nbsp;</td>
  236. </tr>
  237.  
  238. <tr>
  239. <td colspan="3"><strong>Banca di appoggio:</strong></td>
  240. <!--
  241. <td>&nbsp;</td>
  242. <td>&nbsp;</td>
  243. -->
  244. </tr>
  245.  
  246. <tr>
  247. <td colspan="3"><?php echo $user_data["banca_nome"][0]?></td>
  248. <!--
  249. <td>&nbsp;</td>
  250. <td>&nbsp;</td>
  251. -->
  252. </tr>
  253.  
  254. <tr>
  255. <td>IBAN</td>
  256. <td>&nbsp;</td>
  257. <td class="right"><?php echo $user_data["banca_iban"][0]?></td>
  258. </tr>
  259.  
  260. <tr>
  261. <td>BIC / SWIFT</td>
  262. <td>&nbsp;</td>
  263. <td class="right"><?php echo $user_data["banca_bicswift"][0]?></td>
  264. </tr>
  265. </table>
  266. </div>
  267.  
  268. <div id="pagination">1/2</div>
  269.  
  270. <footer>
  271. </footer>
  272. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement