Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( !defined("ABSPATH") ) exit;
- $order = wc_get_order($_GET["order_ids"]);
- $order_data = $order->get_data();
- $order_items = $order->get_items();
- $user_data = get_user_meta($order_data["customer_id"]);
- ?>
- <div id="document">
- <header>
- <div id="distributore">
- <p><strong>Distributore</strong></p>
- <p></p>
- <p></p>
- <p></p>
- <p>Partita IVA:</p>
- <p>Codice fiscale:</p>
- <p> </p>
- </div>
- <div id="spedisci-a">
- <p><strong>Spedisci a</strong></p>
- <p><?php echo $order_data["shipping"]["first_name"]?> <?php echo $order_data["shipping"]["last_name"]?></p>
- <p>C/O <?php echo $order_data["shipping"]["company"]?></p>
- <p><?php echo $order_data["shipping"]["address_1"]?></p>
- <p><?php echo $order_data["shipping"]["postcode"]?> <?php echo $order_data["shipping"]["city"]?></p>
- <p> </p>
- <p> </p>
- </div>
- <div id="fattura-a">
- <p><strong>Fattura a</strong></p>
- <p><?php echo $order_data["billing"]["company"]?></p>
- <p><?php echo $order_data["billing"]["address_1"]?></p>
- <p><?php echo $order_data["billing"]["postcode"]?> <?php echo $order_data["billing"]["city"]?></p>
- <p>Partita IVA: <?php echo $user_data["dati_aziendali_partita_iva"][0]?></p>
- <p>Codice SDI: <?php echo $user_data["dati_aziendali_codice_sdi"][0]?></p>
- <p>Telefono: <?php echo $order_data["billing"]["phone"]?></p>
- </div>
- <div style="clear: both"></div>
- </header>
- <?php
- $items = array();
- $quantity = 0;
- foreach( $order_items as $item ) {
- $item_data = $item->get_data();
- // $item_meta_data = $item->get_formatted_meta_data("_", true);
- $product = $item->get_product();
- $product_id = $item_data["product_id"];
- $color = $item->get_meta("pa_colore", true);
- $size = $item->get_meta("pa_taglia", true);
- if( array_key_exists($product_id, $items) == false || array_key_exists($color, $items[$product_id]) == false ) {
- $items[$product_id][$color]["image"] = $product->get_image();
- $items[$product_id][$color]["code"] = $product->get_sku();
- $items[$product_id][$color]["color"] = $item->get_meta("pa_colore", true);
- $items[$product_id][$color]["name"] = $product->get_title();
- $items[$product_id][$color]["s"] = 0;
- $items[$product_id][$color]["m"] = 0;
- $items[$product_id][$color]["l"] = 0;
- $items[$product_id][$color]["xl"] = 0;
- $items[$product_id][$color]["2xl"] = 0;
- $items[$product_id][$color]["whs"] = $product->get_price();
- $items[$product_id][$color]["rrp"] = $item->get_meta("pa_rrp", true);
- $items[$product_id][$color]["total"] = 0;
- $items[$product_id][$color]["total"] = $items[$product_id][$color]["total"] + ($product->get_price() * $item->get_quantity());
- $items[$product_id][$color][$size] = $items[$product_id][$color][$size] + $item->get_quantity();
- $quantity = $quantity + $item->get_quantity();
- } else {
- $items[$product_id][$color]["total"] = $items[$product_id][$color]["total"] + ($product->get_price() * $item->get_quantity());
- $items[$product_id][$color][$size] = $items[$product_id][$color][$size] + $item->get_quantity();
- $quantity = $quantity + $item->get_quantity();
- }
- }
- ?>
- <table>
- <thead>
- <tr>
- <th class="thumb"> </th>
- <th class="code">Codice / Opzione</th>
- <th colspan="6" class="desc">Descrizione</th>
- <!--
- <th class="size"></th>
- <th class="size"></th>
- <th class="size"></th>
- <th class="size"></th>
- <th class="size"></th>
- -->
- <th class="qty">Qtà</th>
- <th class="whs">WHS</th>
- <th class="rrp">RRP</th>
- <th class="total">Totale</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach( $items as $item ) {
- foreach( $item as $product ) {
- ?>
- <tr>
- <td rowspan="2" class="thumb"><?php echo $product["image"]?></td>
- <td class="code"><?php echo $product["code"]?></td>
- <td rowspan="2" class="desc"><?php echo $product["name"]?></td>
- <td class="size"><strong>S</strong></td>
- <td class="size"><strong>M</strong></td>
- <td class="size"><strong>L</strong></td>
- <td class="size"><strong>XL</strong></td>
- <td class="size"><strong>2XL</strong></td>
- <td rowspan="2" class="qty"><?php echo $quantity?></td>
- <td rowspan="2" class="whs"><?php echo $product["whs"]?> €</td>
- <td rowspan="2" class="rrp"><?php echo $product["rrp"]?> €</td>
- <td rowspan="2" class="total"><?php echo $product["total"]?> €</td>
- </tr>
- <tr>
- <!--
- <td class="thumb"></td>
- -->
- <td class="code"><?php echo $product["color"]?></td>
- <!--
- <td class="desc"></td>
- -->
- <td class="size"><?php echo $product["s"]?></td>
- <td class="size"><?php echo $product["m"]?></td>
- <td class="size"><?php echo $product["l"]?></td>
- <td class="size"><?php echo $product["xl"]?></td>
- <td class="size"><?php echo $product["2xl"]?></td>
- <!--
- <td class="qty"></td>
- <td class="whs"></td>
- <td class="rrp"></td>
- <td class="total"></td>
- -->
- </tr>
- <?php
- }
- }
- ?>
- </tbody>
- <tfoot>
- <tr>
- <th class="thumb"> </th>
- <th class="code"> </th>
- <th colspan="6" class="desc"> </th>
- <!--
- <th class="size"></th>
- <th class="size"></th>
- <th class="size"></th>
- <th class="size"></th>
- <th class="size"></th>
- -->
- <th class="qty"><?php echo $quantity?></th>
- <th class="whs"> </th>
- <th class="rrp"> </th>
- <th class="total"><?php echo $item["order_price"]; ?> €</th>
- </tr>
- </tfoot>
- </table>
- <div id="details">
- <h2>Ordine #<?php echo $order_data["id"]?></h2>
- <table id="order">
- <tr>
- <td colspan="3"><strong>Merce:</strong></td>
- <!--
- <td></td>
- <td></td>
- -->
- </tr>
- <tr>
- <td colspan="2">Valore imponibile</td>
- <!--
- <td></td>
- -->
- <td class="right"><?php echo $order_data["total"]?> €</td>
- </tr>
- <tr>
- <td colspan="2">I.V.A. 22%</td>
- <!--
- <td></td>
- -->
- <td class="right"><?php echo $order_data["total_tax"]?> €</td>
- </tr>
- <tr>
- <td colspan="2"><strong>Totale documento</strong></td>
- <!--
- <td></td>
- -->
- <td class="right"><strong><?php echo $order_data["total"] + $order_data["total_tax"]?> €</strong></td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td colspan="3"><strong>Condizioni di pagamento:</strong></td>
- <!--
- <td> </td>
- <td> </td>
- -->
- </tr>
- <tr>
- <td colspan="2"><?php echo $order_data["payment_method_title"]?></td>
- <!--
- <td> </td>
- -->
- <td class="right"><?php echo $order_data["total"] + $order_data["total_tax"]?> €</td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td colspan="3"><strong>Banca di appoggio:</strong></td>
- <!--
- <td> </td>
- <td> </td>
- -->
- </tr>
- <tr>
- <td colspan="3"><?php echo $user_data["banca_nome"][0]?></td>
- <!--
- <td> </td>
- <td> </td>
- -->
- </tr>
- <tr>
- <td>IBAN</td>
- <td> </td>
- <td class="right"><?php echo $user_data["banca_iban"][0]?></td>
- </tr>
- <tr>
- <td>BIC / SWIFT</td>
- <td> </td>
- <td class="right"><?php echo $user_data["banca_bicswift"][0]?></td>
- </tr>
- </table>
- </div>
- <div id="pagination">1/2</div>
- <footer>
- </footer>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement