Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table class="widefat">
- <thead>
- <tr>
- <th><strong>Fecha</strong></th>
- <th><strong>Mes</strong></th>
- <th><strong>Año</strong></th>
- <th><strong>Orden</strong></th>
- <th><strong>Nombre</strong></th>
- <th><strong>Apellido</strong></th>
- <th><strong>DNI</strong></th>
- <th><strong>Dirección</strong></th>
- <th><strong>Distrito</strong></th>
- <th><strong>Correo</strong></th>
- <th><strong>Teléfono</strong></th>
- <th><strong>Categoría</strong></th>
- <th><strong>ID</strong></th>
- <th><strong>SKU</strong></th>
- <th><strong>Marca</strong></th>
- <th><strong>País</strong></th>
- <th><strong>Producto</strong></th>
- <th><strong>Cantidad</strong></th>
- <th><strong>Precio Unitario</strong></th>
- <th><strong>Subtotal</strong></th>
- <th><strong>Costo de Envío</strong></th>
- <th><strong>Total</strong></th>
- <th><strong>Método de Pago</strong></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach( $ventas_panuts_orders as $order ) {
- $order_obj = wc_get_order( $order->id_orden );
- $order_data = $order_obj->get_data();
- $date_created = $order_obj->get_date_created()->format ('Y-m-d g:i a');
- $strtotime = strtotime($date_created);
- $hora_gmt = date("Y-m-d g:i a", strtotime('-5 hours' , $strtotime));
- $order_items = $order_obj->get_items();
- $i=true;
- foreach( $order_items as $product ) {
- ?>
- <tr>
- <td><?php echo $hora_gmt; ?></td>
- <td><?php echo date('M',$strtotime); ?></td>
- <td><?php echo date('Y',$strtotime); ?></td>
- <td><?php echo $order->id_orden; ?></td>
- <td style="text-transform: capitalize;"><?php echo strtolower($order_obj->get_billing_first_name()); ?></td>
- <td style="text-transform: capitalize;"><?php echo strtolower($order_obj->get_billing_last_name()); ?></td>
- <td><?php echo get_post_meta( $order->id_orden, 'billing_dni', true ); ?></td>
- <td style="text-transform: capitalize;"><?php echo strtolower($order_obj->get_billing_address_1().' '.$order_obj->get_billing_address_2());?></td>
- <td><?php echo $order_obj->get_billing_city() ?></td>
- <td style="text-transform: lowercase;"><?php echo $order_obj->get_billing_email(); ?></td>
- <td><?php echo get_post_meta( $order->id_orden, 'billing_cellphone', true ); ?></td>
- <?php
- $_product_id = wc_get_product($product->get_product_id());
- if ($_product_id){
- $producto = wc_get_product($_product_id);
- $id_producto = $producto->get_id();
- $sku_producto = $producto->get_sku();
- $marcas = get_the_terms( $product->get_product_id(), 'pa_marca');
- $marca = $marcas[0]->name;
- $paises = get_the_terms( $product->get_product_id(), 'pa_pais');
- $pais = $paises[0]->name;
- $terms = wp_get_post_terms( $product->get_product_id(), 'product_cat' );
- $product_categories = "";
- $cont = 0;
- foreach( $terms as $wp_term ){
- if ($cont >=1){
- break;
- }
- if ($wp_term->name == 'Ofertas'){
- break;
- }
- $product_categories .= $wp_term->name;
- if ( $wp_term->name != 'Gourmet' ){
- $cont++;
- } else {
- $product_categories .= ' - ';
- }
- }
- }
- else {
- $product_categories = '-';
- $id_producto = '-';
- $sku_producto = '-';
- $marca = '-';
- $pais = '-';
- }
- ?>
- <td><?php echo $product_categories; ?></td>
- <td><?php echo $id_producto; ?></td>
- <td><?php echo $sku_producto; ?></td>
- <td><?php echo $marca; ?></td>
- <td><?php echo $pais; ?></td>
- <td><?php echo '<p>'.$product['name'].'</p>'; ?></td>
- <td align="center"><?php echo '<p>'.$product['qty'].'</p>'; ?></td>
- <td align="center"><?php echo '<p>'.$product->get_total()/$product['qty'].'</p>'; ?></td>
- <td align="center"><?php echo $product->get_total(); ?></td>
- <?php
- if ($i){ ?>
- <td><?php echo $order_obj->get_shipping_total(); ?></td>
- <td><?php echo wc_price($order->orden_total); ?></td> <!-- total de orden -->
- <td><?php echo $order_obj->get_payment_method_title(); ?></td>
- <?php $i=false; } ?>
- </tr>
- <?php }
- } ?>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment