Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author storeapps

    (@storeapps)

    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?

    Thread Starter steven.c84

    (@stevenc84)

    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

    Plugin Author storeapps

    (@storeapps)

    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

    Thread Starter steven.c84

    (@stevenc84)

    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.

    Plugin Author storeapps

    (@storeapps)

    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.

    Thread Starter steven.c84

    (@stevenc84)

    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 );
    Plugin Author storeapps

    (@storeapps)

    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 ); ?>

    Thread Starter steven.c84

    (@stevenc84)

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

    thanks

    Thread Starter steven.c84

    (@stevenc84)

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘how to change "Packing Slip for Order #%s"’ is closed to new replies.