-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Added configuration to enable/disable Clear Shopping Cart action in storefront #28594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
magento-engcom-team
merged 34 commits into
magento:2.4-develop
from
joctabio:108_clear-shopping-cart-button-configuration
Jul 29, 2020
Merged
Changes from 17 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
0ee9280
Created config used for showing/hiding clear cart button on the shopp…
Neos2007 077a2a5
config-clear-cart-action: Added translation for clear shopping cart b…
Neos2007 4cf999c
magento/partners-magento2b2b#108: Clear Shopping Cart - Added admin c…
53a22be
magento/magento2#108: Clear Shopping Cart - Implemented Clear Shoppin…
6d31101
Merge branch '108_clear-shopping-cart-button-configuration' of github…
70e3c15
magento/magento2#108: Clear Shopping Cart - Refactor doc for enable_c…
05470d0
magento/magento2#108: Clear Shopping Cart - Remove unnecessary empty …
e1fa935
magento/magento2#108: Clear Shopping Cart - Restore removed composer.…
2c4ee78
Merge branch 'pull-27917' into 108_clear-shopping-cart-button-configu…
7dad27c
magento/magento2#108: Clear Shopping Cart - Refactor to fix Static Te…
c1ba0e0
magento/magento2#108: Clear Shopping Cart - Refactor to fix expected …
0051ec9
magento/magento2#108: Clear Shopping Cart - Refactor _clearCartConfir…
e9c6dd1
magento/magento2#108: Clear Shopping Cart - Add RWD styling to cart a…
d57ff13
magento/magento2#108: Clear Shopping Cart - Refactor PHPdoc to fix Co…
ee29f5f
magento/magento2#108: Clear Shopping Cart - Added admin configuration…
888a9f3
magento/magento2#108: Clear Shopping Cart - Refactor initial changes …
b960859
magento/magento2#108: Clear Shopping Cart - Added file header copyright
e5724ef
Merge branch '2.4-develop' into 108_clear-shopping-cart-button-config…
danmooney2 e8a36e7
magento/magento2#108: Clear Shopping Cart - Refactor MFTF to include …
3a097b2
Merge branch '108_clear-shopping-cart-button-configuration' of github…
d8eeb97
magento/magento2#108: Clear Shopping Cart - Refactor MFTF to include …
c8c9b9b
Merge branch '2.4-develop' into 108_clear-shopping-cart-button-config…
danmooney2 35a469b
magento/magento2#108: Clear Shopping Cart - Updated MFTF for code rev…
09d6b10
Merge branch '108_clear-shopping-cart-button-configuration' of github…
adfea2a
magento/magento2#108: Clear Shopping Cart - Updated config scope to w…
b65a287
magento/magento2#108: Clear Shopping Cart - Added integration test fo…
2f55801
Merge branch '2.4-develop' into 108_clear-shopping-cart-button-config…
joanhe 418c6e8
magento/magento2#108: Clear Shopping Cart - Refactor MFTF and PHP fil…
c5056cd
Merge branch '108_clear-shopping-cart-button-configuration' of github…
f6574e4
magento/magento2#108: Clear Shopping Cart - Refactor integration test…
893ac50
Merge branch '2.4-develop' into 108_clear-shopping-cart-button-config…
joctabio c08f84b
Merge branch '2.4-develop' into 108_clear-shopping-cart-button-config…
joanhe d7abed9
magento/magento2#108: Clear Shopping Cart - Update translation file f…
05e1e77
Merge branch '108_clear-shopping-cart-button-configuration' of github…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...gento/Checkout/Test/Mftf/ActionGroup/AdminCheckoutClearShoppingCartEnabledActionGroup.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminCheckoutClearShoppingCartEnabledActionGroup"> | ||
<annotations> | ||
<description>Enable/disable display of clear shopping cart button on the cart page via checkout cart configuration.</description> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</annotations> | ||
<arguments> | ||
<argument name="value" type="string" defaultValue="Yes"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</arguments> | ||
<scrollTo selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabled}}" x="0" y="-100" stepKey="scrollToClearShoppingCartEnabled"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<uncheckOption selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabledInherit}}" stepKey="uncheckUseSystem"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<selectOption selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabled}}" userInput="{{value}}" stepKey="fillClearShoppingCartEnabled"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</actionGroup> | ||
</actionGroups> |
18 changes: 18 additions & 0 deletions
18
...de/Magento/Checkout/Test/Mftf/ActionGroup/AdminOpenSalesCheckoutConfigPageActionGroup.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminOpenSalesCheckoutConfigPageActionGroup"> | ||
<arguments> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<argument name="tabGroupAnchor" type="string" defaultValue=""/> | ||
</arguments> | ||
<amOnPage url="{{AdminCheckoutConfigPage.url(tabGroupAnchor)}}" stepKey="openCheckoutConfigPage"/> | ||
<waitForPageLoad stepKey="waitForCheckoutConfigPageLoad"/> | ||
</actionGroup> | ||
</actionGroups> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
app/code/Magento/Checkout/Test/Mftf/Page/AdminCheckoutConfigPage.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> | ||
<page name="AdminCheckoutConfigPage" url="admin/system_config/edit/section/checkout/{{tabLink}}" area="admin" parameterized="true" module="Magento_Checkout"> | ||
<section name="AdminCheckoutConfigSection"/> | ||
</page> | ||
</pages> |
13 changes: 13 additions & 0 deletions
13
app/code/Magento/Checkout/Test/Mftf/Section/AdminCheckoutConfigSection.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="AdminCheckoutConfigSection"> | ||
<element name="clearShoppingCartEnabled" type="select" selector="#checkout_cart_enable_clear_shopping_cart"/> | ||
dhaecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<element name="clearShoppingCartEnabledInherit" type="select" selector="#checkout_cart_enable_clear_shopping_cart_inherit"/> | ||
</section> | ||
</sections> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...st/StorefrontCheckRenderingClearCartButtonOnTheCartPageBasedOnStoresConfigurationTest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="StorefrontCheckRenderingClearShoppingCartButtonOnTheCartPageBasedOnStoresConfigurationTest"> | ||
<annotations> | ||
<features value="Checkout"/> | ||
<stories value="Shopping Cart"/> | ||
<title value="Check display render of clear shopping cart button on the cart page based on checkout cart stores configuration"/> | ||
<description value="Check display render of clear shopping cart button on the cart page based on checkout cart stores configuration"/> | ||
<severity value="MAJOR"/> | ||
<group value="shoppingCart"/> | ||
</annotations> | ||
|
||
<before> | ||
<!-- Create simple product --> | ||
<createData entity="SimpleProduct2" stepKey="createProduct"/> | ||
</before> | ||
<after> | ||
<!-- Delete simple product --> | ||
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/> | ||
|
||
<!-- Disable rendering of clear shopping cart button on the cart page --> | ||
<magentoCLI command="config:set {{DisableClearShoppingCartButtonOnTheCartPage.path}} {{DisableClearShoppingCartButtonOnTheCartPage.value}}" stepKey="disableClearShoppingCart"/> | ||
|
||
<!-- Log out --> | ||
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> | ||
</after> | ||
<!-- Add product to cart --> | ||
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> | ||
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> | ||
</actionGroup> | ||
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> | ||
<argument name="product" value="$$createProduct$$"/> | ||
<argument name="productCount" value="1"/> | ||
</actionGroup> | ||
|
||
<!-- Navigate to cart page --> | ||
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/> | ||
<waitForPageLoad stepKey="waitForShoppingCartLoad" /> | ||
|
||
<!-- Assert that empty cart button is not rendered on the cart page --> | ||
<dontSeeElement selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="dontSeeClearShoppingCartButton"/> | ||
|
||
<!-- Open new browser's window and login as Admin --> | ||
<openNewTab stepKey="openNewTab"/> | ||
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> | ||
|
||
<!-- Navigate to checkout cart configuration --> | ||
<actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openCheckoutCartConfig"> | ||
<argument name="tabGroupAnchor" value="#checkout_cart-link"/> | ||
</actionGroup> | ||
|
||
<!-- Enable clear shopping cart button --> | ||
<actionGroup ref="AdminCheckoutClearShoppingCartEnabledActionGroup" stepKey="enableClearShoppingCartButton"/> | ||
|
||
<!-- Flush cache --> | ||
<magentoCLI command="cache:flush" stepKey="cacheFlush"/> | ||
|
||
<!-- Back to the Cart page and refresh the page --> | ||
<switchToPreviousTab stepKey="switchToPreviousTab"/> | ||
<reloadPage stepKey="refreshPage"/> | ||
<waitForPageLoad stepKey="waitPageReload"/> | ||
|
||
<!-- Assert that empty cart button is rendered on the cart page --> | ||
<seeElement selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="SeeClearShoppingCartButton"/> | ||
joanhe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</test> | ||
</tests> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Checkout\ViewModel; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
use Magento\Framework\View\Element\Context; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Cart implements ArgumentInterface | ||
{ | ||
/** | ||
* Config settings path to enable clear shopping cart button | ||
*/ | ||
private const XPATH_CONFIG_ENABLE_CLEAR_SHOPPING_CART = 'checkout/cart/enable_clear_shopping_cart'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $_scopeConfig; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param Context $context | ||
*/ | ||
public function __construct( | ||
Context $context | ||
) { | ||
$this->_scopeConfig = $context->getScopeConfig(); | ||
} | ||
|
||
/** | ||
* Check if clear shopping cart button is enabled | ||
* | ||
* @return bool | ||
*/ | ||
public function isClearShoppingCartEnabled() | ||
joanhe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
return (bool) $this->_scopeConfig->getValue( | ||
self::XPATH_CONFIG_ENABLE_CLEAR_SHOPPING_CART, | ||
ScopeInterface::SCOPE_STORE | ||
joanhe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.