Commit a079ce50 by dhn

测试

parent c52bc8e5
......@@ -14,6 +14,7 @@ use Magento\Framework\View\Element\Template\Context;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\Config\ScopeConfigInterface;
/**
* Cart Shipping Block
......@@ -43,7 +44,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
* @var JsonHexTag
*/
private $jsonHexTagSerializer;
protected $_scopeConfigInterface;
protected $_quote;
/**
* @param Context $context
......@@ -65,7 +66,8 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
array $layoutProcessors = [],
array $data = [],
Json $serializer = null,
JsonHexTag $jsonHexTagSerializer = null
JsonHexTag $jsonHexTagSerializer = null,
ScopeConfigInterface $_scopeConfigInterface
) {
$this->configProvider = $configProvider;
$this->layoutProcessors = $layoutProcessors;
......@@ -74,6 +76,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
$this->_isScopePrivate = true;
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
$this->jsonHexTagSerializer = $jsonHexTagSerializer ?: ObjectManager::getInstance()->get(JsonHexTag::class);
$this->_scopeConfigInterface = $_scopeConfigInterface;
}
/**
......@@ -125,6 +128,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
{
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') {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Directory\Block\Data $block */
......
......@@ -9,6 +9,7 @@
<?php /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?>
<?php
$selectedCountryId = $block->getCountryId();
$flatraPrice = $block->getFlatratePrice();
?>
<div id="block-shipping" class="block shipping">
<div id="block-summary" style="display: none;">
......@@ -29,6 +30,7 @@ $selectedCountryId = $block->getCountryId();
$scriptString = <<<script
window.checkoutConfig = {$serializedCheckoutConfig};
window.checkoutConfig.flatrate_price = {$flatraPrice};
window.customerData = window.checkoutConfig.customerData;
window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
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