我在 Magento 中编写了一个手动脚本在付款过程中记录我的交易。事务成功后 MySQL 查询工作正常,我可以在 MySQL 中看到数据。但是我的查询在支付失败后回滚(看起来像插入和删除)。当我查看我的 MySQL 表时,我可以看到自动增量增加但没有数据。
我的代码如下。如何阻止 Magento 回滚我的查询?
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$results = $conn->query("insert into pos_transactions(order_id, transaction_time, ip, type) values('$orderId', '$sysDate', '$ip', 'Auth')");
最佳答案
这对我有用(在 Magento Enterprise Edition 1.10 中测试):
$inSql = "INSERT INTO my_table(fieldA
,fieldB
) ";
$inSql.= "VALUES('$valueA', '$valueB'); 提交;";
Mage::getSingleton('core/resource')->getConnection('core_write')->query($inSql);
我希望这对你有用。
关于mysql - 支付操作失败后,如何在 Magento 中禁用 MySQL 查询回滚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5117492/