Add product sku to order confirmation email sent to admin

Hi,
I have a store using Marketpress with over 500 products, some similarly named. Anyway my product supplier requires the sku be included when I forward the email to them for fulfillment. Is there an easy way to include the product name and product sku in the email order confirmation the admin receives?

I am not a programmer/coder but I can usually handle editing a transaction.php file when given specific instructions on what to change or add and where.

Thanks for your help on this,
Melissa

  • Philip John
    • DEV MAN’s Apprentice

    Hiya Melissa,

    There's no way to edit that from what I can see. However, there is a hook called everytime a new order is created.

    It's the 'mp_new_order' hook. Have a look for it on line 2927 of marketpress.php for that.

    By hooking into that with a custom plugin you could send an e-mail containing all the info you need as soon as the order is created.

    Cheers,
    Phil

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    As we haven't heard back from you we're going to assume the problem was sorted out and mark this ticket as resolved.

    If it wasn't resolved, or you have any more questions related to this thread please feel free to post them below and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, thanks for using the forums, and for being a member of WPMU DEV, it's a pleasure to help you out and we look forward to being of assistance in the future.

    Thanks!

  • lkraav
    • Site Builder, Child of Zeus

    @version 2.6.1

    Hi all

    I'd like to reopen this, because I also now need to insert SKU in the confirmation e-mail.

    I'm seeing the logic for the confirmation e-mail product list in marketpress.php L3833

    3833       foreach ($order->mp_cart_info as $product_id => $variations) {
    3834                 foreach ($variations as $variation => $data) {
    3835             $order_info .= "\t" . $data['name'] . ': ' . number_format_i18n($data['quantity']) . ' * ' . number_format_i18n($data['price'], 2) . ' = '. number_format ...

    I think the simplest way to get custom order fields would be to run the $order_info line through an apply_filters("mp_custom_order_info", ... ) call. I'm not 100% sure how computationally expensive WP filter processing is in large stores, but I doubt it's anything significant. This would effectively make it my function's responsibility to output a sensible order item line.

    What do you think Aaron? Is this the way to go here? I don't think any of the later filters are really usable here, since you'd then have two separate order item tables (one without SKUs or whatever else, one with) or some really nasty text-based item table parsing stuff.

  • lkraav
    • Site Builder, Child of Zeus

    After some sleep, I realized text-based mangling in later hooks isn't so bad, since I can look for known strings from $order loop and just str_replace() stuff.

    I'll post a snippet for this in my upcoming code library soon.

    Therefore this is probably something Aaron doesn't need to bother with right now. Marking it back to Resolved.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.