Support » Plugin: WP e-Commerce Style Email » Warning message during preview?

  • Hi,

    1/ i am getting this warning message if i hit preview in browser

    Warning: Missing argument 2 for wpdb::prepare(), called in C:\xampp\htdocs\\site\wp-content\plugins\wp-e-commerce-style-email\purchase.class.php on line 288 and defined in C:\xampp\htdocs\\site\wp-includes\wp-db.php on line 992
    EDIT: fixed by adding LIMIT 1″, “”);
    i am using WPSC

    2/ in preview i only see the shortcode [email content as generated], but where is it set? or isn’t this a shortcode?

    3/ can your shortcodes also be used to show the correct transaction_results? At the moment i only get the succesfull status, even when i cancel a payment.

    4/ @jacob schwartz, i downloaded your plugin to see which hooks you use for sending a receipt/invoice. I could use some help, tips or suggestions for the following:
    i am creating a little e-ticket system. For this like to attach a generate pdf (barcode with tcpdf). My questions:
    A/ how do i get the order details from WPSC so i can populate my generate_pdf function?
    B/ how can i attach the pdf file when, in your template hierarchy the payment is succesfully made and the users gets a Purchase receipt (wpsc-email_style_purchase_receipt.php)

    Hope you can give some pointers.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there
    I’m getting the same error. I’m just upgrading a site that was very out of date and am using WPSC as well. This error appears if I try to display either the general email or the purchase receipt.

    Any pointers as to what’s going wrong would be much appreciated.

    Plugin Author Jacob Schwartz



    The warning that you see on the preview page can be ignored – it won’t affect the normal running of your site or the plugin. At some point, WordPress started producing these warnings and as DDT notes, it’s not a difficult thing to fix in my plugin, but I just haven’t gotten around to it yet. I do want to stress that the warning is not a cause for alarm at all in this situation – it’s a misdirected warning in this case. It is meant to inform developers when they are doing something other than what I am doing.

    Now, with regards to DDT’s other questions…

    The [email content as generated] is not a shortcode. It is just a placeholder to show you where normal email content will sit within the themed email.

    My plugin does provide template tags for use in the templates, and it does provide for templating purchase results within the purchase result content templates. Content tags are not available in any of the style templates. Does that answer #3?

    With regards to generating a PDF attachment, you could put some PHP in the content template that captures the information you need and passes it to your attachment generator for use after my plugin is done. The templating process in my plugin occurs within the wp_mail action – so I suspect that you could hook into wp_mail after my plugin, pick up the variables you captured in my templates, and use them however you wish. Does that makes sense?

    Hi Jacob,

    Thanks for answering:

    put some PHP in the content template that captures the information you need and passes it to your attachment generator for use after my plugin is done.

    That’s what i am looking for, i am looking into your code to see which variables i need to use and when. I am looking for the time “the browser comes back” from a succesfull payment gateway and then the tickets would be generated. I guess this looks like your download logic (i.e. if(ecse_is_purchase_receipt_email()) {), but how can i use if(ecse_is_purchase_receipt_email()) { in my functions.php

    For this approach: Do you know how i could use some of your functions from my theme functions.php, at the moment i tried

    function test_totals(){
        require_once(WP_PLUGIN_URL . '/wp-e-commerce-style-email/mail.class.php');
        return "Total, please ".ecse_get_the_totals();

    But i get a Fatal error: Call to undefined function ecse_get_the_totals()?

    I like to leave your code alone and use your functions / variable from my-theme/functions.php.

    Kind regards

    Plugin Author Jacob Schwartz


    I don’t recommend trying to use the template tags meant for my templates in your functions file. They are really only meant to be used within the context of those templates. There’s a whole process I’m using behind the scenes to make those tags work in a specific way.

    What I would recommend is, create your own data structure to represent the data you need. It could be as simple as a multi-dimensional array or as complex as a class-based object. In my templates, fill that data structure. Use a global or static variable to store it. When it comes time to use your data, it’ll be available.

    You may be able to get my tags to work with some fiddling, but since I’m not providing them as an API outside of my templates you don’t have any guarantee that they will continue to work as you need when I push updates.

    Does that make sense?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Warning message during preview?’ is closed to new replies.