Magento:订单具有发票(已生成),但“应付总额"> 0 [英] Magento: Order has invoice (generated) but 'Total due' > 0

查看:66
本文介绍了Magento:订单具有发票(已生成),但“应付总额"> 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在线Magento 1.5.0.1网上商店,存在以下问题:

I have a live Magento 1.5.0.1 webshop, with the following problem:

我们已收到订单,该订单已通过iDEAL(荷兰在线支付服务)付款,并且在成功付款后会自动生成发票.我们还从我们的银行帐户中收到了这笔款项.

We have received an order, which has been paid for through iDEAL (Dutch online payment service) and an invoice has been auto-generated on payment success. We have also received the amount on our bank account.

唯一的事情是,由于应付总额"字段的金额大于0(零),因此我们无法完成订单.这必须是我们的iDEAL模块中的错误(将在稍后处理).

The only thing is, we cannot complete the order because of the 'Total due' field being an amount higher than 0 (zero). This must be a bug in our iDEAL-module (which will be dealt with at another moment).

是否有一种方法可以在应交总额"字段设置为0的情况下强制"此特定订单完成"?

Is there a way to 'force' this particular order to be 'complete' with the Total due field set to 0?

显然,这样做的PHP代码示例非常受欢迎(我自己是程序员).

Obviously, PHP-code examples to do so are quite welcome (I am a programmer myself).

推荐答案

这可能会对您有所帮助.

This might help you.

其中一个模块的示例:

$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
if ($order->getTotalPaid() == 0) {
    $invoice = $order->prepareInvoice();
    $invoice->register()->capture();
    Mage::getModel('core/resource_transaction')
        ->addObject($invoice)
        ->addObject($invoice->getOrder())
        ->save();
    $order->save();

这将检查付款是否尚未注册(用户可能通过单击多次发送多次成功请求),然后创建发票,进行注册,捕获并保存发票和订单.

This checks if payment was not yet registered(user might send several successful requests by multi clicking) then creates invoice, registers it, captures and save invoice and orders.

编辑1

private function markOrderPayd($incrementId, $status) {
        $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
        if ($order->getTotalPaid() == 0) {
            ... 
            $order->save();
            $invoice = $order->prepareInvoice();
            $invoice->register()->capture();
            ...
            Mage::getModel('core/resource_transaction')
                ->addObject($invoice)
                ->addObject($invoice->getOrder())
                ->save();
            $order->save();
            ...

        } else {
            ...
            $order->save();
        }
}

我想您没有任何支票,因此会生成2张发票.

I guess you don't have any check, so 2 invoices are generated.

这篇关于Magento:订单具有发票(已生成),但“应付总额"> 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