且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

magento以编程方式创建未付款发票

更新时间:2023-11-30 13:41:52

主要取决于将发票设置为paidpending的付款方式设置.

mainly it depend on the payment method settings that your invoice will be set as paid or pending.

如果指定了付款方式:

检查以下代码以将发票设置为待处理.

check the below code for setting invoice as pending.

protected $_canCapture                  = true;
protected $_canCapturePartial           = true;

$emailInvoice = true;
$captureInvoice = false;

$invoiceApi = Mage::getModel('sales/order_invoice_api');
$invoiceId = $invoiceApi->create(
    $order->getIncrementId(),
    array(),
    Mage::helper('sales')->__('Pending Invoice created!'),
    $emailInvoice,
    false
);

if ($captureInvoice) {
    $invoiceApi->capture($invoiceId);
}