Skip to content

Commit

Permalink
Merge branch '2.4-develop' into redis-session-compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Hotel authored May 29, 2024
2 parents 2b52116 + a2e0ef1 commit bc13dc0
Show file tree
Hide file tree
Showing 98 changed files with 3,140 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trim_trailing_whitespace = false
[*.{yml,yaml,json}]
indent_size = 2

[{composer, auth}.json]
[{composer,auth}.json]
indent_size = 4

[db_schema_whitelist.json]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?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="StorefrontCheckPriceForDynamicBundleProductWithMixedDiscountsTest">
<annotations>
<features value="Bundle"/>
<stories value="View bundle product"/>
<title value="Check mixed discount prices for bundle product"/>
<description value="The testcase purpose to verify mixed discount prices for bundle product on storefront"/>
<testCaseId value="AC-4571"/>
<severity value="MAJOR"/>
</annotations>
<before>
<!-- create three categories-->
<createData entity="_defaultCategory" stepKey="category1"/>
<createData entity="_defaultCategory" stepKey="category2"/>
<createData entity="_defaultCategory" stepKey="category3"/>
<!-- login to backend -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="clearExistingCatalogPriceRules"/>
<!-- create two catalog rules for categories -->
<!-- first catalog rule -->
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/>
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule"/>
<actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForCatalogPriceRule">
<argument name="conditionValue" value="$category2.id$"/>
</actionGroup>
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
<argument name="apply" value="by_percent"/>
<argument name="discountAmount" value="100"/>
</actionGroup>
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyFirstPriceRule"/>
<!-- second catalog rule -->
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openAgainNewCatalogPriceRulePage"/>
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForSecondCatalogPriceRule"/>
<actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForSecondCatalogPriceRule">
<argument name="conditionValue" value="$category3.id$"/>
</actionGroup>
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForSecondCatalogPriceRule">
<argument name="apply" value="by_percent"/>
<argument name="discountAmount" value="70"/>
</actionGroup>
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplySecondPriceRule"/>
<!-- create 6 simple products -->
<!-- create first product -->
<createData entity="_defaultProduct" stepKey="firstProduct">
<field key="price">10.5</field>
<field key="quantity">1000</field>
<requiredEntity createDataKey="category1"/>
</createData>
<createData entity="tierPriceForSimpleProduct" stepKey="addTierPrice">
<requiredEntity createDataKey="firstProduct"/>
</createData>
<!-- create second product -->
<createData entity="SimpleProduct4" stepKey="secondProduct">
<field key="price">15</field>
<requiredEntity createDataKey="category2"/>
</createData>
<!-- create third product -->
<createData entity="_defaultProduct" stepKey="thirdProduct">
<field key="price">23.40</field>
<field key="quantity">1000</field>
<requiredEntity createDataKey="category1"/>
</createData>
<createData entity="specialProductPriceForProduct" stepKey="addSpecialPrice">
<requiredEntity createDataKey="thirdProduct"/>
</createData>
<!-- create fourth product -->
<createData entity="_defaultProduct" stepKey="fourthProduct">
<field key="price">30</field>
<field key="quantity">1000</field>
<requiredEntity createDataKey="category3"/>
</createData>
<!-- create fifth product -->
<createData entity="_defaultProduct" stepKey="fifthProduct">
<field key="price">25</field>
<field key="status">0</field>
<field key="quantity">1000</field>
<requiredEntity createDataKey="category1"/>
</createData>
<!-- create sixth product -->
<createData entity="_defaultProduct" stepKey="sixthProduct">
<field key="price">25</field>
<field key="quantity">1000</field>
<requiredEntity createDataKey="category1"/>
</createData>
<createData entity="specialProductPriceForSimpleProduct" stepKey="addSpecialPriceForSixthProduct">
<requiredEntity createDataKey="sixthProduct"/>
</createData>
<!--Create Bundle product -->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
<requiredEntity createDataKey="category1"/>
</createData>
<!-- Add options to the product -->
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
<requiredEntity createDataKey="createBundleProduct"/>
<field key="required">false</field>
</createData>
<createData entity="DropDownBundleOption" stepKey="createBundleOption1_2">
<requiredEntity createDataKey="createBundleProduct"/>
<field key="required">false</field>
</createData>
<!-- add products to checkbox option -->
<createData entity="ApiBundleLink" stepKey="linkOptionToFifthProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_2"/>
<requiredEntity createDataKey="fifthProduct"/>
<field key="qty">1</field>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToFourthProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_2"/>
<requiredEntity createDataKey="fourthProduct"/>
<field key="qty">3</field>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToSixthProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_2"/>
<requiredEntity createDataKey="sixthProduct"/>
<field key="qty">1</field>
</createData>
<!-- add products to multiselect option -->
<createData entity="ApiBundleLink" stepKey="linkOptionToSecondProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_1"/>
<requiredEntity createDataKey="secondProduct"/>
<field key="qty">3</field>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToFirstProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_1"/>
<requiredEntity createDataKey="firstProduct"/>
<field key="qty">2</field>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToThirdProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_1"/>
<requiredEntity createDataKey="thirdProduct"/>
<field key="qty">1</field>
</createData>
<!-- Add advanced pricing to bundle product -->
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductForEdit">
<argument name="productId" value="$createBundleProduct.id$"/>
</actionGroup>
<actionGroup ref="AdminBundleProductSetAdvancedPricingActionGroup" stepKey="addProductTierPrice">
<argument name="quantity" value="1"/>
<argument name="price" value="Discount"/>
<argument name="amount" value="75"/>
<argument name="priceView" value="Price Range"/>
</actionGroup>
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices">
<argument name="indices" value="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule"/>
</actionGroup>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
<argument name="tags" value="full_page"/>
</actionGroup>
</before>
<after>
<!-- delete created data -->
<deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/>
<deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/>
<deleteData createDataKey="thirdProduct" stepKey="deleteThirdProduct"/>
<deleteData createDataKey="fourthProduct" stepKey="deleteFourthProduct"/>
<deleteData createDataKey="fifthProduct" stepKey="deleteFifthProduct"/>
<deleteData createDataKey="sixthProduct" stepKey="deleteSixthProduct"/>
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteCatalogPriceRules"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- Go to storefront category page -->
<!-- check product prices on category and product page -->
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="amOnCategoryPage">
<argument name="category" value="$$category1$$"/>
</actionGroup>
<waitForText userInput="From $4.69 Regular Price $21.00" selector="{{StorefrontCategoryProductSection.priceFromByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceFromInCategoryBundle"/>
<waitForText userInput="To $16.44 Regular Price $134.40" selector="{{StorefrontCategoryProductSection.priceToByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceToInCategoryBundle"/>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage">
<argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<waitForElement selector="{{StorefrontProductInfoMainSection.priceFrom('From $4.69 Regular Price $21.00')}}" stepKey="seePriceFromBundle"/>
<waitForElement selector="{{StorefrontProductInfoMainSection.priceTo('To $16.44 Regular Price $134.40')}}" stepKey="seePriceToBundle"/>
</test>
</tests>
18 changes: 11 additions & 7 deletions app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
namespace Magento\Catalog\Block\Product\Widget;

