-
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 #5450 from magento-tsg-csl3/2.4-develop-pr16
[TSG-CSL3] For 2.4 (pr16)
- Loading branch information
Showing
50 changed files
with
1,481 additions
and
652 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
56 changes: 56 additions & 0 deletions
56
app/code/Magento/Catalog/Model/ResourceModel/ProductWebsiteAssignmentHandler.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,56 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
namespace Magento\Catalog\Model\ResourceModel; | ||
|
||
use Magento\Catalog\Model\ResourceModel\Product\Website\Link; | ||
use Magento\Framework\EntityManager\Operation\AttributeInterface; | ||
|
||
/** | ||
* Class purpose is to handle product websites assignment | ||
*/ | ||
class ProductWebsiteAssignmentHandler implements AttributeInterface | ||
{ | ||
/** | ||
* @var Link | ||
*/ | ||
private $productLink; | ||
|
||
/** | ||
* ProductWebsiteAssignmentHandler constructor | ||
* | ||
* @param Link $productLink | ||
*/ | ||
public function __construct( | ||
Link $productLink | ||
) { | ||
$this->productLink = $productLink; | ||
} | ||
|
||
/** | ||
* Assign product website entity to the product repository | ||
* | ||
* @param string $entityType | ||
* @param array $entityData | ||
* @param array $arguments | ||
* @return array | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
* @throws \Exception | ||
*/ | ||
public function execute($entityType, $entityData, $arguments = []): array | ||
{ | ||
$websiteIds = array_key_exists('website_ids', $entityData) ? | ||
array_filter($entityData['website_ids'], function ($websiteId) { | ||
return $websiteId !== null; | ||
}) : []; | ||
$productId = array_key_exists('entity_id', $entityData) ? (int) $entityData['entity_id'] : null; | ||
|
||
if (!empty($productId) && !empty($websiteIds)) { | ||
$this->productLink->updateProductWebsite($productId, $websiteIds); | ||
} | ||
return $entityData; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...t/Mftf/ActionGroup/AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup.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,22 @@ | ||
<?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="AssertSeeProductDetailsOnStorefrontRecentlyViewedWidgetActionGroup"> | ||
<annotations> | ||
<description>Goes to the home Page Recently VIewed Product and Grab the Prdouct name and Position from it.</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="productName" type="string"/> | ||
<argument name="productPosition" type="string"/> | ||
</arguments> | ||
<grabTextFrom selector="{{StoreFrontRecentlyViewedProductSection.ProductName(productPosition)}}" stepKey="grabRelatedProductPosition"/> | ||
<assertContains expected="{{productName}}" actual="$grabRelatedProductPosition" stepKey="assertRelatedProductName"/> | ||
</actionGroup> | ||
</actionGroups> |
23 changes: 23 additions & 0 deletions
23
app/code/Magento/Catalog/Test/Mftf/Data/RecentlyViewedProductStoreData.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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> | ||
<entity name="RecentlyViewedProductScopeStore"> | ||
<data key="path">catalog/recently_products/scope</data> | ||
<data key="value">store</data> | ||
</entity> | ||
<entity name="RecentlyViewedProductScopeWebsite"> | ||
<data key="path">catalog/recently_products/scope</data> | ||
<data key="value">website</data> | ||
</entity> | ||
<entity name="RecentlyViewedProductScopeStoreGroup"> | ||
<data key="path">catalog/recently_products/scope</data> | ||
<data key="value">group</data> | ||
</entity> | ||
</entities> |
15 changes: 15 additions & 0 deletions
15
app/code/Magento/Catalog/Test/Mftf/Section/StoreFrontRecentProductSection.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,15 @@ | ||
<?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="StoreFrontRecentlyViewedProductSection"> | ||
<element name="ProductName" type="text" selector="//div[@class='products-grid']/ol/li[position()={{position}}]/div/div[@class='product-item-details']/strong/a" parameterized="true"/> | ||
</section> | ||
</sections> |
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.