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
127897d1
Commit
127897d1
authored
Mar 17, 2023
by
dhn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
27d9a21c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
app/code/Magento/Checkout/Block/Cart/Shipping.php
+7
-1
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
+8
-1
app/code/Magento/Checkout/view/frontend/web/js/view/address-get.js
+1
-0
No files found.
app/code/Magento/Checkout/Block/Cart/Shipping.php
View file @
127897d1
...
@@ -44,6 +44,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
...
@@ -44,6 +44,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
*/
*/
private
$jsonHexTagSerializer
;
private
$jsonHexTagSerializer
;
protected
$_quote
;
/**
/**
* @param Context $context
* @param Context $context
* @param CustomerSession $customerSession
* @param CustomerSession $customerSession
...
@@ -55,6 +56,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
...
@@ -55,6 +56,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
* @param JsonHexTag|null $jsonHexTagSerializer
* @param JsonHexTag|null $jsonHexTagSerializer
* @throws \RuntimeException
* @throws \RuntimeException
*/
*/
public
function
__construct
(
public
function
__construct
(
Context
$context
,
Context
$context
,
CustomerSession
$customerSession
,
CustomerSession
$customerSession
,
...
@@ -67,6 +69,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
...
@@ -67,6 +69,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
)
{
)
{
$this
->
configProvider
=
$configProvider
;
$this
->
configProvider
=
$configProvider
;
$this
->
layoutProcessors
=
$layoutProcessors
;
$this
->
layoutProcessors
=
$layoutProcessors
;
$this
->
_quote
=
$checkoutSession
->
getQuote
();
parent
::
__construct
(
$context
,
$customerSession
,
$checkoutSession
,
$data
);
parent
::
__construct
(
$context
,
$customerSession
,
$checkoutSession
,
$data
);
$this
->
_isScopePrivate
=
true
;
$this
->
_isScopePrivate
=
true
;
$this
->
serializer
=
$serializer
?:
ObjectManager
::
getInstance
()
->
get
(
Json
::
class
);
$this
->
serializer
=
$serializer
?:
ObjectManager
::
getInstance
()
->
get
(
Json
::
class
);
...
@@ -83,7 +86,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
...
@@ -83,7 +86,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
{
{
return
$this
->
configProvider
->
getConfig
();
return
$this
->
configProvider
->
getConfig
();
}
}
public
function
getCountryId
()
{
$shippingAddress
=
$this
->
_quote
->
getShippingAddress
();
return
$shippingAddress
->
getCountryId
();
}
/**
/**
* Retrieve serialized JS layout configuration ready to use in template
* Retrieve serialized JS layout configuration ready to use in template
*
*
...
...
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
View file @
127897d1
...
@@ -7,7 +7,9 @@
...
@@ -7,7 +7,9 @@
?>
?>
<?php
/** @var $block \Magento\Checkout\Block\Cart\Shipping */
?>
<?php
/** @var $block \Magento\Checkout\Block\Cart\Shipping */
?>
<?php
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?php
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?php
$selectedCountryId
=
$block
->
getCountryId
();
?>
<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;"
>
<form
method=
"post"
id=
"shipping-zip-form"
>
<form
method=
"post"
id=
"shipping-zip-form"
>
...
@@ -41,5 +43,10 @@
...
@@ -41,5 +43,10 @@
script;
script;
?>
?>
<?=
/* @noEscape */
$secureRenderer
->
renderTag
(
'script'
,
[],
$scriptString
,
false
)
?>
<?=
/* @noEscape */
$secureRenderer
->
renderTag
(
'script'
,
[],
$scriptString
,
false
)
?>
<script>
require
([
'jquery'
],
function
(
$
)
{
$
(
'#shipping_country_id'
).
val
(
'
<?=
$selectedCountryId
?>
'
);
});
</script>
</div>
</div>
</div>
</div>
app/code/Magento/Checkout/view/frontend/web/js/view/address-get.js
View file @
127897d1
...
@@ -18,6 +18,7 @@ define([
...
@@ -18,6 +18,7 @@ define([
this
.
_super
();
this
.
_super
();
var
address
=
{};
var
address
=
{};
address
.
countryId
=
window
.
checkoutConfig
.
defaultCountryId
;
address
.
countryId
=
window
.
checkoutConfig
.
defaultCountryId
;
address
.
postcode
=
window
.
checkoutConfig
.
postcode
;
getAddress
.
getRates
(
address
);
getAddress
.
getRates
(
address
);
}
}
...
...
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