neller Posted June 21, 2012 Share Posted June 21, 2012 (edited) I need to be able to add a sagepay code to the new order email used in mailalert module. What I have is // Filling-in vars for email $template = 'new_order'; $subject = $this->l('New order'); $spvtxc = Db::getInstance()->ExecuteS("SELECT vendortxcode FROM `"._DB_PREFIX_."sagepay_transactions` WHERE id_cart = '$order->id_cart'"); ... $templateVars = array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, ... '{sagepay_no}' => $spvtxc, ... ); Every time i test a transaction the $spvtxc returns 'ARRAY'. I have tried $spvtxc = '5'; As Expected this returns 5 as the sagepay number, so I'm confident the variables are being called and added to the email. And I tried $spvtxc = Db::getInstance()->ExecuteS("SELECT vendortxcode FROM `"._DB_PREFIX_."sagepay_transactions` WHERE id_cart = '2'"); So this should set $spvtxc to the value that is definatly there (i manually added it in the database), but this still returned 'ARRAY'. If anyone can point out what I have missed, it is greatly appriceated. Edited June 22, 2012 by neller (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted June 22, 2012 Share Posted June 22, 2012 try using the getValue function instead of ExecuteS $spvtxc = Db::getInstance()->getValue("SELECT vendortxcode FROM `"._DB_PREFIX_."sagepay_transactions` WHERE id_cart = '$order->id_cart'"); As long as your query will return only a single row, and you are only trying to select a single column, then getValue should work for you 1 Link to comment Share on other sites More sharing options...
neller Posted June 22, 2012 Author Share Posted June 22, 2012 That's the ticket, spot on. Thankyou. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now