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
21209fab
Commit
21209fab
authored
Mar 17, 2023
by
dhn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化购物车2
parent
61bab73c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
31 deletions
+81
-31
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
+14
-25
app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
+10
-0
app/code/Magento/Checkout/view/frontend/web/js/view/address-get.js
+25
-0
app/code/Magento/Checkout/view/frontend/web/js/view/summary/shipping.js
+24
-2
app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/shipping.js
+1
-1
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
+3
-3
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_index_index.xml
+4
-0
No files found.
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
View file @
21209fab
...
...
@@ -7,32 +7,21 @@
?>
<?php
/** @var $block \Magento\Checkout\Block\Cart\Shipping */
?>
<?php
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<div
id=
"block-shipping"
class=
"block shipping"
data-mage-init=
'{"collapsible":{"openedState": "active", "saveState": true}}'
>
<div
class=
"title"
data-role=
"title"
>
<strong
id=
"block-shipping-heading"
role=
"heading"
aria-level=
"2"
>
<?=
$block
->
getQuote
()
->
isVirtual
()
?
$block
->
escapeHtml
(
__
(
'Estimate Tax'
))
:
$block
->
escapeHtml
(
__
(
'Estimate Shipping and Tax'
))
?>
</strong>
<div
id=
"block-shipping"
class=
"block shipping"
>
<div
id=
"block-summary"
style=
"display: none;"
>
<form
method=
"post"
id=
"shipping-zip-form"
>
<fieldset
class=
"fieldset estimate"
>
<div
class=
"field"
name=
"shippingAddress.country_id"
>
<label
class=
"label"
for=
"shipping_country_id"
>
<span>
<?=
__
(
'Country'
)
?>
</span>
</label>
<div
class=
"control"
>
<?=
$block
->
getCountryHtmlSelect
(
null
,
'country_id'
,
'shipping_country_id'
)
?>
</div>
</div>
<div
id=
"block-summary"
data-bind=
"scope:'block-summary'"
class=
"content"
data-role=
"content"
aria-labelledby=
"block-shipping-heading"
>
<!-- ko template: getTemplate() --><!-- /ko -->
<script
type=
"text/x-magento-init"
>
{
"#block-summary"
:
{
"Magento_Ui/js/core/app"
:
<?=
/* @noEscape */
$block
->
getJsLayout
()
?>
}
}
</script>
</fieldset>
</form>
<?php
$serializedCheckoutConfig
=
/* @noEscape */
$block
->
getSerializedCheckoutConfig
();
$scriptString
=
<<<script
...
...
app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
View file @
21209fab
...
...
@@ -29,6 +29,7 @@ define([
billingAddress
=
ko
.
observable
(
null
),
shippingAddress
=
ko
.
observable
(
null
),
shippingMethod
=
ko
.
observable
(
null
),
shippingSaveMethod
=
ko
.
observable
(
null
),
paymentMethod
=
ko
.
observable
(
null
),
paymentMethodlist
=
ko
.
observable
(
null
),
quoteData
=
window
.
checkoutConfig
.
quoteData
,
...
...
@@ -43,6 +44,7 @@ define([
totals
:
totals
,
shippingAddress
:
shippingAddress
,
shippingMethod
:
shippingMethod
,
shippingSaveMethod
:
shippingSaveMethod
,
billingAddress
:
billingAddress
,
paymentMethod
:
paymentMethod
,
paymentMethodlist
:
paymentMethodlist
,
...
...
@@ -113,12 +115,20 @@ define([
getPaymentMethod
:
function
()
{
return
paymentMethod
;
},
setShippingSaveMethod
:
function
(
Method
)
{
shippingSaveMethod
(
Method
);
},
getShippingSaveMethod
:
function
()
{
return
shippingSaveMethod
;
},
setPaymentMethodList
:
function
(
MethodList
)
{
paymentMethodlist
(
MethodList
);
},
getPaymentMethodList
:
function
()
{
return
paymentMethodlist
;
},
/**
* @return {*}
*/
...
...
app/code/Magento/Checkout/view/frontend/web/js/view/address-get.js
0 → 100644
View file @
21209fab
define
([
'uiComponent'
,
'uiRegistry'
,
'underscore'
,
'Magento_Checkout/js/model/shipping-rate-processor/get-address'
],
function
(
Component
,
registry
,
_
,
getAddress
)
{
'use strict'
;
return
Component
.
extend
({
/** @inheritdoc */
initialize
:
function
()
{
this
.
_super
();
var
address
=
{};
address
.
countryId
=
window
.
checkoutConfig
.
defaultCountryId
;
getAddress
.
getRates
(
address
);
}
});
});
app/code/Magento/Checkout/view/frontend/web/js/view/summary/shipping.js
View file @
21209fab
...
...
@@ -29,6 +29,21 @@ define([
if
(
!
this
.
isCalculated
())
{
return
''
;
}
var
price
;
if
(
!
this
.
isCalculated
())
{
return
this
.
notCalculatedMessage
;
}
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
if
(
quote
.
shippingSaveMethod
())
{
return
quote
.
shippingSaveMethod
()[
'method_title'
];
}
}
shippingMethod
=
quote
.
shippingMethod
();
if
(
!
_
.
isArray
(
shippingMethod
)
&&
!
_
.
isObject
(
shippingMethod
))
{
...
...
@@ -78,7 +93,10 @@ define([
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
return
this
.
getFormattedPrice
(
6.99
);
if
(
quote
.
shippingSaveMethod
())
{
return
this
.
getFormattedPrice
(
quote
.
shippingSaveMethod
()[
'amount'
]);
}
}
return
this
.
getFormattedPrice
(
price
);
},
...
...
@@ -91,7 +109,11 @@ define([
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
return
'-'
+
this
.
getFormattedPrice
(
6.99
);
if
(
quote
.
shippingSaveMethod
())
{
return
'-'
+
this
.
getFormattedPrice
(
quote
.
shippingSaveMethod
()[
'amount'
]);
}
return
0
;
}
},
...
...
app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/shipping.js
View file @
21209fab
...
...
@@ -51,7 +51,7 @@ define([
},
isSaveShowed
:
function
()
{
var
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
)
if
(
price
!=
0
)
{
return
false
;
}
...
...
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
View file @
21209fab
...
...
@@ -37,7 +37,7 @@
<referenceContainer
name=
"content"
>
<block
class=
"Magento\Framework\View\Element\Template"
name=
"checkout.cart.footer"
template=
"Magento_Checkout::footer.phtml"
/>
</referenceContainer>
<!--
<referenceBlock
name=
"checkout.cart.totals"
>
<arguments>
<argument
name=
"jsLayout"
xsi:type=
"array"
>
...
...
@@ -45,7 +45,7 @@
<item
name=
"block-totals"
xsi:type=
"array"
>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"shpping-get"
xsi:type=
"array"
>
<item name="component" xsi:type="string">Magento_Checkout/js/view/
shipping
-get</item>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/
address
-get
</item>
</item>
</item>
</item>
...
...
@@ -53,6 +53,6 @@
</argument>
</arguments>
</referenceBlock>
-->
</body>
</page>
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_index_index.xml
View file @
21209fab
...
...
@@ -67,6 +67,10 @@
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/security
</item>
<item
name=
"displayArea"
xsi:type=
"string"
>
security
</item>
</item>
<item
name=
"addressGet"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/address-get
</item>
<item
name=
"displayArea"
xsi:type=
"string"
>
addressGet
</item>
</item>
</item>
</item>
</item>
...
...
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