-
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 branch '2.4-develop' into fix-CategoryWithOverriddenUrlKey
- Loading branch information
Showing
44 changed files
with
1,731 additions
and
127 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
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
71 changes: 71 additions & 0 deletions
71
...code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithProductsDefaultSortingTest.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,71 @@ | ||
<?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="AdminUpdateCategoryWithProductsDefaultSortingTest"> | ||
<annotations> | ||
<features value="Catalog"/> | ||
<stories value="Update categories"/> | ||
<title value="Update category, sort products by default sorting"/> | ||
<description value="Login as admin, update category and sort products"/> | ||
<testCaseId value="MC-25667"/> | ||
<severity value="CRITICAL"/> | ||
<group value="catalog"/> | ||
<group value="mtf_migrated"/> | ||
</annotations> | ||
<before> | ||
<createData entity="defaultSimpleProduct" stepKey="simpleProduct" /> | ||
<createData entity="_defaultCategory" stepKey="createCategory"/> | ||
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/> | ||
</before> | ||
<after> | ||
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> | ||
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> | ||
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> | ||
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/> | ||
</after> | ||
|
||
<!--Open Category Page--> | ||
<actionGroup ref="GoToAdminCategoryPageByIdActionGroup" stepKey="goToAdminCategoryPage"> | ||
<argument name="id" value="$createCategory.id$"/> | ||
</actionGroup> | ||
|
||
<!--Update Product Display Setting--> | ||
<waitForElementVisible selector="{{AdminCategoryDisplaySettingsSection.settingsHeader}}" stepKey="waitForDisplaySettingsSection"/> | ||
<conditionalClick selector="{{AdminCategoryDisplaySettingsSection.settingsHeader}}" dependentSelector="{{AdminCategoryDisplaySettingsSection.displayMode}}" visible="false" stepKey="openDisplaySettingsSection"/> | ||
<waitForElementVisible selector="{{CategoryDisplaySettingsSection.productListCheckBox}}" stepKey="waitForAvailableProductListCheckbox"/> | ||
<click selector="{{CategoryDisplaySettingsSection.productListCheckBox}}" stepKey="enableTheAvailableProductList"/> | ||
<selectOption selector="{{CategoryDisplaySettingsSection.productList}}" parameterArray="['Product Name', 'Price']" stepKey="selectPrice"/> | ||
<waitForElementVisible selector="{{CategoryDisplaySettingsSection.defaultProductLisCheckBox}}" stepKey="waitForDefaultProductList"/> | ||
<click selector="{{CategoryDisplaySettingsSection.defaultProductLisCheckBox}}" stepKey="enableTheDefaultProductList"/> | ||
<selectOption selector="{{CategoryDisplaySettingsSection.defaultProductList}}" userInput="name" stepKey="selectProductName"/> | ||
|
||
<!--Add Products in Category--> | ||
<actionGroup ref="AdminCategoryAssignProductActionGroup" stepKey="assignSimpleProductToCategory"> | ||
<argument name="productSku" value="$simpleProduct.sku$"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminSaveCategoryFormActionGroup" stepKey="saveCategory"/> | ||
|
||
<!--Verify Category Title--> | ||
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryNamePageTitle" /> | ||
|
||
<!--Verify Category in store front page--> | ||
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="openStorefrontCategoryPage"/> | ||
|
||
<!--Verify Product in Category--> | ||
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="assertSimpleProductOnCategoryPage"> | ||
<argument name="productName" value="$simpleProduct.name$"/> | ||
</actionGroup> | ||
|
||
<!--Verify product name and sku on Store Front--> | ||
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="assertProductOnStorefrontProductPage"> | ||
<argument name="product" value="$simpleProduct$"/> | ||
</actionGroup> | ||
</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
74 changes: 74 additions & 0 deletions
74
app/code/Magento/CatalogInventory/Model/ResourceModel/StockStatusFilter.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,74 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogInventory\Model\ResourceModel; | ||
|
||
use Magento\CatalogInventory\Api\Data\StockStatusInterface; | ||
use Magento\CatalogInventory\Api\StockConfigurationInterface; | ||
use Magento\CatalogInventory\Model\Stock; | ||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Framework\DB\Select; | ||
|
||
/** | ||
* Generic in-stock status filter | ||
*/ | ||
class StockStatusFilter implements StockStatusFilterInterface | ||
{ | ||
private const TABLE_NAME = 'cataloginventory_stock_status'; | ||
/** | ||
* @var ResourceConnection | ||
*/ | ||
private $resource; | ||
|
||
/** | ||
* @var StockConfigurationInterface | ||
*/ | ||
private $stockConfiguration; | ||
|
||
/** | ||
* @param ResourceConnection $resource | ||
* @param StockConfigurationInterface $stockConfiguration | ||
*/ | ||
public function __construct( | ||
ResourceConnection $resource, | ||
StockConfigurationInterface $stockConfiguration | ||
) { | ||
$this->resource = $resource; | ||
$this->stockConfiguration = $stockConfiguration; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function execute( | ||
Select $select, | ||
string $productTableAlias, | ||
string $stockStatusTableAlias = self::TABLE_ALIAS, | ||
?int $websiteId = null | ||
): Select { | ||
$stockStatusTable = $this->resource->getTableName(self::TABLE_NAME); | ||
$joinCondition = [ | ||
"{$stockStatusTableAlias}.product_id = {$productTableAlias}.entity_id", | ||
$select->getConnection()->quoteInto( | ||
"{$stockStatusTableAlias}.website_id = ?", | ||
$this->stockConfiguration->getDefaultScopeId() | ||
), | ||
$select->getConnection()->quoteInto( | ||
"{$stockStatusTableAlias}.stock_id = ?", | ||
Stock::DEFAULT_STOCK_ID | ||
) | ||
]; | ||
$select->join( | ||
[$stockStatusTableAlias => $stockStatusTable], | ||
implode(' AND ', $joinCondition), | ||
[] | ||
); | ||
$select->where("{$stockStatusTableAlias}.stock_status = ?", StockStatusInterface::STATUS_IN_STOCK); | ||
|
||
return $select; | ||
} | ||
} |
Oops, something went wrong.