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
2830d097
Commit
2830d097
authored
Sep 16, 2022
by
王东红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车页面优化
parent
f094911a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
304 additions
and
1 deletions
+304
-1
app/code/JTool/LimitRelatedCrossUpsell/Block/Cart/Crosssell.php
+45
-0
app/code/JTool/LimitRelatedCrossUpsell/etc/di.xml
+5
-0
app/code/JTool/LimitRelatedCrossUpsell/etc/module.xml
+10
-0
app/code/JTool/LimitRelatedCrossUpsell/registration.php
+7
-0
app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml
+0
-1
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
+215
-0
app/design/frontend/Joshine/breeze/web/css/_custom.less
+22
-0
No files found.
app/code/JTool/LimitRelatedCrossUpsell/Block/Cart/Crosssell.php
0 → 100644
View file @
2830d097
<?php
namespace
JTool\LimitRelatedCrossUpsell\Block\Cart
;
class
Crosssell
extends
\Magento\Checkout\Block\Cart\Crosssell
{
/**
* We can now set our limit here
*/
const
CROSSSELL_LIMIT
=
20
;
/**
* Crosssell constructor.
* @param \Magento\Catalog\Block\Product\Context $context
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Catalog\Model\Product\Visibility $productVisibility
* @param \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory
* @param \Magento\Quote\Model\Quote\Item\RelatedProducts $itemRelationsList
* @param \Magento\CatalogInventory\Helper\Stock $stockHelper
* @param array $data
*/
public
function
__construct
(
\Magento\Catalog\Block\Product\Context
$context
,
\Magento\Checkout\Model\Session
$checkoutSession
,
\Magento\Catalog\Model\Product\Visibility
$productVisibility
,
\Magento\Catalog\Model\Product\LinkFactory
$productLinkFactory
,
\Magento\Quote\Model\Quote\Item\RelatedProducts
$itemRelationsList
,
\Magento\CatalogInventory\Helper\Stock
$stockHelper
,
array
$data
=
[]
)
{
parent
::
__construct
(
$context
,
$checkoutSession
,
$productVisibility
,
$productLinkFactory
,
$itemRelationsList
,
$stockHelper
,
$data
);
$this
->
_maxItemCount
=
self
::
CROSSSELL_LIMIT
;
//limit number of products
}
}
\ No newline at end of file
app/code/JTool/LimitRelatedCrossUpsell/etc/di.xml
0 → 100644
View file @
2830d097
<?xml version="1.0" encoding="UTF-8" ?>
<config
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:ObjectManager/etc/config.xsd"
>
<preference
for=
"Magento\Checkout\Block\Cart\Crosssell"
type=
"JTool\LimitRelatedCrossUpsell\Block\Cart\Crosssell"
></preference>
</config>
\ No newline at end of file
app/code/JTool/LimitRelatedCrossUpsell/etc/module.xml
0 → 100644
View file @
2830d097
<?xml version="1.0"?>
<config
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:Module/etc/module.xsd"
>
<module
name=
"JTool_LimitRelatedCrossUpsell"
setup_version=
"1.0.0"
>
<sequence>
<module
name=
"Magento_Checkout"
></module>
<module
name=
"Magento_Catalog"
></module>
</sequence>
</module>
</config>
\ No newline at end of file
app/code/JTool/LimitRelatedCrossUpsell/registration.php
0 → 100644
View file @
2830d097
<?php
\Magento\Framework\Component\ComponentRegistrar
::
register
(
\Magento\Framework\Component\ComponentRegistrar
::
MODULE
,
'JTool_LimitRelatedCrossUpsell'
,
__DIR__
);
\ No newline at end of file
app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml
View file @
2830d097
...
...
@@ -8,7 +8,6 @@
<page
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
layout=
"1column"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<update
handle=
"checkout_cart_item_renderers"
/>
<body>
<referenceBlock
name=
"page.main.title"
remove=
"true"
/>
<referenceContainer
name=
"page.messages"
>
<block
class=
"Magento\Checkout\Block\Cart\ValidationMessages"
name=
"checkout.cart.validationmessages"
/>
</referenceContainer>
...
...
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
0 → 100644
View file @
2830d097
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
layout=
"1column"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<update
handle=
"checkout_cart_item_renderers"
/>
<body>
<referenceBlock
name=
"page.main.title"
remove=
"true"
/>
<referenceBlock
name=
"checkout.cart.addtocart"
remove=
"true"
/>
<referenceContainer
name=
"page.messages"
>
<block
class=
"Magento\Checkout\Block\Cart\ValidationMessages"
name=
"checkout.cart.validationmessages"
/>
</referenceContainer>
<referenceContainer
name=
"content"
>
<block
class=
"Magento\Checkout\Block\Cart"
name=
"checkout.cart"
template=
"Magento_Checkout::cart.phtml"
cacheable=
"false"
>
<container
name=
"checkout.cart.items"
as=
"with-items"
>
<container
name=
"checkout.cart.container"
htmlTag=
"div"
htmlClass=
"cart-container"
before=
"-"
>
<container
name=
"checkout.cart.form.before"
as=
"form_before"
label=
"Shopping Cart Items Before"
htmlTag=
"div"
htmlClass=
"rewards"
/>
<container
name=
"cart.summary"
label=
"Cart Summary Container"
htmlTag=
"div"
htmlClass=
"cart-summary"
after=
"-"
>
<block
class=
"Magento\Framework\View\Element\Template"
name=
"checkout.cart.summary.title"
before=
"-"
template=
"Magento_Theme::text.phtml"
>
<arguments>
<argument
translate=
"true"
name=
"text"
xsi:type=
"string"
>
Summary
</argument>
<argument
name=
"tag"
xsi:type=
"string"
>
strong
</argument>
<argument
name=
"css_class"
xsi:type=
"string"
>
summary title
</argument>
</arguments>
</block>
<block
class=
"Magento\Checkout\Block\Cart\Shipping"
name=
"checkout.cart.shipping"
as=
"shipping"
template=
"Magento_Checkout::cart/shipping.phtml"
after=
"checkout.cart.summary.title"
>
<arguments>
<argument
name=
"jsLayout"
xsi:type=
"array"
>
<item
name=
"types"
xsi:type=
"array"
>
<item
name=
"form.input"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Ui/js/form/element/abstract
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"provider"
xsi:type=
"string"
>
checkoutProvider
</item>
<item
name=
"deps"
xsi:type=
"array"
>
<item
name=
"0"
xsi:type=
"string"
>
checkoutProvider
</item>
</item>
<item
name=
"template"
xsi:type=
"string"
>
ui/form/field
</item>
<item
name=
"elementTmpl"
xsi:type=
"string"
>
ui/form/element/input
</item>
</item>
</item>
</item>
<item
name=
"components"
xsi:type=
"array"
>
<item
name=
"summary-block-config"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
uiComponent
</item>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"shipping-rates-validation"
xsi:type=
"array"
>
<item
name=
"children"
xsi:type=
"array"
>
<!--Step configuration components-->
</item>
</item>
</item>
</item>
<item
name=
"block-summary"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
uiComponent
</item>
<item
name=
"deps"
xsi:type=
"array"
>
<item
name=
"0"
xsi:type=
"string"
>
summary-block-config
</item>
</item>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"block-rates"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/cart/shipping-rates
</item>
<item
name=
"sortOrder"
xsi:type=
"string"
>
2
</item>
</item>
<item
name=
"block-shipping"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/cart/shipping-estimation
</item>
<item
name=
"provider"
xsi:type=
"string"
>
checkoutProvider
</item>
<item
name=
"sortOrder"
xsi:type=
"string"
>
1
</item>
<item
name=
"deps"
xsi:type=
"array"
>
<item
name=
"0"
xsi:type=
"string"
>
block-summary.block-shipping.address-fieldsets
</item>
</item>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"address-fieldsets"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
uiComponent
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"deps"
xsi:type=
"array"
>
<item
name=
"0"
xsi:type=
"string"
>
checkoutProvider
</item>
</item>
</item>
<item
name=
"displayArea"
xsi:type=
"string"
>
address-fieldsets
</item>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"city"
xsi:type=
"array"
>
<item
name=
"sortOrder"
xsi:type=
"string"
>
115
</item>
<item
name=
"dataScope"
xsi:type=
"string"
>
shippingAddress.city
</item>
<item
name=
"provider"
xsi:type=
"string"
>
checkoutProvider
</item>
</item>
<item
name=
"country_id"
xsi:type=
"array"
>
<item
name=
"sortOrder"
xsi:type=
"string"
>
110
</item>
<item
name=
"dataScope"
xsi:type=
"string"
>
shippingAddress.country_id
</item>
<item
name=
"provider"
xsi:type=
"string"
>
checkoutProvider
</item>
</item>
<item
name=
"region_id"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Ui/js/form/element/region
</item>
<item
name=
"sortOrder"
xsi:type=
"string"
>
112
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"template"
xsi:type=
"string"
>
ui/form/field
</item>
<item
name=
"elementTmpl"
xsi:type=
"string"
>
ui/form/element/select
</item>
<item
name=
"customEntry"
xsi:type=
"string"
>
shippingAddress.region
</item>
</item>
<!-- Value of region_id field is filtered by the value of county_id attribute -->
<item
name=
"filterBy"
xsi:type=
"array"
>
<item
name=
"target"
xsi:type=
"string"
>
<![CDATA[${ $.provider }:${ $.parentScope }.country_id]]>
</item>
<item
name=
"field"
xsi:type=
"string"
>
country_id
</item>
</item>
</item>
<!-- The following items override configuration of corresponding address attributes -->
<item
name=
"region"
xsi:type=
"array"
>
<!-- Make region attribute invisible on frontend. Corresponding input element is created by region_id field -->
<item
name=
"visible"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Ui/js/form/element/abstract
</item>
<item
name=
"sortOrder"
xsi:type=
"string"
>
111
</item>
<item
name=
"dataScope"
xsi:type=
"string"
>
shippingAddress.region
</item>
</item>
<item
name=
"postcode"
xsi:type=
"array"
>
<!-- post-code field has custom UI component -->
<item
name=
"component"
xsi:type=
"string"
>
Magento_Ui/js/form/element/abstract
</item>
<item
name=
"dataScope"
xsi:type=
"string"
>
shippingAddress.postcode
</item>
<item
name=
"sortOrder"
xsi:type=
"string"
>
114
</item>
<item
name=
"provider"
xsi:type=
"string"
>
checkoutProvider
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
<item
name=
"checkoutProvider"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
uiComponent
</item>
</item>
</item>
</argument>
</arguments>
</block>
<container
name=
"checkout.cart.totals.container"
as=
"totals"
label=
"Shopping Cart Totals"
>
<block
class=
"Magento\Checkout\Block\Cart\Totals"
name=
"checkout.cart.totals"
template=
"Magento_Checkout::cart/totals.phtml"
>
<arguments>
<argument
name=
"jsLayout"
xsi:type=
"array"
>
<item
name=
"components"
xsi:type=
"array"
>
<item
name=
"block-totals"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/cart/totals
</item>
<item
name=
"displayArea"
xsi:type=
"string"
>
totals
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"template"
xsi:type=
"string"
>
Magento_Checkout/cart/totals
</item>
</item>
<item
name=
"children"
xsi:type=
"array"
>
<!-- sort order for this totals is configured on admin panel-->
<!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order -->
<item
name=
"subtotal"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/summary/subtotal
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"title"
xsi:type=
"string"
translate=
"true"
>
Subtotal
</item>
<item
name=
"template"
xsi:type=
"string"
>
Magento_Checkout/cart/totals/subtotal
</item>
</item>
</item>
<item
name=
"shipping"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/cart/totals/shipping
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"title"
xsi:type=
"string"
translate=
"true"
>
Shipping
</item>
<item
name=
"template"
xsi:type=
"string"
>
Magento_Checkout/cart/totals/shipping
</item>
</item>
</item>
<item
name=
"grand-total"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/summary/grand-total
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"title"
xsi:type=
"string"
translate=
"true"
>
Order Total
</item>
<item
name=
"template"
xsi:type=
"string"
>
Magento_Checkout/cart/totals/grand-total
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
<block
class=
"Magento\Checkout\Block\Cart\Coupon"
name=
"checkout.cart.coupon"
as=
"coupon"
template=
"Magento_Checkout::cart/coupon.phtml"
/>
<block
class=
"Magento\Checkout\Block\Cart"
name=
"checkout.cart.methods.bottom"
template=
"Magento_Checkout::cart/methods.phtml"
>
<container
name=
"checkout.cart.methods"
as=
"methods"
label=
"Payment Methods After Checkout Button"
>
<block
class=
"Magento\Checkout\Block\Onepage\Link"
name=
"checkout.cart.methods.onepage.bottom"
template=
"Magento_Checkout::onepage/link.phtml"
/>
<block
class=
"Magento\Checkout\Block\QuoteShortcutButtons"
name=
"checkout.cart.shortcut.buttons"
/>
</container>
</block>
</container>
<block
class=
"Magento\Checkout\Block\Cart\Grid"
name=
"checkout.cart.form"
as=
"cart-items"
template=
"Magento_Checkout::cart/form.phtml"
after=
"cart.summary"
>
<arguments>
<argument
name=
"view_model"
xsi:type=
"object"
>
Magento\Checkout\ViewModel\Cart
</argument>
</arguments>
<block
class=
"Magento\Framework\View\Element\RendererList"
name=
"checkout.cart.item.renderers"
as=
"renderer.list"
/>
<block
class=
"Magento\Framework\View\Element\Text\ListText"
name=
"checkout.cart.order.actions"
/>
</block>
<container
name=
"checkout.cart.widget"
as=
"checkout_cart_widget"
label=
"Shopping Cart Items After"
after=
"cart-items"
/>
</container>
<block
class=
"Magento\Checkout\Block\Cart\Crosssell"
name=
"checkout.cart.crosssell"
template=
"Magento_Catalog::product/list/items.phtml"
after=
"-"
ifconfig=
"checkout/cart/crosssell_enabled"
>
<arguments>
<argument
name=
"type"
xsi:type=
"string"
>
crosssell
</argument>
<argument
name=
"view_model"
xsi:type=
"object"
>
Magento\Catalog\ViewModel\Product\Listing\PreparePostData
</argument>
</arguments>
<block
class=
"Magento\Catalog\Block\Product\ProductList\Item\Container"
name=
"crosssell.product.addto"
as=
"addto"
>
<block
class=
"Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
name=
"crosssell.product.addto.compare"
as=
"compare"
template=
"Magento_Catalog::product/list/addto/compare.phtml"
/>
</block>
</block>
</container>
<container
name=
"checkout.cart.noitems"
as=
"no-items"
>
<block
class=
"Magento\Checkout\Block\Cart"
name=
"checkout.cart.empty"
before=
"-"
template=
"Magento_Checkout::cart/noItems.phtml"
>
<container
name=
"checkout.cart.empty.widget"
as=
"checkout_cart_empty_widget"
label=
"Empty Shopping Cart Content Before"
/>
</block>
</container>
</block>
</referenceContainer>
<block
class=
"Magento\Checkout\Block\Cart\Additional\Info"
name=
"additional.product.info"
template=
"Magento_Checkout::cart/additional/info.phtml"
/>
</body>
</page>
app/design/frontend/Joshine/breeze/web/css/_custom.less
View file @
2830d097
...
...
@@ -775,4 +775,25 @@ p.shopbycate-title {
border-bottom: 2px solid #ccc;
padding-bottom: 10px;
}
table tr.item-actions{
border-bottom: 1px dashed #e5e5e5;
}
}
.price_wish{
display: flex;
justify-content: space-between;
align-content: center;
align-items: flex-end;
}
.checkout-cart-index .column.main .block.crosssell .title{
font-size: 20px;
color: #222222;
line-height: 1.35;
text-align: center;
letter-spacing: -1.5px;
font-weight: 500;
margin-bottom: 20px;
text-transform:uppercase;
background:none;
}
\ No newline at end of file
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