Some changes in the Invoice (Membership 2 Pro)

Hi,

First I want to say thanks to all the help I have received here. I have created a lot of threads and I have received a lot of nice answers from you developers and supporters. I have translated and uploaded almost every string in the frontend and a lot of things in the backend for Membership 2 Pro in Danish as I hope other Danes would be glad for.

Here's my problem:

On the invoice (and on other places on the site) it's not showing the correct time. It's just showing 1:00 no matter when the user has completed the payment. Is it possible to show the correct time and it would be nice if it is a 24 hour clock.

Also, I would like to hear if it's possible to get a logo in the upper left corner on the invoice? Or at least just a text/name of our company... Maybe I can figure out how to do it myself, but I can't find the file for it. Perhaps you can tell me where? If you want to tell me how I do it, it would be nice too.

Thanks for being awesome!

  • Milan

    Hello @Kasper Snæver Andersen,

    We are glad we helped you and Thanks for your kind words. Your satisfaction is our top proprity.

    #1 Membership is measure in terms of days, not hours. That means when user take your subscription, membership/subscription start from that day, not from the time user paid amount.

    #2 To modify invoice structure you can edit /wp-content/plugins/membership/app/view/shortcode/class-ms-view-shortcode-invoice.php file. This file is used to render invoice markup.

    Please let me know if there is anything else i can help you with.

    Regards,
    Milan Savaliya
    Support Staff( WPMUDEV )

  • Milan

    Hi @Kasper Snæver Andersen,

    You can show the time for the order. But that will not be the exact time of order.
    Membership 2 pro stores only date information about order, not time. So time will not be the exact time on order was placed. ( I mean user paid amount. :slight_smile: )

    Another thing you mentioned is how to display time in 24 hour clock format. You can do by just tweaking your General Settings of Site.

    Membership 2 pro fetches date and time format settings from Settings --> General Settings . You can see attachment for more detail.

    If you want time should be gone from the invoice you need to modify default html structure of invoice. you can do this by using ms_shortcode_invoice filter provided by membership2 pro plugin.

    Here is small snippet which demonstrates how you can use this with your theme.

    <?php
    // See following file for default code:
    // plugins/membership/app/view/shortcode/class-ms-view-shortcode-invoice.php
    add_filter( 'ms_shortcode_invoice', 'custom_html_code', 10, 2 );
    function custom_html_code( $html, $data ) {
    	lib3()->debug->dump( $data ); // Gives you a quick look what data you have.
    	$html = ...;
    	return $html;
    }

    Another approach is directly edit core file of Membership 2 pro which generates invoice markup.

    File which generates markup you can find at /wp-content/plugins/membership/app/view/shortcode/class-ms-view-shortcode-invoice.php file. This file contains MS_View_Shortcode_Invoice class which has member function to_html().( See attachments please. :slight_smile: ) That function renders markup of the invoice so if you want to tweak your invoice you can edit this file.

    Here one thing I want to make clear is the whenever new updates will be available for membership 2 pro your changes to core files will be removed. So make sure that with new updates of membership 2 pro you also updates the changes you've made prior to update.

    I would suggest you go with filter based approach.

    I hope this helps you @Kasper Snæver Andersen. :slight_smile:

    Please let us know if there is anything else we can help you with.

    Regards,
    Milan Savaliya
    Support Staff( WPMUDEV )

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.