WordPress.org

Ready to get started?Download WordPress

Forums

Smart Manager for e-Commerce - WooCommerce and WPeC extension
[resolved] how to change "Packing Slip for Order #%s" (10 posts)

  1. steven.c84
    Member
    Posted 11 months ago #

    I have a problem. I need the "Packing Slip for Order #%s" to be different than the order id cause if i delete an order it don't need the bill. how can I get an invoice number different than the order-id?

    http://wordpress.org/plugins/smart-manager-for-wp-e-commerce/

  2. storeapps
    Member
    Plugin Contributor

    Posted 11 months ago #

    Assign different value to variable

    $purchase_id_value

    Add following extra line above that line which says

    Packing Slip for Order #%s

    <?php $purchase_id_value = "other value you wanted"; ?>

    It should work.

    By the way, can you please tell us what you wanted to show instead of Order id?

  3. steven.c84
    Member
    Posted 11 months ago #

    Hello. Thanks for the answer. I'll try this solution immediately but i think it will only change both number (invoice and order id number).
    What i want to show is:
    In the field <span><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wpsc' ), $this->log_id ); ?></span> i want to display the invoice number.
    In the field <th><?php echo esc_html_x( 'Order ID', 'packing slip', 'wpsc' ); ?></th> the order id (so what it show now).
    So the numeration of the invoice number will be different to the order id; the id order will increment for every order and the invoice number will increment every time i need to print the invoice.
    It should be possible? if yes how i can do it? do i need to create a new db query?
    Hope you understand what i need and find a solution. If you need more info please tell me.

    Thanks in advantage for your time

  4. storeapps
    Member
    Plugin Contributor

    Posted 11 months ago #

    Try following code

    <?php
       $purchase_id_value = get_option( 'sm_wpsc_packing_slip_serial_no' );
       $purchase_id_value = ( empty( $purchase_id_value ) ) ? 0 : (int)$purchase_id_value;
       $purchase_id_value++;
       update_option( 'sm_wpsc_packing_slip_serial_no', $purchase_id_value );
    ?>

    And put it just above the line which says

    <span><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wpsc' ), $purchase_id_value ); ?></span>

    Remember that this code will not be available in main plugin, so take backup of this code before updating Smart Manager

  5. steven.c84
    Member
    Posted 11 months ago #

    Wow thank you very much. It work perfectly. The last 2 thing.
    I see that it don't save the invoice history in the db. There is a way to do that? can i have an editable list in the backend??

    Thank you very much for your time.

  6. storeapps
    Member
    Plugin Contributor

    Posted 11 months ago #

    Glad to know that it worked exactly as you wanted!

    Can you please elaborate what data you want to save as invoice history?

    Can I have an editable list in the backend?? It seems very difficult.

  7. steven.c84
    Member
    Posted 11 months ago #

    It should be useful to register copy of the sales log details or at least the invoice number related to the order id.
    for example
    option_id | option_name | option_value | order_id
    11111 | sm_wps.. | 185 | 289

    Cause i see that it create a temporary line and it don't save the chronology of the invoices.

    To show the list in the backend i found the following code that add a column named invoice number in the log sale page but it don't work.
    I don't know if it should be the right way to do what i need.
    Please let me know if there is a solution. If not it's good as well.

    thanks

    /***********************************
    define the new column
    ***********************************/
    function addPurchaseLogColumnHead( $columns ){
    $columns['invoicenumber']=__('Invoice Number','haetshopstyling');
    return $columns;
    }
    add_filter( 'manage_dashboard_page_wpsc-purchase-logs_columns', 'addPurchaseLogColumnHead') );
    
    /***********************************
    add content to the new column
    ***********************************/
    function addPurchaseLogColumnContent( $default, $column_name, $item ){
        if($column_name=='invoicenumber'){
            echo getInvoiceNumber($item->id);
        }
    }
    add_filter( 'wpsc_manage_purchase_logs_custom_column', 'addPurchaseLogColumnContent',10,3 );
  8. storeapps
    Member
    Plugin Contributor

    Posted 11 months ago #

    Try following code instead of previous code we provided:

    <?php
       $order_id = $purchase_id_value;
       $purchase_id_value = get_option( 'sm_wpsc_packing_slip_serial_no' );
       $purchase_id_value = ( empty( $purchase_id_value ) ) ? 0 : (int)$purchase_id_value;
       $purchase_id_value++;
       update_option( 'sm_wpsc_packing_slip_serial_no', $purchase_id_value );
       $invoice_data = get_post_meta( $order_id, 'sm_invoice_no', true );
       if ( !is_array( $invoice_data ) ) {
            $invoice_data = array();
       }
       if ( !in_array( $purchase_id_value, $invoice_data ) ) {
            $invoice_data[] = $purchase_id_value;
       }
       update_post_meta( $order_id, 'sm_invoice_no', $invoice_data );
    ?>

    This code will save all Invoice numbers generated for an order_id in order's meta, which you can retrieve by using following code

    <?php $invoice_data = get_post_meta( $order_id, 'sm_invoice_no', true ); ?>

  9. steven.c84
    Member
    Posted 11 months ago #

    Hello i'm sorry but it work as the previous and do not save invoice number.

    thanks

  10. steven.c84
    Member
    Posted 11 months ago #

    i'm wrong. sorry it work.
    Thank you so much.

Reply

You must log in to post.

About this Plugin

About this Topic