Zen Cart Logo
Forums / General Questions / customer email adress from checkout_succes page...

customer email adress from checkout_succes page...

Locked

Views: 688

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
22 Dec 2010, 2:26 PM
#1
eentje avatar

eentje

Zen Follower

Join Date:
Jan 2009
Location:
The Netherlands/Germany
Posts:
144
Plugin Contributions:
4

customer email adress from checkout_succes page...

Dear community & devś,

At the moment iḿ trying to trigger a feedback email from the checkout succes page.

This is for a customer review site...

The idea is following:

After customers checkout successfully a link is triggered which will send the customer an email to please review the webshop.

So after reading and thinking about is my thought was to let the link behave in the tracking pixel fashion way.

So i put following code into the includes/templates/MYTEMPLATE/checkout_success/tpl_footer.php

<?php
$capture = file_get_contents('https://DOMAIN.TLD/set.php?user=USERNAME&connector=SHA1STRING&action=sendInvitation&targetMail=EMAILADRESS&delay=DAYS');
?>

When i hard code all the information then there is no problem... email adress is send and the invitation email to review the webshop has been received.

To hardcode the user, sha1string & delay is not a problem at first... (can always write a admin to it further on). My problem is to get the customers email adress.

I tried to get it from the header_php.php by adding:

$customer_email_query = "SELECT customers_email_address
			 FROM " . TABLE_CUSTOMERS . "
			 WHERE customers_id = ':customersID' ";
$customer_email = $db->Execute($customer_email_query);

or this:

$customer_email_query = "SELECT customers_email_address
			 FROM " . TABLE_CUSTOMERS . "
			 WHERE customers_id = ':customersID' ";
$customer_email_query = $db->bindVars($customer_email_query, ':customersID', $_SESSION['customer_id'], 'integer');
$customer_email = $db->Execute($customer_email_query);

and then changing the link to:

https://DOMAIN.TLD/set.php?user=USERNAME&connector=SHA1STRING&action=sendInvitation&targetMail=' . $customer_email; . '&delay=DAYS

but that gives me a Object of class queryFactoryResult could not be converted to string error.

I also tried

https://DOMAIN.TLD/set.php?user=USERNAME&connector=SHA1STRING&action=sendInvitation&targetMail=' echo $customer_email;  '&delay=DAYS

but that gave a unexpected T_Echo

I might be missing the obvious but i can not see what i am doing wrong or what i am forgetting to why it won't work...

Any help appreciated.

23 Dec 2010, 7:59 PM
#2
eentje avatar

eentje

Zen Follower

Join Date:
Jan 2009
Location:
The Netherlands/Germany
Posts:
144
Plugin Contributions:
4

Re: customer email adress from checkout_succes page...

nobody a clue or a hint? too bad... have to figure something else out...:(

24 Dec 2010, 2:21 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: customer email adress from checkout_succes page...

Since you're not extracting the query result value into a variable yet, you would need to use $customer_email->fields['customers_email_address']

24 Dec 2010, 10:44 AM
#4
eentje avatar

eentje

Zen Follower

Join Date:
Jan 2009
Location:
The Netherlands/Germany
Posts:
144
Plugin Contributions:
4

Re: customer email adress from checkout_succes page...

Thanks DrByte that did the trick... :clap: you saved my X-Mass :)

Now have to tidy it up... put the other things in an admin and wrap it all up in a module... :)