Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2012
    Posts
    23
    Plugin Contributions
    0

    Default Submitting data to Trusted Shops

    Hi All

    I'm hoping you can help with a little problem I'm having.

    We are integrating trusted shops buyer protection into our zen cart website and need to submit some data by clicking a button on the checkout confirmation page.

    As advised, I'm doing this with a form similar to the following (Not quite complete, but OK for testing at the moment):

    <form action="protection.php" method="post" />

    <p>
    <input type="hidden" name="_charset_" value="utf-8" />
    </p>

    <p>
    <input type="hidden" name="shop_id" value="" />
    </p>
    <p>
    <input type="hidden" name="email" value=""/>
    </p>

    <p>
    <input type="hidden" name="amount" value=""/>
    </p>

    <p>
    <input type="hidden" name="curr" value=""/>
    </p>


    <p><input type="submit" name="submit" value="Submit" />
    </p>
    </form>

    So, shop ID and charset are static values that I can just enter, but the other fields require live data from the order just placed to be entered.

    Could anyone advised what exactly needs to be entered in value to automatically get:

    Customer email address
    Order amount (inc shipping)
    Currency

    This is on the order confirmation page, just in case that make a difference.

    Many thanks in advance

  2. #2
    Join Date
    Sep 2012
    Posts
    23
    Plugin Contributions
    0

    Default Re: Submitting data to Trusted Shops

    Any help on this much appreciated...

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Submitting data to Trusted Shops

    Quote Originally Posted by whitsolltd View Post
    Could anyone advised what exactly needs to be entered in value to automatically get:

    Customer email address
    Order amount (inc shipping)
    Currency

    This is on the order confirmation page, just in case that make a difference.

    Add this
    print_r($_SESSION); exit ;

    At the start of the order confirmation page.

    This will display a list of all the data available in the $_SESSION variable. Identify the elements of interest (assuming they exist), and use this info to extract the elements needed into another variable, then use this variable to populate the data values.
    something like:

    $Customer_email_address = $_SESSION['Customer_Email'] ; // This is what you identified as the needed field from the 'print_r()';

    <input type="hidden" name="email" value="$Customer_email_address"/> ;

    Cheers
    Rod.

  4. #4
    Join Date
    Sep 2012
    Posts
    23
    Plugin Contributions
    0

    Default Re: Submitting data to Trusted Shops

    Thanks

    The output looks like this:

    Array ( [securityToken] => XXXXXXXXXXXXXXXXXX [customers_host_address] => XXXXXXXXXXXXXXXX [cartID] => [cart] => shoppingCart Object ( [contents] => Array ( ) [total] => 0 [weight] => 0 [cartID] => [content_type] => [free_shipping_item] => 0 [free_shipping_weight] => 0 [free_shipping_price] => 0 ) [navigation] => navigationHistory Object ( [path] => Array ( [0] => Array ( [page] => index [mode] => SSL [get] => Array ( [type] => ec [token] => XXXXXXXXXXXXXXXX [PayerID] => XXXXXXXXXXXXX) [post] => Array ( ) ) [1] => Array ( [page] => checkout_process [mode] => SSL [get] => [post] => Array ( ) ) [2] => Array ( [page] => checkout_success [mode] => SSL [get] => [post] => Array ( ) ) ) [snapshot] => Array ( ) ) [language] => english [languages_id] => 1 [languages_code] => en [check_valid] => true [currency] => GBP [today_is] => 2013-03-10 [updateExpirations] => 1 [session_counter] => 1 [customers_ip_address] => XX.XXX.XX.XX [new_products_id_in_cart] => 1369 [messageToStack] => [valid_to_checkout] => 1 [cart_errors] => [customer_id] => 2 [customer_default_address_id] => 2 [customers_authorization] => 0 [customer_first_name] => XXXXXX [customer_last_name] => XXXXX [customer_country_id] => 222 [customer_zone_id] => 0 [shipping_tax_amount] => 0.658 [shipping_tax_description] => UK VAT Rate )

    This gives me the currency, but no email address or order total. I'm guessing that this is because it's cleared by the time we get to the checkout success page.

    Any way to make this display? If not, moving the form to the previous stag of checkout may help, but I would prefer it be on the success page.

    Surprised there is no email address though. Although I would be happy to have he customer enter this themselves if needs be. But I do need the total order value.

    Thanks again.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Submitting data to Trusted Shops

    Quote Originally Posted by whitsolltd View Post
    The output looks like this:
    Yeah, its not pretty, but then again, it wasn't supposed to be :)

    Quote Originally Posted by whitsolltd View Post
    This gives me the currency, but no email address or order total. I'm guessing that this is because it's cleared by the time we get to the checkout success page.
    Or, they aren't being stored in the $_SESSION variable after all. (I was just taking a punt).

    Quote Originally Posted by whitsolltd View Post
    Any way to make this display?
    Try adding the following in place of the prinr_r($_SESSION).

    var_dump(get_defined_vars());

    This will provide a dump of all the other variables defined/available on the page. you could still get lucky.

    Quote Originally Posted by whitsolltd View Post
    If not, moving the form to the previous stag of checkout may help, but I would prefer it be on the success page.
    Before doing this, you'll first need to confirm the data you require is available on the previous page. If it is, what you could then do is save the data from this page into a $_SESSION variable of your own, and read it back from the page where you do require it.
    Probably not the *best* way to do this, and certainly not the only way, but nonetheless, it is simple and effective.
    If you do elect to use this method you *must* 'sanitise' the values before using them. The reason being is that it *may* be possible for a hacker to create a session variable with the same name, but containing nefarious contents, with devastating effects. The chances of them doing so a very remote, but better safe than sorry.

    Cheers
    Rod

  6. #6
    Join Date
    Sep 2012
    Posts
    23
    Plugin Contributions
    0

    Default Re: Submitting data to Trusted Shops

    Thanks for this. Your help is most appreciated.

    I'll give these a try tomorrow and report back

  7. #7
    Join Date
    Sep 2012
    Posts
    23
    Plugin Contributions
    0

    Default Re: Submitting data to Trusted Shops

    Hi

    This looks much better. Inserting var_dump(get_defined_vars()); gave reams and reams of data, including everything I need, as follows:

    ["customers_email_address"]=> string(20) "[email protected]"

    ["order_total"]=> string(4) "6.94"

    ["currency"]=> string(3) "GBP"

    So the next stage is just getting this data into the form.

    Your instruction above was:

    $Customer_email_address = $_SESSION['Customer_Email'] ; // This is what you identified as the needed field from the 'print_r()';

    <input type="hidden" name="email" value="$Customer_email_address"/> ;

    I assume this doesn't apply anymore (It doesn't seem to get the result anyway)

    Can you suggest what needs to be entered into Value to get this last bit going?

    Thanks

  8. #8
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Submitting data to Trusted Shops

    Code:
    ["customers_email_address"]=> string(20) "[email protected]"
    
    $Customer_email_address = $_SESSION['Customer_Email'] ; 
    
    <input type="hidden" name="email" value="$Customer_email_address"/> ;
    Not sure where you got this but you might try removing the caps unless you are certain that they should be there
    Zen-Venom Get Bitten

  9. #9
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Submitting data to Trusted Shops

    Quote Originally Posted by whitsolltd View Post
    ["customers_email_address"]=> string(20) "[email protected]"
    ["order_total"]=> string(4) "6.94"
    ["currency"]=> string(3) "GBP"

    So the next stage is just getting this data into the form.

    Your instruction above was:

    $Customer_email_address = $_SESSION['Customer_Email'] ; // This is what you identified as the needed field from the 'print_r()';

    <input type="hidden" name="email" value="$Customer_email_address"/> ;

    I assume this doesn't apply anymore
    You are starting to scare me. I fear I may be leading you into places you shouldn't be going.

    No, it won't apply anymore.

    The "$Customer_email_address" needs to be populated with that variable that you found/discovered with the dump_vars() command.

    Using the data you have provided, the code would be:

    $Customer_email_address = ["customers_email_address"] ;

    BUT, I can tell you right now, all that'll do is produce a syntax error. The reason being is that ["customers_email_address"] is an *array* variable but you've neglected to include the NAME of the array.. Valid code would look like:

    $Customer_email_address = $_GLOBAL["customers_email_address"] ;
    or
    $Customer_email_address = $customer["customers_email_address"] ;
    or
    $Customer_email_address = $some_other_name["customers_email_address"] ;

    Cheers
    Rod

    ps. I don't wish to offend you, but the reason you didn't get a response to your original post is/was probably because 1) It isn't a ZenCart issue, and 2). We are NOT here to teach you the basics of programming. If I thought my 'hint' to get you going (after you bumped the thread) was going to lead into a beginners step by step tutorial I would simply have refered you to http://www.w3schools.com/php/default.asp

    pss: No apologies needed. No apologies given.

 

 

Similar Threads

  1. v151 Google Trusted Site
    By WWWD in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 14 Mar 2013, 06:04 PM
  2. using two shops with one data base
    By JasonRocket in forum General Questions
    Replies: 2
    Last Post: 29 Jan 2009, 08:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR