Commit a079ce50 by dhn

测试

parent c52bc8e5
...@@ -14,6 +14,7 @@ use Magento\Framework\View\Element\Template\Context; ...@@ -14,6 +14,7 @@ use Magento\Framework\View\Element\Template\Context;
use Magento\Customer\Model\Session as CustomerSession; use Magento\Customer\Model\Session as CustomerSession;
use Magento\Checkout\Model\Session as CheckoutSession; use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\Config\ScopeConfigInterface;
/** /**
* Cart Shipping Block * Cart Shipping Block
...@@ -43,7 +44,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart ...@@ -43,7 +44,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
* @var JsonHexTag * @var JsonHexTag
*/ */
private $jsonHexTagSerializer; private $jsonHexTagSerializer;
protected $_scopeConfigInterface;
protected $_quote; protected $_quote;
/** /**
* @param Context $context * @param Context $context
...@@ -65,7 +66,8 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart ...@@ -65,7 +66,8 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
array $layoutProcessors = [], array $layoutProcessors = [],
array $data = [], array $data = [],
Json $serializer = null, Json $serializer = null,
JsonHexTag $jsonHexTagSerializer = null JsonHexTag $jsonHexTagSerializer = null,
ScopeConfigInterface $_scopeConfigInterface
) { ) {
$this->configProvider = $configProvider; $this->configProvider = $configProvider;
$this->layoutProcessors = $layoutProcessors; $this->layoutProcessors = $layoutProcessors;
...@@ -74,6 +76,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart ...@@ -74,6 +76,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
$this->_isScopePrivate = true; $this->_isScopePrivate = true;
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class); $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
$this->jsonHexTagSerializer = $jsonHexTagSerializer ?: ObjectManager::getInstance()->get(JsonHexTag::class); $this->jsonHexTagSerializer = $jsonHexTagSerializer ?: ObjectManager::getInstance()->get(JsonHexTag::class);
$this->_scopeConfigInterface = $_scopeConfigInterface;
} }
/** /**
...@@ -125,6 +128,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart ...@@ -125,6 +128,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
{ {
return $this->jsonHexTagSerializer->serialize($this->getCheckoutConfig()); return $this->jsonHexTagSerializer->serialize($this->getCheckoutConfig());
} }
public function getFlatratePrice()
{
return $this->_scopeConfigInterface->getValue('carriers/flatrate/price');
}
public function getCountryHtmlSelect($defValue = null, $name = 'country_id', $id = 'country', $title = 'Country') { public function getCountryHtmlSelect($defValue = null, $name = 'country_id', $id = 'country', $title = 'Country') {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Directory\Block\Data $block */ /** @var \Magento\Directory\Block\Data $block */
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<?php /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?> <?php /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?>
<?php <?php
$selectedCountryId = $block->getCountryId(); $selectedCountryId = $block->getCountryId();
$flatraPrice = $block->getFlatratePrice();
?> ?>
<div id="block-shipping" class="block shipping"> <div id="block-shipping" class="block shipping">
<div id="block-summary" style="display: none;"> <div id="block-summary" style="display: none;">
...@@ -29,6 +30,7 @@ $selectedCountryId = $block->getCountryId(); ...@@ -29,6 +30,7 @@ $selectedCountryId = $block->getCountryId();
$scriptString = <<<script $scriptString = <<<script
window.checkoutConfig = {$serializedCheckoutConfig}; window.checkoutConfig = {$serializedCheckoutConfig};
window.checkoutConfig.flatrate_price = {$flatraPrice};
window.customerData = window.checkoutConfig.customerData; window.customerData = window.checkoutConfig.customerData;
window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn; window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
require([ require([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment