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
61bab73c
Commit
61bab73c
authored
Mar 17, 2023
by
dhn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
撤回购物车优化
parent
e3707988
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
65 deletions
+92
-65
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
+29
-17
app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
+0
-10
app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-processor/get-address.js
+1
-6
app/code/Magento/Checkout/view/frontend/web/js/view/shipping-get.js
+57
-5
app/code/Magento/Checkout/view/frontend/web/js/view/summary/shipping.js
+2
-24
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
+2
-2
No files found.
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
View file @
61bab73c
...
...
@@ -7,23 +7,35 @@
?>
<?php
/** @var $block \Magento\Checkout\Block\Cart\Shipping */
?>
<?php
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<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>
</fieldset>
</form>
<?php
$serializedCheckoutConfig
=
/* @noEscape */
$block
->
getSerializedCheckoutConfig
();
<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>
<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>
<?php
$serializedCheckoutConfig
=
/* @noEscape */
$block
->
getSerializedCheckoutConfig
();
$scriptString
=
<<<script
$scriptString
=
<<<script
window.checkoutConfig = {$serializedCheckoutConfig};
window.customerData = window.checkoutConfig.customerData;
...
...
@@ -38,7 +50,7 @@ $scriptString = <<<script
return url.setBaseUrl('{$block->escapeJs($block->escapeUrl($block->getBaseUrl()))}');
})
script;
?>
?>
<?=
/* @noEscape */
$secureRenderer
->
renderTag
(
'script'
,
[],
$scriptString
,
false
)
?>
</div>
</div>
app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
View file @
61bab73c
...
...
@@ -29,7 +29,6 @@ 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
,
...
...
@@ -44,7 +43,6 @@ define([
totals
:
totals
,
shippingAddress
:
shippingAddress
,
shippingMethod
:
shippingMethod
,
shippingSaveMethod
:
shippingSaveMethod
,
billingAddress
:
billingAddress
,
paymentMethod
:
paymentMethod
,
paymentMethodlist
:
paymentMethodlist
,
...
...
@@ -115,20 +113,12 @@ 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/model/shipping-rate-processor/get-address.js
View file @
61bab73c
...
...
@@ -57,13 +57,8 @@ define([
{
quote
.
setShippingSaveMethod
(
result
[
1
]);
}
selectShippingAddress
(
addressConverter
.
formAddressDataToQuoteAddress
(
address
));
//
selectShippingAddress(addressConverter.formAddressDataToQuoteAddress(address));
//shippingService.setShippingRates(new_sh);
}).
fail
(
function
(
response
)
{
shippingService
.
setShippingRates
([]);
errorProcessor
.
process
(
response
);
}).
always
(
function
()
{
shippingService
.
isLoading
(
false
);
});
}
};
...
...
app/code/Magento/Checkout/view/frontend/web/js/view/shipping-get.js
View file @
61bab73c
...
...
@@ -2,12 +2,26 @@ define([
'uiComponent'
,
'uiRegistry'
,
'underscore'
,
'Magento_Checkout/js/model/shipping-rate-processor/get-address'
'Magento_Checkout/js/model/quote'
,
'Magento_Checkout/js/action/select-billing-address'
,
'Magento_Checkout/js/model/payment-service'
,
'Magento_Checkout/js/model/totals'
,
'Magento_Checkout/js/action/set-shipping-information'
,
'Magento_Checkout/js/model/shipping-service'
,
'Magento_Customer/js/model/customer'
,
'Magento_Checkout/js/model/update-item-service'
],
function
(
Component
,
registry
,
_
,
getAddress
quote
,
selectBillingAddress
,
paymentService
,
totalsService
,
setShippingInformationAction
,
shippingService
,
customer
,
updateItemService
)
{
'use strict'
;
...
...
@@ -16,10 +30,48 @@ define([
/** @inheritdoc */
initialize
:
function
()
{
this
.
_super
();
var
address
=
{};
address
.
countryId
=
window
.
checkoutConfig
.
defaultCountryId
;
getAddress
.
getRates
(
address
);
var
self
=
this
;
quote
.
shippingMethod
.
subscribe
(
function
(
method
)
{
if
(
method
&&
!
updateItemService
.
hasUpdateResult
())
{
var
shippingRates
=
shippingService
.
getShippingRates
();
var
availableRate
=
_
.
find
(
shippingRates
(),
function
(
rate
)
{
if
(
rate
[
'method_code'
]
===
null
&&
method
[
'method_code'
]
===
null
)
{
return
false
;
}
return
rate
[
'carrier_code'
]
+
'_'
+
rate
[
'method_code'
]
===
method
[
'carrier_code'
]
+
'_'
+
method
[
'method_code'
];
});
if
(
availableRate
)
{
if
(
self
.
_isAddressSameAsShipping
())
{
selectBillingAddress
(
quote
.
shippingAddress
());
}
paymentService
.
isLoading
(
true
);
totalsService
.
isLoading
(
true
);
setShippingInformationAction
().
done
(
function
()
{
paymentService
.
isLoading
(
false
);
totalsService
.
isLoading
(
false
);
}
);
}
}
},
this
);
if
(
!
customer
.
isLoggedIn
())
{
quote
.
shippingAddress
.
subscribe
(
function
(
address
)
{
if
(
_
.
isUndefined
(
address
.
street
)
||
address
.
street
.
length
==
0
)
{
address
.
street
=
[
""
,
""
];
}
},
this
);
}
},
/**
* @returns {*}
*/
_isAddressSameAsShipping
:
function
()
{
return
true
;
//return registry.get('checkout.steps.billing-step.payment.payments-list.billing-address-form-shared').isAddressSameAsShipping();
}
});
});
app/code/Magento/Checkout/view/frontend/web/js/view/summary/shipping.js
View file @
61bab73c
...
...
@@ -29,21 +29,6 @@ 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
))
{
...
...
@@ -93,10 +78,7 @@ define([
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
if
(
quote
.
shippingSaveMethod
())
{
return
this
.
getFormattedPrice
(
quote
.
shippingSaveMethod
()[
'amount'
]);
}
return
this
.
getFormattedPrice
(
6.99
);
}
return
this
.
getFormattedPrice
(
price
);
},
...
...
@@ -109,11 +91,7 @@ define([
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
if
(
quote
.
shippingSaveMethod
())
{
return
'-'
+
this
.
getFormattedPrice
(
quote
.
shippingSaveMethod
()[
'amount'
]);
}
return
0
;
return
'-'
+
this
.
getFormattedPrice
(
6.99
);
}
},
...
...
app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/shipping.js
View file @
61bab73c
...
...
@@ -51,7 +51,7 @@ define([
},
isSaveShowed
:
function
()
{
var
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
!=
0
)
if
(
price
)
{
return
false
;
}
...
...
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
View file @
61bab73c
...
...
@@ -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">
...
...
@@ -53,6 +53,6 @@
</argument>
</arguments>
</referenceBlock>
-->
</body>
</page>
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