我们正在为我们的网站使用已保存的 cc。我们想刷新已完成订单的已保存信用卡信息。有人可以帮忙吗?
问问题
2809 次
2 回答
4
最后我创建了一个自定义扩展来执行此操作。Magento 将 CC 信息存储在 sales_flat_order_payment 和 sales_flat_quote_payment 中。我扩展了订单网格类并添加了自定义操作和控制器。
`$updatefirsttable = "UPDATE `sales_flat_order_payment` SET `cc_number_enc` = NULL,`cc_exp_month`=NULL,`cc_exp_year`=NULL,`cc_type`=NULL WHERE `entity_id` =$transactions->entity_id";
$updatesecondtable = "UPDATE `sales_flat_quote_payment` SET `cc_number_enc` = NULL,`cc_exp_month`=NULL,`cc_exp_year`=NULL,`cc_type`=NULL WHERE `quote_id` =$transactions->quote_id";`
于 2014-07-21T06:07:39.727 回答
0
<html>
<form method="GET">
<?php
if (isset($_REQUEST['beforeDate'])) {
$beforeDate = $_REQUEST['beforeDate'];
} else {
$beforeDate = date("d.m.Y", time() - 24*60*60*30);
}
if (isset($_REQUEST['submitFlag'])) {
if ($_REQUEST['submitFlag'] == 1) {
$mysqli = new mysqli("localhost", "<login>", "<password>", "<database>");
$result = $mysqli->query("
update
sales_flat_order_payment p
set
cc_number_enc = null
where
cc_number_enc is not null
and
entity_id in
(
select
entity_id
from
sales_flat_order ord
where
ord.created_at <= date '" . date('Y-m-d', strtotime($beforeDate)) . "'
)
");
if ($result){
echo "<h2>Credit card information deleted till $beforeDate. Affected records=" . $mysqli->affected_rows . "</h2>";
} else {
echo "There's an error processing your request: please, contact developer: <your email>";
}
}
}
?>
<label for="beforeDate">Please, enter date, before which you would like to delete credit card information<label>
<input type="text" name="beforeDate" id="beforeDate" value="<?=$beforeDate?>"></input>
<input type="submit" value="Let's do it!"></input>
<input name="submitFlag" type="hidden" value="1"></input>
</form>
</html>
于 2017-09-12T01:19:46.210 回答