use Magento\Framework\App\Http\Context as HttpContext;

/**
* New products widget
*/
Expand All @@ -13,29 +15,29 @@ class NewWidget extends \Magento\Catalog\Block\Product\NewProduct implements \Ma
/**
* Display products type - all products
*/
const DISPLAY_TYPE_ALL_PRODUCTS = 'all_products';
public const DISPLAY_TYPE_ALL_PRODUCTS = 'all_products';

/**
* Display products type - new products
*/
const DISPLAY_TYPE_NEW_PRODUCTS = 'new_products';
public const DISPLAY_TYPE_NEW_PRODUCTS = 'new_products';

/**
* Default value whether show pager or not
*/
const DEFAULT_SHOW_PAGER = false;
public const DEFAULT_SHOW_PAGER = false;

/**
* Default value for products per page
*/
const DEFAULT_PRODUCTS_PER_PAGE = 5;
public const DEFAULT_PRODUCTS_PER_PAGE = 5;

/**
* Name of request parameter for page number value
*
* @deprecated
*/
const PAGE_VAR_NAME = 'np';
public const PAGE_VAR_NAME = 'np';

/**
* Instance of pager block
Expand Down Expand Up @@ -134,13 +136,15 @@ public function getCurrentPage()
*/
public function getCacheKeyInfo()
{
$store = $this->_storeManager->getStore();
return array_merge(
parent::getCacheKeyInfo(),
[
$this->getDisplayType(),
$this->getProductsPerPage(),
(int) $this->getRequest()->getParam($this->getData('page_var_name'), 1),
$this->serializer->serialize($this->getRequest()->getParams())
$this->serializer->serialize($this->getRequest()->getParams()),
$this->httpContext->getValue(HttpContext::CONTEXT_CURRENCY) ?: $store->getDefaultCurrency()->getCode()
]
);
}
Expand Down Expand Up @@ -268,7 +272,7 @@ public function getProductPriceHtml(
? $arguments['display_minimal_price']
: true;

/** @var \Magento\Framework\Pricing\Render $priceRender */
/** @var \Magento\Framework\Pricing\Render $priceRender */
$priceRender = $this->getLayout()->getBlock('product.price.render.default');

$price = '';
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function get($sku, $editMode = false, $storeId = null, $forceReload = fal
*/
public function getById($productId, $editMode = false, $storeId = null, $forceReload = false)
{
$cacheKey = $this->getCacheKey([$editMode, $storeId]);
$cacheKey = $this->getCacheKey([$editMode, $storeId === null ? $storeId : (int) $storeId]);
if (!isset($this->instancesById[$productId][$cacheKey]) || $forceReload) {
$product = $this->productFactory->create();
if ($editMode) {
Expand Down
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="ScrollToUpSellSectionAtStorefrontActionGroup">
<annotations>
<description>Admin scroll to upsell section on storefront preview page.</description>
</annotations>
<scrollTo selector="{{StorefrontProductUpSellProductsSection.upSellSection}}" stepKey="scrollToUpSellSection" />
<waitForText selector="{{StorefrontProductUpSellProductsSection.upSellHeading}}" userInput="We found other products you might like!" stepKey="seeTheUpSellHeading"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@
<data key="store_id">0</data>
<var key="sku" entityType="product" entityKey="sku" />
</entity>
<entity name="specialProductPriceForProduct" type="catalogSpecialPrice">
<data key="price">18.77</data>
<data key="store_id">0</data>
<var key="sku" entityType="product" entityKey="sku" />
</entity>
<entity name="specialProductPriceForSimpleProduct" type="catalogSpecialPrice">
<data key="price">19.99</data>
<data key="store_id">0</data>
<var key="sku" entityType="product" entityKey="sku" />
</entity>
</entities>
10 changes: 10 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -465,5 +465,15 @@
<data key="frontend_input">price</data>
<data key="used_for_sort_by">false</data>
</entity>
<entity name="productAttributeFPT" type="ProductAttribute">
<data key="default_frontend_label">FPT</data>
<data key="attribute_code">fpt</data>
<data key="frontend_input">weee</data>
<data key="scope">global</data>
<data key="is_used_in_grid">true</data>
<data key="is_visible_in_grid">true</data>
<data key="is_filterable_in_grid">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
</entities>

8 changes: 8 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,12 @@
<data key="customer_group">General</data>
<data key="quantity">3</data>
</entity>
<entity name="tierPriceForSimpleProduct" type="catalogTierPrice">
<data key="price">9.99</data>
<data key="price_type">fixed</data>
<data key="website_id">0</data>
<data key="customer_group">ALL GROUPS</data>
<data key="quantity">1</data>
<var key="sku" entityType="product" entityKey="sku" />
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<section name="AdminAddRelatedProductsModalSection">
<element name="AddSelectedProductsButton" type="button" selector="//aside[contains(@class, 'related_modal')]//button[contains(@class, 'action-primary')]" timeout="30"/>
<element name="AddUpSellProductsButton" type="button" selector="//aside[contains(@class, 'upsell_modal')]//button[contains(@class, 'action-primary')]" timeout="30"/>
<element name="AddCrossSellProductsButton" type="button" selector="//aside[contains(@class, 'crosssell_modal')]//button[contains(@class, 'action-primary')]" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
<element name="storeViewOptions" type="text" selector=".admin__data-grid-outer-wrap select[name='store_id'] > option[value='{{value}}']" parameterized="true"/>
<element name="viewColumnOptionName" type="text" selector="//div[contains(@class, '_active')]//div[contains(@class, 'admin__data-grid-action-columns-menu')]//div[@class='admin__field-option']//label[text()='{{col}}']" parameterized="true"/>
<element name="customAttribute" type="text" selector="input.admin__control-text[name='{{var}}']" parameterized="true"/>
<element name="crossSellFilters" type="button" selector="//*[contains(@class, 'crosssell_product')]//button[text()='Filters']"/>
<element name="upSellFilters" type="button" selector="//*[contains(@class, 'upsell_product')]//button[text()='Filters']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
<element name="selectedProductSku" type="text" selector="//div[@data-index='{{section}}']//span[@data-index='sku']" parameterized="true" timeout="30"/>
<element name="removeCrossSellProduct" type="button" selector="//span[text()='Cross-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
<element name="removeUpsellProduct" type="button" selector="//span[text()='Up-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
<element name="relatedUpSellCrossSellProductStagingSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='{{catalogStagingSection}}']" parameterized="true"/>
</section>
</sections>
Loading

0 comments on commit bc13dc0

Please sign in to comment.