Support » Plugin: WooCommerce » WooCommerce parameters for html POST method form

  • Resolved onasol

    (@onasol)


    H, I must add a form with method=”post” to a WooCommerce “success”-site (the site that appears after a customer has completed his order).

    The form I am using requires the following 5 WooCommerce parameters:
    1. customer email address {value email}
    2. purchase price {value amount}
    3. used payment type {value paymentType}
    4. customer number {value kdnr}
    5. order number {value ordernr}

    Here is the relevant part of the code I am refering to:

    <input name="email" type="hidden" value="{value email}">
    <input name="amount" type="hidden" value="{value amount}">
    <input name="paymentType" type="hidden" value="{value paymentType}">
    <input name="kdnr" type="hidden" value="{value kdnr}">
    <input name="ordernr" type="hidden" value="{value ordernr}">

    The {value …} sections need to be replaced with the equivalent WooCommerce parameters. Does anybody know how I can get or find out the above mentioned WooCommerce parameters for a “POST method form”?

    I appreciate any help. Thanks in advance!

    Regards,
    Mike

    http://wordpress.org/plugins/woocommerce/

Viewing 15 replies - 1 through 15 (of 25 total)
  • I found the following WooCommerce parameter (in the customer-processing-order.php file for customer/billing email which I have replaced with {value email} (in the above code) but no information was forwarded via the form:

    <?php echo $order->billing_email; ?>

    I have also tried:

    <?php echo $order->billing_email ?>

    and:

    <?php echo $billing_email ?>

    Nothing worked! Any ideas?? It is very urgently needed. Thanks a lot!

    Hi Mike,

    I need the same information. And I tried the same you did (billing_email) – nothing worked.

    If I┬┤ll get a solution from an other forum, I`ll tell you.
    Please – do the same here ­čÖé

    Heike

    Hi HeikeÔÇŽ┬áthat would be great!! Thanks.

    Sure, I’ll let you know! ­čÖé
    Let’s hope someone has a solution because I need it urgently.

    Mike

    Hi Mark,

    I got this code but it doesn`t work. It┬┤s what we just tried to do. I need it for the final Trusted Shops Certification – and it┬┤s very urgent too… And I┬┤m really desperate in between because they don┬┤t have another answer. The whole problem came just after the last woocommerce update.

    <input name="email" type="hidden" value="<?php echo order->billing_email ?>">
    <input name="amount" type="hidden" value="<?php echo $order->order_total ?>">
    <input name="curr" type="hidden" value="EUR">
    <input name="paymentType" type="hidden" value="-">
    <input name="kdnr" type="hidden" value="-">
    <input name="ordernr" type="hidden" value="<?php echo $order->id ?>">

    Still hoping…
    Heike

    This is EXACTLY what I need it for!!! ­čÖé
    The ÔÇ×Anmeldung zum Trusted Shops K├Ąuferschutz”-form.

    I have tried the same codes you have depicted. Did not work for me either.

    I am using WordPress 3.5.2 and WooCommerce 2.0.4

    You’ve wrote “the whole problem came just after the last woocommerce update”. So this means the code worked before the update?

    It worked once, but it wasn┬┤t a really good solution because on the “bestellung erhalten”-page the whole text was shown again. So there could have been a mistake before – but they accepted it because their form was correctly shown.

    It worked with the enclosed php-function.
    But it doesn┬┤t work with it now (in two places you have to fill in your shop-id)!
    ……………………..

    function add_trusted_shops_code_to_thank_you( $order_id ){
    	//  Get order object
    	$order_obj = new WC_Order( $order_id );
    
    	//print'
    <pre>';print_r( $order_obj );print'</pre>
    ';
    
    	print '<table width=400 border="0" cellspacing="0" cellpadding="4"><tr><td width="90">';
    	print '<a>your-shop id " target="_blank">';
    	print '<img border="0" src="pfad/zur/siegelgrafik.gif" title="Trusted Shops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!" ';
    	print 'alt="Trusted Shops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!"></a>';
    	print '</td><td align="justify">';
    	print '<form id="formTShops" name="formTShops" method="post" action="https://www.trustedshops.com/shop/protection.php" target="_blank">';
    	print '<input name="_charset_" type="hidden" value="UTF-8">';
    	print '<input name="shop_id" type="hidden" value="<strong>your-shop-id</strong> ">';
    	print '<input name="email" type="hidden" value="'. $order_obj->billing_email .'">';
    	print '<input name="amount" type="hidden" value="'. $order_obj->order_total .'">';
    	print '<input name="curr" type="hidden" value="EUR">';
    	print '<input name="paymentType" type="hidden" value="OTHER">';
    	print '<input name="kdnr" type="hidden" value="'. $order_obj->id .'">';
    	print '<input name="ordernr" type="hidden" value="'. $order_obj->id .'">';
    	print 'Als zus├Ątzlichen Service bieten wir Ihnen den Trusted Shops K├Ąuferschutz an. Wir ├╝bernehmen
    alle Kosten dieser Garantie, Sie m├╝ssen sich lediglich anmelden.';
    	print '
    
    <input type="submit" id="btnProtect" name="btnProtect" value="Anmeldung zum Trusted Shops K├Ąuferschutz">';
    	print '</form></td></tr></table>';
    }
    add_action( 'woocommerce_thankyou', 'add_trusted_shops_code_to_thank_you' );

    ……………………

    I put it in the thankyou.php and then the add_action… in the functions.php of woocommerce.

    Last information I got from Trusted Shops is, that I should engage someone to solve the problem…

    OkÔÇŽ so just to be sure I understood you right. With the above code it once worked for you?

    So you’ve put the above code, just the way you have depicted it…

    function add_trusted_shops_code_to_thank_you( $order_id ){
    // Get order object
    $order_obj = new WC_Order( $order_id );
    
    //print'
    
    ';print_r( $order_obj );print'
    
    ';
    
    print '<table width=400 border="0" cellspacing="0" cellpadding="4"><tr><td width="90">';
    print 'your-shop id " target="_blank">';
    print '<img border="0" src="pfad/zur/siegelgrafik.gif" title="Trusted Shops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!" ';
    print 'alt="Trusted Shops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!">';
    print '</td><td align="justify">';
    print '<form id="formTShops" name="formTShops" method="post" action="https://www.trustedshops.com/shop/protection.php" target="_blank">';
    print '<input name="_charset_" type="hidden" value="UTF-8">';
    print '<input name="shop_id" type="hidden" value="your-shop-id ">';
    print '<input name="email" type="hidden" value="'. $order_obj->billing_email .'">';
    print '<input name="amount" type="hidden" value="'. $order_obj->order_total .'">';
    print '<input name="curr" type="hidden" value="EUR">';
    print '<input name="paymentType" type="hidden" value="OTHER">';
    print '<input name="kdnr" type="hidden" value="'. $order_obj->id .'">';
    print '<input name="ordernr" type="hidden" value="'. $order_obj->id .'">';
    print 'Als zus├Ątzlichen Service bieten wir Ihnen den Trusted Shops K├Ąuferschutz an. Wir ├╝bernehmen
    alle Kosten dieser Garantie, Sie m├╝ssen sich lediglich anmelden.';
    print '
    
    <input type="submit" id="btnProtect" name="btnProtect" value="Anmeldung zum Trusted Shops K├Ąuferschutz">';
    print '</form></td></tr></table>';
    }

    in the thankyou.php file?

    and additionally you have added the following code…

    add_action( 'woocommerce_thankyou', 'add_trusted_shops_code_to_thank_you' );

    to the functions.php file?

    I am asking because the code looks different than the trusted shops code, so I want to be sure that this is the code you have used… or maybe the formatting somehow got broken when posting it here in the support.

    (and of course all this has to be done with the specific shop id)

    You┬┤re generally right with all steps – and there are broken elements. So now it should be correct:

    function add_trusted_shops_code_to_thank_you( $order_id ){
    	//  Get order object
    	$order_obj = new WC_Order( $order_id );
    
    	//print'<pre>';print_r( $order_obj );print'</pre>';
    
    	print '<table width=400 border="0" cellspacing="0" cellpadding="4"><tr><td width="90">';
    	print '<a href="https://www.trustedshops.com/shop/certificate.php?shop_id=shop_id" target="_blank">';
    	print '<img border="0" src="pfad/zur/siegelgrafik.gif" title="Trusted Shops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!" ';
    	print 'alt="Trusted Shops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!"></a>';
    	print '</td><td align="justify">';
    	print '<form id="formTShops" name="formTShops" method="post" action="https://www.trustedshops.com/shop/protection.php" target="_blank">';
    	print '<input name="_charset_" type="hidden" value="UTF-8">';
    	print '<input name="shop_id" type="hidden" value="shop_id ">';
    	print '<input name="email" type="hidden" value="'. $order_obj->billing_email .'">';
    	print '<input name="amount" type="hidden" value="'. $order_obj->order_total .'">';
    	print '<input name="curr" type="hidden" value="EUR">';
    	print '<input name="paymentType" type="hidden" value="OTHER">';
    	print '<input name="kdnr" type="hidden" value="'. $order_obj->id .'">';
    	print '<input name="ordernr" type="hidden" value="'. $order_obj->id .'">';
    	print 'Als zus├Ątzlichen Service bieten wir Ihnen den Trusted Shops K├Ąuferschutz an. Wir ├╝bernehmen
    alle Kosten dieser Garantie, Sie m├╝ssen sich lediglich anmelden.';
    	print '<br /><br /><input type="submit" id="btnProtect" name="btnProtect" value="Anmeldung zum Trusted Shops K├Ąuferschutz">';
    	print '</form></td></tr></table>';
    }
    add_action( 'woocommerce_thankyou', 'add_trusted_shops_code_to_thank_you' );

    It┬┤s the php-script from Trusted Shops. Does it work in your installation?

    If you have a good knowledge in php – please check the way I put it in. I┬┤m sure there must be a better way – how do I have to include it on the “bestellung erhalten”(thank-you)-page? I think, it must be there too (more important than in the functions.php…)

    If I try it with your code and add it to thankyou.php and functions.php the “Anmeldung zum Trusted Shops K├Ąuferschutz” doesn’t appear at all.

    Until now I have done it like this: Adding the following code to my “Auftrag eingegangen”-site (which should be found at http://www.yourdomain.de/kasse/auftrag-eingegangen)

    <table width=400 border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td width="90">
    <form name="formSiegel" method="post" action="https://www.trustedshops.com/shop/certificate.php" target="_blank">
    <input type="image" border="0" src="{pfad/zum/siegel.png}" title="TrustedShops G├╝tesiegel - Bitte hier G├╝ltigkeit pr├╝fen!">
    <input name="shop_id" type="hidden" value="{value shop id}">
    </form>
    </td>
    <td align="justify">
    <form id="formTShops" name="formTShops" method="post" action="https://www.trustedshops.com/shop/protection.php" target="_blank">
    <input name="_charset_" type="hidden" value="">
    <input name="shop_id" type="hidden" value="{value shop id}">
    <input name="email" type="hidden" value="{value email}">
    <input name="amount" type="hidden" value="{value amount}">
    <input name="curr" type="hidden" value="EUR">
    <input name="paymentType" type="hidden" value="{value paymentType}">
    <input name="kdnr" type="hidden" value="{value kdnr}">
    <input name="ordernr" type="hidden" value="{value ordernr}">
    Als zus├Ątzlichen Service bieten wir Ihnen den Trusted Shops K├Ąuferschutz an. Wir ├╝bernehmen alle Kosten dieser Garantie, Sie m├╝ssen sich lediglich anmelden.
    <br><br>
    <input type="submit" id="btnProtect" name="btnProtect" value="Anmeldung zum Trusted Shops K├Ąuferschutz">
    </form>
    </td>
    </tr>
    </table>

    But I can not find the proper WooCommerce equivalent forÔÇŽ
    {value email}
    {value amount}
    {value paymentType}
    {value kdnr}
    {value ordernr}

    Everyone – you NEED to use the backticks or code buttons (not blockquotes) when posting code on these forums – please see:

    http://codex.wordpress.org/Forum_Welcome#Posting_Code

    All codes are put in between backticks

    Yes, I just fixed 3 posts.

    I seeÔÇŽ ok thanks.

    And if you could also fix our main problem we have here, it would be awsome ­čÖé

    @ WPyogi – yes, thanks, I just learned to use the backticks – do you also have an idea to solve our really important problem? Or do you know anybody who will be able to check the code?

    @ Mike – the equivalents are the same like in the php-code. You have to put them into the html-code, look to my first post with code (it is, what they sent me from Trusted Shops) – but it doesn┬┤t work…
    The link you posted doesn┬┤t work. But I think your “auftrag eingegangen”-page is my “bestellung erhalten”-page. There you only can include the html-code, function.php and thankyou.php need the php-script.

    Hell – I think the solution is so easy.
    Don┬┤t worry – we┬┤ll find it!

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘WooCommerce parameters for html POST method form’ is closed to new replies.