1

我在 Prestashop 论坛上问过这个问题,但目前还没有回复。

我需要能够将 sagepay 代码添加到 mailalert 模块中使用的新订单电子邮件。

我所拥有的是;

// 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,
...
 );

每次我测试交易时,$spvtxc 都会返回“ARRAY”。我努力了;

$spvtxc = '5';

正如预期的那样,这将返回 5 作为 sagepay 编号,因此我确信正在调用变量并将其添加到电子邮件中。我试过了;

$spvtxc = Db::getInstance()->ExecuteS("SELECT vendortxcode FROM `"._DB_PREFIX_."sagepay_transactions` WHERE id_cart = '2'");

所以这应该将 $spvtxc 设置为肯定存在的值(我手动将它添加到数据库中),但这仍然返回'ARRAY'。

如果有人能指出我错过了什么,那将不胜感激。

4

1 回答 1

1

因为我只需要返回一个值,所以我应该使用 getValue 函数而不是 ExecuteS。

$spvtxc = Db::getInstance()->getValue("SELECT vendortxcode FROM `"._DB_PREFIX_."sagepay_transactions` WHERE id_cart = '$order->id_cart'");

这返回了值。

于 2012-06-22T12:36:26.973 回答