Reputation: 1598
I have the following code present in my script. It's using the ZenCart built in DB Query handler. It's supposed to be pulling up the admin email address of the current admin.
Is there a better way to pull up the email address? All of this is being run from a script in ZenCart's backend.
$query = "select admin_email from ". TABLE_ADMIN ." where admin_id = " . $_SESSION['admin_id'];
$admin = $db->Execute( $query );
if( $admin ) { $admin = $admin->fields; }
zen_mail($customer['customers_firstname'] . " " . $customer['customers_lastname'],
$customer['customers_email_address'],
$subject,
$text,
TITLE,
$admin['admin_email'],
$block,
$module_used
);
Upvotes: 0
Views: 444
Reputation: 20026
For general purpose access to cart-sent email, use the Email Archive Manager:
http://www.zen-cart.com/downloads.php?do=file&id=101
If you're writing custom code, and need to grab the current admin's email address, do something like this:
$admin_id = $_SESSION['admin_id'];
$addr_query = "SELECT admin_email FROM " . TABLE_ADMIN . " WHERE admin_id = :a
dmin_id";
$addr_query = $db->bindVars($addr_query, ':admin_id', $admin_id, 'integer');
$addr_query_result = $db->Execute($addr_query);
echo "***" . $addr_query_result->fields['admin_email'];
Upvotes: 1