【问题标题】:How to disable automatic invoice generation in magento?如何在magento中禁用自动发票生成?
【发布时间】:2014-02-06 17:09:32
【问题描述】:

我只是 Magento 的初学者。我需要你的帮助来解决这个问题。 我的 Magento 商店在付款后会自动生成发票邮件。付款是通过 PayPal(标准)进行的。订单状态也更改为“完成”而不是“待处理”。所以我无法手动生成发票。只有在查看产品订单后,我才需要从管理员端手动生成发票。仅在手动生成发票后,订单状态才应为“完成”。谁能帮我解决这个问题。

提前致谢

【问题讨论】:

  • 我也在使用贝宝标准,但我没有自动生成发票。我正在使用沙盒帐户。如果我使用真实帐户,自动发票生成是否有效?

标签: php magento paypal


【解决方案1】:

这很简单。只需转到系统->配置->销售电子邮件,然后在“发票”选项卡下将启用设置为否。

干杯,

【讨论】:

    【解决方案2】:

    如果您想以编程方式禁用自动发票发票,请按照以下步骤操作

    1. 在您的自定义模块中创建 di.xml 文件并添加首选项

    <preference for="Magento\Sales\Model\Order\Payment\Processor" type="Vendor\Module\Model\Express\Processor"/>
    1. 在 Vendor\Module\Model\Express\ 使用 Processor.php 创建新文件并添加以下代码:

    <?php
    declare(strict_types = 1);
    
    namespace Vendor\Module\Model\Express;
    
    use Magento\Sales\Api\Data\OrderPaymentInterface;
    
    class Processor extends \Magento\Sales\Model\Order\Payment\Processor
    {
        const PAYMENT_METHOD_PAYPAL_EXPRESS = "paypal_express";
        /**
         * Process capture operation
         *
         * @param OrderPaymentInterface $payment
         * @param InvoiceInterface $invoice
         * @return OrderPaymentInterface|Payment
         * @throws \Magento\Framework\Exception\LocalizedException
         */
        public function capture(OrderPaymentInterface $payment, $invoice)
        {
            if ($payment->getMethodInstance()
                ->getCode() != self::PAYMENT_METHOD_PAYPAL_EXPRESS)
            {
                return $this
                    ->captureOperation
                    ->capture($payment, $invoice);
            }
        }
    
        /**
         * Registers capture notification.
         *
         * @param OrderPaymentInterface $payment
         * @param string|float $amount
         * @param bool|int $skipFraudDetection
         * @return OrderPaymentInterface
         */
        public function registerCaptureNotification(OrderPaymentInterface $payment, $amount, $skipFraudDetection = false)
        {
            if ($payment->getMethodInstance()
                ->getCode() != self::PAYMENT_METHOD_PAYPAL_EXPRESS)
            {
                return $this
                    ->registerCaptureNotification
                    ->registerCaptureNotification($payment, $amount, $skipFraudDetection);
            }
        }
    }

    注意:它适用于 Magento 2X

    【讨论】:

      【解决方案3】:

      使用这个: http://www.magentocommerce.com/magento-connect/8870.html 我在几个项目中使用过,效果很好。

      【讨论】:

      • 这个模块在 Magento 的最新版本中不起作用。
      猜你喜欢
      • 2015-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-28
      • 2021-04-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-09
      相关资源
      最近更新 更多