WordPress.org

Ready to get started?Download WordPress

Forums

WP e-Commerce Style Email
[resolved] How to show custom field in email? (7 posts)

  1. Oudin
    Member
    Posted 1 year ago #

    Hi

    I've added a custom field "Business Name" to both the billing and shipping I would like to know if is possible to show these custom fields in the email?

    http://wordpress.org/extend/plugins/wp-e-commerce-style-email/

  2. Matteo Legittimo
    Member
    Posted 1 year ago #

    Hi,
    i need to!

    Thanks!

  3. Jacob Schwartz
    Member
    Plugin Author

    Posted 1 year ago #

    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>

  4. Matteo Legittimo
    Member
    Posted 1 year ago #

    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 '
    ';

  5. Jacob Schwartz
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Matteo,

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

    Regards,

    Jacob

  6. Matteo Legittimo
    Member
    Posted 1 year ago #

    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

  7. Jacob Schwartz
    Member
    Plugin Author

    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic