Commit 2830d097 by 王东红

购物车页面优化

parent f094911a
<?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
<?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
<?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
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'JTool_LimitRelatedCrossUpsell',
__DIR__
);
\ No newline at end of file
......@@ -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>
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment