解决ecshop订单修改价格后无法再次付款问题

1、admin/order.php中的以下代码

[php]
/**
* 更新订单对应的 pay_log
* 假如未付出,修正付出金额;不然,生成新的付出log
* @param int $order_id 订单id
*/
function update_pay_log($order_id)
[/php]

函数

用以下代码将其覆盖

[php]
function update_pay_log($order_id)
{
$order_id = intval($order_id);
if ($order_id > 0)
{
$sql = "SELECT order_amount FROM " . $GLOBALS['ecs']->table('order_info') .
" WHERE order_id = '$order_id'";
$order_amount = $GLOBALS['db']->getOne($sql);
if (!is_null($order_amount))
{
$sql = "SELECT log_id FROM " . $GLOBALS['ecs']->table('pay_log') .
" WHERE order_id = '$order_id'" .
" AND order_type = '" . PAY_ORDER . "'" .
" AND is_paid = 0";
$log_info =$GLOBALS['db']->GetRow($sql);
if (empty($log_info) || $log_info['order_amount'] != $order_amount)
{
$log_id = intval($log_info['log_id']);

/* 已付款,生成新的pay_log */
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('pay_log') .
" (order_id, order_amount, order_type, is_paid)" .
"VALUES('$order_id', '$order_amount', '" . PAY_ORDER . "', 0)";

$GLOBALS['db']->query($sql);

$log_id = intval($log_info['log_id']);
if ( $log_id > 0){
$sql_del = "delete from ". $GLOBALS['ecs']->table('pay_log') ." where log_id=".$log_id;
$GLOBALS['db']->query($sql_del);
}

}

}
}
}
[/php]

2、找到includes/lib_clips.php的get_paylog_id函数,修正成

[php]
/**
* 获得前次未付出的pay_lig_id
*
* @access public
* @param array $surplus_id 余额记录的ID
* @param array $pay_type 付出的类型:预付款/订单付出
*
* @return int
*/
function get_paylog_id($surplus_id, $pay_type = PAY_SURPLUS)
{
$sql = 'SELECT log_id FROM' .$GLOBALS['ecs']->table('pay_log').
" WHERE order_id = '$surplus_id' AND order_type = '$pay_type' AND is_paid = 0 order by log_id desc";
return $GLOBALS['db']->getOne($sql);
}
[/php]

今后客户在后台怎么调整都可以付款了

阅读剩余
THE END