PLACEHOLDER options on MarketPress Notification Email

Is there a list of PLACEHOLDERS that can be used in the Notification emails (customized under store settings)? I have all of the information I want setup as I want it, EXCEPT for being able to allow for Comments or Directions to be placed in this email. I have Special Directions checkmarked on the General Store Settings page, and I want to display that information in the email notification. I have tried the placeholder codes SPECIALDIRECTIONS, COMMENTS, INSTRUCTIONS and have searched for a list of placeholders allowed. My order form currently reads:
----
A new order (ORDERID) was created in your store:

CUSTOMERNAME

ORDERINFOSKU
-----
because I do not want to include shipping or other information in the email to me. Just name, what they ordered, and any comments.

  • Margery
    • Flash Drive

    Thank you for your quick response. That did not work, but I wonder if I have the wrong place set up for customization? I currently have the Store Settings --> General --> Misc Options --> Show Special Instructions Field checkmarked YES.

    I wonder if what I really need to do is figure out how enable a customization for products. For example, a ticket to an event, allowed to purchase 4 tickets, but I need the names for all 4 people. I'd like those names to come in the confirmation email. Is ORDERNOTES the wrong placeholder, or do I have the wrong setup for my product?

  • Predrag Dubajic
    • Support

    Hi Margery,

    Are you selling Physical or Digital products?

    Note that when you go to configure your email notifications there are different ones for Physical and Digital products:

    If that's configured properly but it still doesn't work would you mind allowing support access so we can have a closer look at this?
    To enable support access you can follow this guide here:
    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,
    Predrag

  • Margery
    • Flash Drive

    I'm selling digital products, in theory. At this time, the only products I have active are Membership, and Membership Renewals. But the name on the credit card is now always the name by which the member wishes to be known (real name vs. professional name, gift membership, spouse's credit card). Also, in the future, we'll be selling tickets to events for which many people buy multiple tickets, and we need the names of all attendees (we are evaluating Events+ but I don't think we'll activate it before our next big event, perhaps later). I'll grant support access, and hope you can help me figure out how to add a comments section to each product, and have that information sent to me in the Notifications email. Thank you in advance for your help!

  • Panos
    • SLS

    Hi Margery ,

    Thanks for reporting this, there were some modifications required in order to make them work.

    I have attached the following files:
    wp-content/plugins/marketpress/includes/common/class-mp-order.php
    and
    wp-content/plugins/marketpress/includes/public/class-mp-checkout.php

    First keep a backup of these files on your server (eg rename them to class-mp-order.php.txt).

    Then download files and decompress them. Upload each file in the appropriate folder (one is in common folder and other on public).

    You should now see an "Order notes" field on checkout page where customer can insert text. This info should be displayed in email with the ORDERNOTES placeholder you mentioned.

    Please let us know hoe this works for you!

    Thanks!
    Panos

  • Margery
    • Flash Drive

    Thank you for these files. Your files did solve the problem of needing the ORDERNOTES in the email. However, it changed the setup of the email being sent upon an order. The old email was a stacked set of data, the new email delivers the information in a 100% wide table. It doesn't appear that it changed as a result of those 2 files, however. It seems like it calls a different format from somewhere else? Which file needs to be edited to return to a stacked (multiline) invoice, as opposed to a horizontal table with multiple columns?

  • Panos
    • SLS

    Hey Margery ,

    Good to know you got the email as you like!

    In order to check if order notes is not empty you can either edit file wp-content/plugins/marketpress/includes/public/class-mp-checkout.php I previously attached and replace (line ~1213)
    <textarea name="mp_order_notes"></textarea>
    with
    <textarea name="mp_order_notes" data-rule-required="true"></textarea>
    data-rule-required="true"

    Alternatively you can add the following snippet on a mu-plugin or your child theme's functions.php:

    function wpmudev_mp_can_checkout( $good_to_go, $MP_Checkout, $cart, $billing_info, $shipping_info ){
    
    	$order_notes = mp_get_post_value( 'mp_order_notes' );
    
    	if( $order_notes == '' ){
    		$good_to_go = false;
    		mp_checkout()->add_error( __( 'You need to fill in the Order Notes field', 'mp' ), 'order-review-payment' );
    	}
    
    	return $good_to_go;
    }
    
    add_filter('mp_can_checkout', 'wpmudev_mp_can_checkout', 10, 5 );

    Hope this helps!

  • Margery
    • Flash Drive

    I am revisiting this same issue now that I have reopened sales of the same products. Do I need to re-download and re-install these files (in other words, have updates in the plugin undone these changes that worked last year, and are no longer working?)

  • Adam Czajczyk
    • Support Gorilla

    Hello Margery,

    I hope you're well today and thank you for your question!

    I don't think the changes provided by Panos previously where included in updates of the plugin as they were more of a "custom patch" rather than a bug fix or a new feature.

    Did you made changes to the plugin files or did you added them as "mu-plugin" (as suggested here )?

    If you make changes to plugin's code, I think you would want to try to re-apply them but please make sure that you made a copy of original files before doing that in case those changes didn't work (since plugin was updated on Feb 26th provided code might need some re-evaluation).

    If you added them as mu-plugin instead they that might mean that they are not working after recent update.

    Let me know please which way did you go and I'll ask Panos again for help if necessary.

    Kind regards,
    Adam

  • Margery
    • Flash Drive

    I have no clue which I ended up doing last year. I tried both ways listed above (in functions.php, and in the public/mp_checkout file) and both have given me different sets of error messages or page/site issues. Let me ask, is this something that someone there can fix? We have the ongoing support subscription, and the amount of time I would spend unraveling this once a year doesn't seem cost effective for me to bill my client if it comes under our service agreement with you.

  • Adam Czajczyk
    • Support Gorilla

    Hi Margery,

    Thank you for additional explanation.

    I've asked Panos (who provided the original code) directly to get back to you and take a look at it. I believe that as a person who created the original code, he'll be best capable of helping you here.

    He'll update you here (or forward a message for you through me) as soon as possible so please keep an eye on this thread for further information.

    Best regards,
    Adam

  • Panos
    • SLS

    Hi Margery ,

    The SPECIALDIRECTIONS should be working. I just tested it and it includes the notes I insert in that field. You need to activate it from settings, though I believe you already have it active.

    Please let us know if you are using this placeholder and still doesn't work

    Thanks!

  • Margery
    • Flash Drive

    My order notifiction email is:
    ----------------
    A new order (ORDERID) was created in your store:

    CUSTOMERNAME

    ORDERNOTES

    ORDERINFOSKU

    SPECIALDIRECTIONS
    =========================

    and the special directions section is checkmarked in the store settings. I also put the SPECIALDIRECTIONS placeholder on the email confirmation to the person placing the order.... Nope, didn't show up in either email.

    I appreciate you helping me sort this out.....

  • Margery
    • Flash Drive

    It has been 2 weeks since this was assigned, and I have not heard anything. Has any progress/resolution been made? We are receiving orders every day and doing a lot of workarounds. We only use this system for 3 months out of the year, and then it goes dark for the rest of the time.

  • Panos
    • SLS

    Sincere apologies for missing this Margery !

    I have added a new mu-plugin on your site:
    wp-content/mu-plugins/wpmudev-mp-special-instructions-in-email.php
    with the following snippet:

    add_filter( 'mp_order/notification_body', 'wpmudev_mp_special_instructions_in_email', 20, 2 );
    add_filter( 'mp_order_notification_admin_msg', 'wpmudev_mp_special_instructions_in_email', 20, 2 );
    
    function wpmudev_mp_special_instructions_in_email( $msg, $order ) {
    
    	if ( isset( $_POST['shipping']['special_instructions'] ) ) {
    		$instructions = sanitize_text_field( $_POST['shipping']['special_instructions'] );
    		$msg = str_replace( 'SPECIALDIRECTIONS', $instructions, $msg );
    	}
    
    	return $msg;
    
    }

    This should replace the SPECIALDIRECTIONS macro with the content of the Special Instructions file.

    I tried to test but since your site is live I didn't want to set any sandbox payment gateways. Could you do a test and let us know how it goes? I have also added this plugin:
    https://wordpress.org/plugins/wp-mail-logging/
    so you can monitor those email during your tests. After done testing you can deactivate and delete that plugin.

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.