Marketpress 3.0 -> adding information to notification emails

Hello there,

I am trying to add in the product Category to the admin notification email, but cannot find a comprehensive list of settings that are available for MP, specifically as it pertains to the available codes for use in the email notifications. Do you have a link to current documentation on the latest version? The Usage manual, or program itself does not appear to contain any info on these defined variables as used for notifications.

If there is one that can allow me to add in a notification for product category (as a way of tracking the specific order), that would be swell.

Otherwise, can you direct me as to how to modify either the order details to include the product category, or to add a new output that will display the category in admin notification emails?

Thanks in advance for your help.

  • Kasia Swiderska

    Hello tomtranmer,

    Here is whole list of codes that can be used in the notifications:

    'CUSTOMERNAME'
    			'ORDERID'
    			'ORDERINFOSKU'
    			'ORDERINFO'
    			'SHIPPINGINFO'
    			'PAYMENTINFO'
    			'TOTAL'
    			'TRACKINGURL'
    			'ORDERNOTES'

    I'll send message to usage page writer to include this information on plugin manual.

    If there is one that can allow me to add in a notification for product category (as a way of tracking the specific order), that would be swell.

    I'm afraid there is no such code at this moment. Add it would require modification one of existing codes.
    In file /wp-content/plugins/marketpress/includes/common/helpers.php there is function mp_filter_email() in line 77. This one handles the output in mails. So you would need there add line that would output categories for products.

    You can get categories by using this

    $terms = get_the_terms( $post_id, 'product_category' );

    where you change $post_id to id of the item in the order.

    Can you advise on if this was intentionally removed and if it can be enabled?

    This option is no longer available in MarketPress.

    kind regards,
    Kasia

  • tomtranmer

    Thanks for pointing me in the right direction. I will have to find another way to enable the emailing to multiple addresses.

    Below is the code added to the file specified in order to create a new shortcut to the product category in the notification email:

    in helpers.php on line 110, I added:

    $array_of_terms = get_the_terms( $item->ID, 'product_category' );
    
    $get_order_category = $array_of_terms[0]->name;

    then to pass the function to the admin side, I added to the array of shortcuts on line 246:

    'GETCATEGORY' => $get_order_category,

    Now I can use the GETCATEGORY code in the admin notifications editor to output the NAME of the category. If you need the slug instead, then replace name with slug in the first code snippet.

    Hope this helps others who are looking to achieve the same thing.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.