-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3432 from magento-epam/EPAM-PR-16
[epam] MAGETWO-67269: Gift Options set to no still show up as choices on front end order page
- Loading branch information
Showing
63 changed files
with
1,409 additions
and
79 deletions.
There are no files selected for viewing
This file contains 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
55 changes: 55 additions & 0 deletions
55
app/code/Magento/Bundle/Plugin/UpdatePriceInQuoteItemOptions.php
This file contains 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,55 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Bundle\Plugin; | ||
|
||
use Magento\Quote\Model\Quote\Item as OrigQuoteItem; | ||
use Magento\Quote\Model\Quote\Item\AbstractItem; | ||
use Magento\Framework\Serialize\SerializerInterface; | ||
|
||
/** | ||
* Update prices stored in quote item options after calculating quote item's totals | ||
*/ | ||
class UpdatePriceInQuoteItemOptions | ||
{ | ||
/** | ||
* @var SerializerInterface | ||
*/ | ||
private $serializer; | ||
|
||
/** | ||
* @param SerializerInterface $serializer | ||
*/ | ||
public function __construct(SerializerInterface $serializer) | ||
{ | ||
$this->serializer = $serializer; | ||
} | ||
|
||
/** | ||
* Update price on quote item options level | ||
* | ||
* @param OrigQuoteItem $subject | ||
* @param AbstractItem $result | ||
* @return AbstractItem | ||
* | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function afterCalcRowTotal(OrigQuoteItem $subject, AbstractItem $result) | ||
{ | ||
$bundleAttributes = $result->getProduct()->getCustomOption('bundle_selection_attributes'); | ||
if ($bundleAttributes !== null) { | ||
$actualPrice = $result->getPrice(); | ||
$parsedValue = $this->serializer->unserialize($bundleAttributes->getValue()); | ||
if (is_array($parsedValue) && array_key_exists('price', $parsedValue)) { | ||
$parsedValue['price'] = $actualPrice; | ||
} | ||
$bundleAttributes->setValue($this->serializer->serialize($parsedValue)); | ||
} | ||
|
||
return $result; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../Magento/Bundle/Test/Mftf/ActionGroup/StoreFrontAddProductToCartFromBundleActionGroup.xml
This file contains 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="StoreFrontAddProductToCartFromBundleWithCurrencyActionGroup"> | ||
<arguments> | ||
<argument name="product"/> | ||
<argument name="currency" type="string" defaultValue="US Dollar"/> | ||
</arguments> | ||
<click selector="{{StorefrontBundledSection.currencyTrigger}}" stepKey="openCurrencyTrigger"/> | ||
<click selector="{{StorefrontBundledSection.currency(currency)}}" stepKey="chooseCurrency"/> | ||
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> | ||
<waitForPageLoad stepKey="waitForBundleOpen"/> | ||
<checkOption selector="{{StorefrontBundledSection.productInBundle(product.name)}}" stepKey="chooseProduct"/> | ||
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="addToCartProduct"/> | ||
<scrollToTopOfPage stepKey="scrollToTop"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains 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
83 changes: 83 additions & 0 deletions
83
app/code/Magento/Bundle/Test/Mftf/Test/CurrencyChangingBundleProductInCartTest.xml
This file contains 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,83 @@ | ||
<?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="CurrencyChangingBundleProductInCartTest"> | ||
<annotations> | ||
<features value="Bundle"/> | ||
<stories value="Check that after changing currency price of cart is correct when the bundle product added to the cart"/> | ||
<title value="User should be able change the currency and get right price in cart when the bundle product added to the cart"/> | ||
<description value="User should be able change the currency and add one more product in cart and get right price in previous currency"/> | ||
<severity value="MAJOR"/> | ||
<testCaseId value="MAGETWO-94467"/> | ||
<group value="Bundle"/> | ||
</annotations> | ||
<before> | ||
<actionGroup ref="LoginAsAdmin" stepKey="login"/> | ||
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/> | ||
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/> | ||
</before> | ||
<after> | ||
<!-- Delete the bundled product --> | ||
<actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid"> | ||
<argument name="product" value="BundleProduct"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFiltersAfter"/> | ||
<waitForPageLoad stepKey="waitForClearFilter"/> | ||
<!--Clear Configs--> | ||
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/> | ||
<waitForPageLoad stepKey="waitForAdminLoginPageLoad"/> | ||
<amOnPage url="{{ConfigCurrencySetupPage.url}}" stepKey="navigateToConfigCurrencySetupPage"/> | ||
<waitForPageLoad stepKey="waitForConfigCurrencySetupPageForUnselectEuroCurrency"/> | ||
<unselectOption selector="{{CurrencySetupSection.allowCurrencies}}" userInput="Euro" stepKey="unselectEuro"/> | ||
<scrollToTopOfPage stepKey="scrollToTopOfPage"/> | ||
<click selector="{{CurrencySetupSection.currencyOptions}}" stepKey="closeOptions"/> | ||
<waitForPageLoad stepKey="waitForCloseOptions"/> | ||
<click stepKey="saveUnselectedConfigs" selector="{{AdminConfigSection.saveButton}}"/> | ||
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/> | ||
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> | ||
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> | ||
</after> | ||
<!--Go to bundle product creation page--> | ||
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/> | ||
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/> | ||
<actionGroup ref="fillMainBundleProductForm" stepKey="fillMainFieldsForBundle"/> | ||
<!-- Add Option, a "Radio Buttons" type option --> | ||
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2"> | ||
<argument name="x" value="0"/> | ||
<argument name="n" value="1"/> | ||
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/> | ||
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/> | ||
<argument name="optionTitle" value="Option"/> | ||
<argument name="inputType" value="radio"/> | ||
</actionGroup> | ||
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '0')}}" stepKey="userDefinedQuantitiyOptionProduct0"/> | ||
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '1')}}" stepKey="userDefinedQuantitiyOptionProduct1"/> | ||
<actionGroup ref="saveProductForm" stepKey="saveProduct"/> | ||
<amOnPage url="{{ConfigCurrencySetupPage.url}}" stepKey="navigateToConfigCurrencySetupPage"/> | ||
<waitForPageLoad stepKey="waitForConfigCurrencySetupPage"/> | ||
<conditionalClick selector="{{CurrencySetupSection.currencyOptions}}" dependentSelector="{{CurrencySetupSection.allowCurrencies}}" visible="false" stepKey="openOptions"/> | ||
<waitForPageLoad stepKey="waitForOptions"/> | ||
<selectOption selector="{{CurrencySetupSection.allowCurrencies}}" parameterArray="['Euro', 'US Dollar']" stepKey="selectCurrencies"/> | ||
<click stepKey="saveConfigs" selector="{{AdminConfigSection.saveButton}}"/> | ||
<!-- Go to storefront BundleProduct --> | ||
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/> | ||
<waitForPageLoad stepKey="waitForStorefront"/> | ||
<actionGroup ref="StoreFrontAddProductToCartFromBundleWithCurrencyActionGroup" stepKey="addProduct1ToCartAndChangeCurrencyToEuro"> | ||
<argument name="product" value="$$simpleProduct1$$"/> | ||
<argument name="currency" value="EUR - Euro"/> | ||
</actionGroup> | ||
<actionGroup ref="StoreFrontAddProductToCartFromBundleWithCurrencyActionGroup" stepKey="addProduct2ToCartAndChangeCurrencyToUSD"> | ||
<argument name="product" value="$$simpleProduct2$$"/> | ||
<argument name="currency" value="USD - US Dollar"/> | ||
</actionGroup> | ||
<click stepKey="openMiniCart" selector="{{StorefrontMinicartSection.showCart}}"/> | ||
<waitForPageLoad stepKey="waitForMiniCart"/> | ||
<see stepKey="seeCartSubtotal" userInput="$12,300.00"/> | ||
</test> | ||
</tests> |
This file contains 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 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.