MarketPress Invoice and Packing Slip emailed to customer

Hello,

WordPress: 4.5.3
MarketPress: version 3.1.1
Website: http://bluegemini.ca/store/

I am currently still in beta for MarketPress. I've found a bug recently with respect to the Invoice Add-on.

When I enable the "Invoice PDF "Add on in the store settings, set How do you want to view the PDF to "Download as PDF" and I checked off the setting Attach Invoice to "Customer Order Shipped Email" what happens may be a bug.

The customer gets both the invoice and the packing slip attached to the order notification email . The customer does not need a copy of the packing slip. Just the email in the Admin Notification Settings should get the packing slip correct?

Thanks,

Tin

  • Rupok

    Hi Tin, hope you had a wonderful day.

    The customer gets both the invoice and the packing slip attached to the order notification email . The customer does not need a copy of the packing slip. Just the email in the Admin Notification Settings should get the packing slip correct?

    Our plugin developer can tell you best regarding this, so I'm pinging him. I believe, he will come up with a feedback soon.

    Please keep in mind, our developers work round the clock and they have to deal with lots of critical issues and other things. So it may take a little while for them to check this and provide a feedback.

    Have a nice day. Cheers!
    Rupok

  • Panos

    Hi hoangker ,

    I noticed a small bug there. I have attached file
    wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/class-mp-pdf-invoice-addon.php
    until next release is out.

    You can then go to admin menu > Store Settings> Add Ons > Invoice PDF > Settings and choose which email should contain the pdfs.

    ===EDIT===
    The file mentioned above fixes the issue described but attaches both pdfs in the notifications you have choosen from settings. In order to attach only invoice pdf to Customer New Order email and Customer Order Shipped email you can paste the following snippet at your child theme's functions.php file:
    `
    add_filter( 'mp_order/sendmail_attachments', 'wpmudev_mp_order_sendmail_attachments', 21, 3 );

    function wpmudev_mp_order_sendmail_attachments( $attachments, MP_Order $order, $contex ){

    //Need to clear $attachments as it already contains both pdf files.
    $attachments = array();
    $settings = mp_get_setting( 'pdf_invoice' );
    $attach = $settings['attach_to'];
    $gen = new MP_PDF_Invoice();
    $files = array();
    switch ( $contex ) {
    case 'new_order_client':
    if ( isset( $attach['customer_new_order'] ) && $attach['customer_new_order'] ) {
    $invoice = $gen->generate_pdf_file( $order->get_id(), MP_PDF_Invoice::stuck_out_tongue:DF_INVOICE );
    //$packing = $gen->generate_pdf_file( $order->get_id(), MP_PDF_Invoice::stuck_out_tongue:DF_SLIP );
    $files = array( $invoice );
    }
    break;
    case 'new_order_admin':
    if ( isset( $attach['admin_new_order'] ) && $attach['admin_new_order'] ) {
    $invoice = $gen->generate_pdf_file( $order->get_id(), MP_PDF_Invoice::stuck_out_tongue:DF_INVOICE );
    $packing = $gen->generate_pdf_file( $order->get_id(), MP_PDF_Invoice::stuck_out_tongue:DF_SLIP );
    $files = array( $invoice, $packing );
    }
    break;
    case 'order_shipped_client':
    if ( isset( $attach['customer_shipped_order'] ) && $attach['customer_shipped_order'] ) {
    $invoice = $gen->generate_pdf_file( $order->get_id(), MP_PDF_Invoice::stuck_out_tongue:DF_INVOICE );
    //$packing = $gen->generate_pdf_file( $order->get_id(), MP_PDF_Invoice::stuck_out_tongue:DF_SLIP );
    $files = array( $invoice );
    }
    break;
    }
    if ( $settings['quit_on_free'] == 1 ) {
    //check does the order is 0
    if ( $order->get_cart()->total( false ) == 0 ) {
    $files = array();
    }
    }

    $attachments = array_merge( $attachments, $files );

    return $attachments;

    }

    Thanks!
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.