ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,68 @@
<?php
namespace CK\Tax\Plugin;
use Magento\Quote\Model\Quote;
use Magento\Quote\Api\Data\ShippingAssignmentInterface;
use Magento\Quote\Model\Quote\Address\Total as QuoteTotal;
use Magento\Tax\Model\Sales\Total\Quote\Tax as TaxCollector;
class SkipTaxCollector {
/**
* @var \CK\Logger\Logger
*/
protected $logger;
/**
* @var \CK\Logger\LoggerFactory
*/
protected $loggerFactory;
public function __construct(
\CK\Logger\LoggerFactory $loggerFactory
) {
$this->loggerFactory = $loggerFactory;
$this->logger = $this->loggerFactory->create();
}
/**
* Around plugin for Tax::collect
*
* @param TaxCollector $subject
* @param callable $proceed
* @param Quote $quote
* @param ShippingAssignmentInterface $shippingAssignment
* @param QuoteTotal $total
* @return TaxCollector
*/
public function aroundCollect(
TaxCollector $subject,
callable $proceed,
Quote $quote,
ShippingAssignmentInterface $shippingAssignment,
QuoteTotal $total
) {
$netsuiteOrderId = $quote->getData('netsuite_order_id');
if ($netsuiteOrderId !== null) {
$this->logger->info("This quote generated from NS order $netsuiteOrderId, skipping tax calculation.");
// zero out tax on totals
$total->setTotalAmount('tax', 0);
$total->setBaseTotalAmount('tax', 0);
// zero out tax on each item in the shipping assignment
foreach ($shippingAssignment->getItems() as $item) {
$item->setTaxAmount(0);
$item->setBaseTaxAmount(0);
$item->setTaxPercent(0);
}
return $subject;
}
return $proceed($quote, $shippingAssignment, $total);
}
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Tax\Model\Sales\Total\Quote\Tax">
<plugin name="ck_sales_skip_tax_collector" type="CK\Tax\Plugin\SkipTaxCollector" sortOrder="10" />
</type>
</config>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="CK_Tax" setup_version="1.0.0"/>
</config>
+13
View File
@@ -0,0 +1,13 @@
<?php declare(strict_types=1);
/**
* @author CK Liang
* @copyright Copyright (c) CK Liang
* @package CK_Tax
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'CK_Tax',
__DIR__
);