Skip to content

Commit d0eca97

Browse files
author
Stanislav Idolov
authored
ENGCOM-2205: Make it possible to disable cross-sell on cart page #16569
2 parents 6827d2b + 44bfc8b commit d0eca97

File tree

14 files changed

+294
-5
lines changed

14 files changed

+294
-5
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
<!--Create Store view -->
3636
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
37+
<waitForElementVisible selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="waitForStoreViewBtn"/>
3738
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
3839
<waitForPageLoad stepKey="waitForProductPageLoad"/>
3940
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>

app/code/Magento/Checkout/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
<field id="number_items_to_display_pager" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
4242
<label>Number of Items to Display Pager</label>
4343
</field>
44+
<field id="crosssell_enabled" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
45+
<label>Show Cross-sell Items in the Shopping Cart</label>
46+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
47+
</field>
4448
</group>
4549
<group id="cart_link" translate="label" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0">
4650
<label>My Cart Link</label>

app/code/Magento/Checkout/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<delete_quote_after>30</delete_quote_after>
1818
<redirect_to_cart>0</redirect_to_cart>
1919
<number_items_to_display_pager>20</number_items_to_display_pager>
20+
<crosssell_enabled>1</crosssell_enabled>
2021
</cart>
2122
<cart_link>
2223
<use_qty>1</use_qty>

app/code/Magento/Checkout/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,4 @@ Payment,Payment
181181
"Item in Cart","Item in Cart"
182182
"Items in Cart","Items in Cart"
183183
"Close","Close"
184+
"Show Cross-sell Items in the Shopping Cart","Show Cross-sell Items in the Shopping Cart"

app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
</block>
187187
<container name="checkout.cart.widget" as="checkout_cart_widget" label="Shopping Cart Items After"/>
188188
</container>
189-
<block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-">
189+
<block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-" ifconfig="checkout/cart/crosssell_enabled">
190190
<arguments>
191191
<argument name="type" xsi:type="string">crosssell</argument>
192192
</arguments>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="SetTaxClassForShipping">
12+
<amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
<conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="expandTaxClassesTab"/>
15+
<waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass"/>
16+
<uncheckOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="uncheckUseSystemValue"/>
17+
<selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="Taxable Goods" stepKey="setShippingTaxClass"/>
18+
<click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/>
19+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" />
20+
</actionGroup>
21+
<actionGroup name="ResetTaxClassForShipping">
22+
<amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxConfigPagetoReset"/>
23+
<waitForPageLoad stepKey="waitForPageLoad2"/>
24+
<conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="openTaxClassTab"/>
25+
<waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass2"/>
26+
<selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="None" stepKey="resetShippingTaxClass"/>
27+
<checkOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="useSystemValue"/>
28+
<click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/>
29+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
30+
</actionGroup>
31+
</actionGroups>

app/code/Magento/Config/Test/Mftf/Page/AdminConfigPage.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212
<page name="AdminContentManagementPage" url="admin/system_config/edit/section/cms/" area="admin" module="Magento_Config">
1313
<section name="ContentManagementSection"/>
1414
</page>
15+
<page name="AdminSalesTaxClassPage" url="admin/system_config/edit/section/tax/" area="admin" module="Magento_Config">
16+
<section name="SalesTaxClassSection"/>
17+
</page>
1518
</pages>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="SalesConfigSection">
12+
<element name="TaxClassesTab" type="button" selector="#tax_classes-head"/>
13+
<element name="CheckIfTaxClassesTabExpand" type="button" selector="#tax_classes-head:not(.open)"/>
14+
<element name="ShippingTaxClass" type="select" selector="#tax_classes_shipping_tax_class"/>
15+
<element name="EnableTaxClassForShipping" type="checkbox" selector="#tax_classes_shipping_tax_class_inherit"/>
16+
</section>
17+
</sections>

app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<system>
1010
<section id="checkout">
1111
<group id="cart">
12-
<field id="configurable_product_image" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
12+
<field id="configurable_product_image" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
1313
<label>Configurable Product Image</label>
1414
<source_model>Magento\Catalog\Model\Config\Source\Product\Thumbnail</source_model>
1515
</field>

app/code/Magento/GroupedProduct/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<system>
1010
<section id="checkout" translate="label" type="text" sortOrder="305" showInDefault="1" showInWebsite="1" showInStore="1">
1111
<group id="cart" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
12-
<field id="grouped_product_image" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
12+
<field id="grouped_product_image" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
1313
<label>Grouped Product Image</label>
1414
<source_model>Magento\Catalog\Model\Config\Source\Product\Thumbnail</source_model>
1515
</field>

0 commit comments

Comments
 (0)