Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to show sku in numerical order in wordpress ?

Discussion in 'Introduce Yourself' started by fferdaus, Oct 16, 2016.

  1. fferdaus

    New Member

    Joined:
    Oct 16, 2016
    Messages:
    1
    Likes Received:
    0
    I am using a woocommerce plugin called-->"picking pal". It has a option to print order invoice, in the invoice 1 column for to show "product sku" but the product sku is not showing numerical order. I want to show it numerical ASC order like (1, 2, 3, 4) not like (5, 1, 3, 2) in the invoice image you will see sku showed ( 4055, 4056, 1439 ) but it should be show like the order(1439, 4055, 4056) below is the snippet of the plugin

    <div class="page">

    <?php


    foreach ( $orders as $order ) {


    $order_number = ltrim( $order->get_order_number(), '#' );


    ?>


    <div>

    <?php


    $img = get_option( 'pickingpal-logo' );


    if ( $img ) {



    ?>




    <img src="<?php echo $img ?>" class="logo">



    <?php



    }



    ?>


    </div>

    <div class="info">

    <?php echo nl2br( get_option( 'pickingpal-contact' ) ); ?>


    </div>
    <div class="clearfix"></div>
    <div class="border-x"></div>
    <div class="info1">
    <table>

    <tr>


    <td>



    <h3><?php echo __( 'Billing Address', 'woocommerce-pickingpal' ) ?></h3>



    <div class="info2">



    <?php echo $order->get_formatted_billing_address(); ?>




    </div>


    </td>


    <td>



    <h3><?php echo __( 'Shipping Address', 'woocommerce-pickingpal' ) ?></h3>



    <div class="info2">



    <?php echo $order->get_formatted_shipping_address(); ?>




    </div>


    </td>


    <td>



    <h3><?php echo __( 'Shipping method', 'woocommerce-pickingpal' ) ?></h3>



    <div class="info2">



    <?php echo $order->get_shipping_method(); ?>




    </div>


    </td>


    <td>



    <h3><?php echo __( 'Total amount', 'woocommerce-pickingpal' ) ?></h3>



    <div>



    <?php echo $order->get_formatted_order_total(); ?>




    </div>



    <div>



    <?php echo $order->post_date; ?>




    </div>


    </td>

    </tr>
    </table>
    </div>
    <div class="barcode">

    <div><?php echo __( 'Invoice', 'woocommerce-pickingpal' ) ?> #<?php echo $order_number; ?></div>

    <font face="IDAutomationHC39M">(<?php echo $order_number; ?>)</font>
    </div>
    <table class="products-list">

    <tr class="item-line">


    <th class="header-list"><?php echo __( 'Sku', 'woocommerce-pickingpal' ) ?></th>




    <th class="header-list"><?php echo __( 'Item', 'woocommerce-pickingpal' ) ?></th>


    <th class="header-list"><?php echo __( 'Quantity', 'woocommerce-pickingpal' ) ?></th>




    <th class="header-list"><?php echo __( '', 'woocommerce-pickingpal' ) ?></th>




    <th class="header-list"><?php echo __( '', 'woocommerce-pickingpal' ) ?></th>




    <th class="header-list"><?php echo __( '', 'woocommerce-pickingpal' ) ?></th>

    </tr>

    <?php


    foreach ( $order->get_items() as $item ) {




    $_product = $order->get_product_from_item( $item );




    $sku


    = $variation

    = '';




    if ( $_product )




    $sku



    = $_product->get_sku();



    $item_meta


    = new WC_Order_Item_Meta( $item[ 'item_meta' ] );



    $variation_data

    = $item_meta->get_formatted();



    if ( $_product && !empty( $variation_data ) ) {




    $variation = array();




    foreach ( $variation_data as $var ) {





    $variation[] = $var[ 'label' ] . ': ' . $var[ 'value' ];




    }




    $variation

    = implode( ' | ', $variation );




    $variation

    = str_replace( 'attribute_', '', $variation );



    }




    if ( $order->display_cart_ex_tax || !$order->prices_include_tax ) {




    $ex_tax_label

    = ( $order->prices_include_tax ) ? 1 : 0;




    $price



    = wc_price( $order->get_line_subtotal( $item ), array( 'ex_tax_label' => $ex_tax_label ) );



    } else {




    $price = wc_price( $order->get_line_subtotal( $item, TRUE ) );



    }



    ?>


    <tr class="item-line">


    <td><?php echo $sku ?></td>


    <td>



    <div><?php echo apply_filters( 'woocommerce_order_product_title', $item[ 'name' ], $_product ) ?></div>



    <div><?php echo $variation ?></div>

    </td>

    <td style="padding:0 0 0 30px;"><?php echo $item[ 'qty' ] ?></td>

    <td></td>

    <td></td>

    <td></td>

    </tr>

    <?php

    }

    ?>
    </table>
    <p class="pagebreak"></p>

    <?php
    }
    ?>
    </div>
    <script>

    window.print()
    </script>
     

    Attached Files:

    #1

Share This Page

Web Hosting