首先,我想提供一些屏幕截图以了解我的问题。
现在,我想在此处添加相关代码。
等/ frontend / di.xml
<?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\Checkout\Model\CompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="checkout_deliverysign_block" xsi:type="object">Kensium\DeliverySign\Model\DeliverySignConfigProvider</item>
</argument>
</arguments>
</type>
</config>
DeliverySignConfigProvider
<?php
namespace Kensium\DeliverySign\Model;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Store\Model\ScopeInterface;
class DeliverySignConfigProvider implements ConfigProviderInterface
{
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $scopeConfiguration;
protected $checkoutSession;
protected $logger;
/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfiguration
* @codeCoverageIgnore
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfiguration,
\Magento\Checkout\Model\Session $checkoutSession,
\Psr\Log\LoggerInterface $logger
)
{
$this->scopeConfiguration = $scopeConfiguration;
$this->checkoutSession=$checkoutSession;
$this->logger=$logger;
}
/**
* {@inheritdoc}
*/
public function getConfig()
{
$deliverySignConfig = [];
$enabled = $this->scopeConfiguration->getValue('deliverysign/deliverysign/status', ScopeInterface::SCOPE_STORE);
$minimumOrderAmount = $this->scopeConfiguration->getValue('deliverysign/deliverysign/minimum_order_amount', ScopeInterface::SCOPE_STORE);
$quote=$this->checkoutSession->getQuote();
$subtotal=$quote->getSubtotal();
$this->logger->addDebug($subtotal);
$deliverySignConfig['delivery_sign_amount'] = $this->scopeConfiguration->getValue('deliverysign/deliverysign/deliverysign_amount', ScopeInterface::SCOPE_STORE);
$deliverySignConfig['show_hide_deliverysign_block'] = ($enabled && ($minimumOrderAmount<$subtotal) && $quote->getFee()) ? true : false;
$deliverySignConfig['show_hide_deliverysign_shipblock'] = ($enabled && ($minimumOrderAmount<$subtotal)) ? true : false;
return $deliverySignConfig;
}
}
请在下面找到更多详细信息
https://github.com/sivajik34/Delivery-Signature-Magento2
我的观察是,DeliverySignConfigProvider
当您单击下一步按钮时,对象未在调用,而是在重新加载页面时仅在调用它。有人可以帮我吗?
Plugin/Checkout/Model/ShippingInformationManagement.php
。