• Resolved Kelcett

    (@kelcett)


    Hi,
    Our members are issued a membership card that they can use. We would like to make the card printable from within the membership area. I was able to do this with <div id=***> and to only print this. The card is an table with background image and two fields in table. Members name and status.

    However placing the javascript in header or footer resulted in breaking the PayPal payment page (accept=”paypal” accept_via_paypal=”paypal”). It showed the credit card thumbs and the fields for credit card.

    Can anyone point me in direction to safely use javascript to do this.

    Thanks

    https://www.ads-software.com/plugins/s2member/

Viewing 1 replies (of 1 total)
  • Thread Starter Kelcett

    (@kelcett)

    Not sure why I didn’t think of doing this. Moved my ‘print membership card’ javascript to body of page on its own page. There it doesn’t interfere with accept=”paypal” function on subscription page.

    Here is code I am playing with in body of page. I know it needs to be cleaned up, but its working and I am no coder. Maybe this will help someone else.

    My image is around 300 x 180 which is close to business card size when I print it. Formatting of table rows etc is so that words end up in clear space of image of card.

    Please feel free to critique this or offer suggestions. I maybe doing something I shouldn’t.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <script type="text/javascript">
    function printthis()
    {
     var w = window.open('', '', 'width=800,height=600,resizeable,scrollbars');
     w.document.write($("#printthis").html());
     w.document.close(); // needed for chrome and safari
     javascript:w.print();
     w.close();
     return false;
    }
    </script>
    
    <div id="dontprintthis">
    <h4>Welcome <strong>[s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]</strong><em>!</em></h4>
    <h4>~ Print Your Membership Card ~
    <br>
    </div>
    <div id="printthis">
    <table cellpadding=0px cellspacing=0px width="300px" height="180px" background="https://my image url.jpg">
    <tr>
    <td width="35%"></td>
    <td style="vertical-align:bottom;" width="65%"><em>Name: [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /] [s2Get constant="S2MEMBER_CURRENT_USER_LAST_NAME" /]
    Status: [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]
    .[php] if ($s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time") ) {echo date("F j, Y", $s2member_auto_eot_time);} [/php]
    </td>
    </tr>
    </table>
    Image missing on print? ~ There is a little known setting in browsers print properties "Print Background Graphics" that must be on/checked to print image with this card.
    </div>
    Click <a href="printpage" onClick="printthis(); return false;">PRINT HERE</a> for a print copy of your membership card. Membership Cards are only physically issued at ********. Please print your membership card or login to this page to show anyone who requests to see your Membership Status.
Viewing 1 replies (of 1 total)
  • The topic ‘Print a Membership Card ~ Javascript conflict’ is closed to new replies.