我们的网站使用的是已保存的cc。我们要冲洗已保存的已完成订单的信用卡信息。有谁能帮忙完成这件事吗?
最后我创建了一个自定义扩展来做到这一点。Magento将CC信息存储在sales_flat_order_payment和sales_flat_quote_payment中。我扩展了order网格类,并添加了自定义动作和控制器。
`$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";`
<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>