WordPress.org

Support

Support » Plugins and Hacks » WP e-Commerce Style Email » [Resolved] How to show custom field in email?

[Resolved] How to show custom field in email?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,
    i need to!

    Thanks!

    Plugin Author Jacob Schwartz

    @mightyturtle

    Hi there,

    The ECSE_purchase class can pull checkout data by name, unique name, or ID. It can be used from within any of the content templates (not the wrapper templates).

    So Mr Oudin, give this a go:

    <?php echo ECSE_purchase::get_the_checkout_prop('Business Name','name') ?>

    Of course, it will only pull the last field with that name, which might not work for you if you’ve got 2 identically named fields. You could also use the checkout field ID’s like so:

    <?php echo ECSE_purchase::get_the_checkout_prop('<your-field-ID>','id') ?>

    Unfortunately WP e-Commerce doesn’t allow you to set your own unique names for fields. If that feature ever becomes available, you’ll have a better way to query for fields.

    If you want to get an idea of what data is available, and how it’s organized, try this:

    <pre><?php print_r( ECSE_purchase::get_the_checkout_prop() ) ?></pre>

    okay, this is what i did, maybe can help.
    In wpsc-transaction_results.php

    $request_id = str_replace(“‘”, “”, $_REQUEST[‘sessionid’]);

    $select_pur_id = “SELECT id FROM ".$wpdb->prefix."wpsc_purchase_logs WHERE sessionid='”.$request_id.”‘”;

    $return_pur_arr = $wpdb->get_row($select_pur_id,ARRAY_A) ;
    $purchase_id = (int)$return_pur_arr[‘id’];

    ECSE_purchase::get_purchase($purchase_id)

    echo ‘

    ';
    print_r( ECSE_purchase::get_the_checkout_prop() );
    echo '

    ‘;

    Plugin Author Jacob Schwartz

    @mightyturtle

    Hi Matteo,

    Are you saying that this worked for you? Or that you need help with it?

    Regards,

    Jacob

    Yes it’s worked for me!
    Just last question, what if the field dosen’t not exist?
    For example if in the chekout i select “same as shipping” billingfirstname doesn’t not exist, and get the error.
    So should use someting like if_isset?

    Thanks a lot

    Plugin Author Jacob Schwartz

    @mightyturtle

    Matteo,

    Yep, that’s right – always plan for fields not being filled. If a field’s value is not available, the function will return false. So the correct test would be if(empty())

    Best,

    Jacob

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] How to show custom field in email?’ is closed to new replies.
Skip to toolbar