우선 내 문제를 이해하기 위해 스크린 샷을주고 싶습니다.
이제 여기에 관련 코드를 추가하고 싶습니다.
etc / 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
.