Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
a079ce50
Commit
a079ce50
authored
Mar 20, 2023
by
dhn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
c52bc8e5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
app/code/Magento/Checkout/Block/Cart/Shipping.php
+9
-2
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
+2
-0
No files found.
app/code/Magento/Checkout/Block/Cart/Shipping.php
View file @
a079ce50
...
...
@@ -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 */
...
...
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
View file @
a079ce50
...
...
@@ -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([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment