Skip to content

Commit

Permalink
Merge branch '2.4-develop' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Echo authored Nov 22, 2023
2 parents 40f5afe + 97e33f5 commit c8fd019
Show file tree
Hide file tree
Showing 279 changed files with 6,517 additions and 1,830 deletions.
12 changes: 6 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributions to the Magento 2 codebase are done using the fork & pull model.
This contribution model has contributors maintaining their own fork of the Magento 2 repository.
The forked repository is then used to submit a request to the base repository to pull a set of changes.
The forked repository is then used to submit a request to the base repository to "pull" a set of changes.
For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/).

Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes or optimizations.
Expand All @@ -19,11 +19,11 @@ For more detailed information on contribution please read our [beginners guide](
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests.
3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/HEAD/.github/PULL_REQUEST_TEMPLATE.md) for more information.
4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
3. PRs which include new logic or new features must be submitted along with:
* Unit/integration test coverage
* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
5. All automated tests must pass.
5. PRs which include new logic or new features must be submitted along with:
* Unit/integration test coverage
* Proposed [documentation](https://developer.adobe.com/commerce) updates. Use feedback buttons __Edit in GitHub__ and __Log an issue__ at the top of a relevant topic.
6. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
7. All automated tests must pass.

## Contribution process

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ However, for those who need a full-featured eCommerce solution, we recommend [Ad

## Contribute

Our [Community](https://opensource.magento.com/) is large and diverse, and our project is enormous. As a contributor, you have countless opportunities to impact product development and delivery by introducing new features or improving existing ones, enhancing test coverage, updating documentation for [developers](https://developer.adobe.com/commerce/docs/) and [end-users](https://docs.magento.com/user-guide/), catching and fixing code bugs, suggesting points for optimization, and sharing your great ideas.
Our [Community](https://opensource.magento.com/) is large and diverse, and our project is enormous. As a contributor, you have countless opportunities to impact product development and delivery by introducing new features or improving existing ones, enhancing test coverage, updating documentation for [developers](https://developer.adobe.com/commerce/docs/) and [end-users](https://experienceleague.adobe.com/docs/commerce-admin/user-guides/home.html), catching and fixing code bugs, suggesting points for optimization, and sharing your great ideas.

- [Contribute to the code](https://developer.adobe.com/commerce/contributor/guides/code-contributions/)
- [Report an issue](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#report)
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<otp>https://advancedreporting.rjmetrics.com/otp</otp>
<report>https://advancedreporting.rjmetrics.com/report</report>
<notify_data_changed>https://advancedreporting.rjmetrics.com/report</notify_data_changed>
<documentation>https://docs.magento.com/user-guide/reports/advanced-reporting.html</documentation>
<documentation>https://experienceleague.adobe.com/docs/commerce-admin/start/reporting/business-intelligence.html#advanced-reporting</documentation>
</url>
<integration_name>Magento Analytics user</integration_name>
<general>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Store/Switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Switcher extends \Magento\Backend\Block\Template
/**
* URL for store switcher hint
*/
public const HINT_URL = 'https://docs.magento.com/user-guide/configuration/scope.html';
public const HINT_URL = 'https://experienceleague.adobe.com/docs/commerce-admin/start/setup/websites-stores-views.html#scope-settings'; // @codingStandardsIgnoreLine

/**
* Name of website variable
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The Magento_Backup module allows administrators to perform backups and rollbacks

The Magento_Backup module does not affect the storefront.

For more information about this module, see [Magento Backups](https://docs.magento.com/user-guide/system/backups.html)
For more information about this module, see [Backups](https://experienceleague.adobe.com/docs/commerce-admin/systems/tools/backups.html)

## Extensibility

Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Bundle/Model/LinkManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ private function processLinkedProduct(
}

$selectionModel = $this->bundleSelection->create();
$selectionModel->load($linkedProduct->getId());
$selectionModel = $this->mapProductLinkToBundleSelectionModel(
$selectionModel,
$linkedProduct,
Expand Down
9 changes: 7 additions & 2 deletions app/code/Magento/Bundle/Model/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
namespace Magento\Bundle\Model;

use Magento\Framework\App\ObjectManager;

/**
* Bundle Selection Model
*
Expand Down Expand Up @@ -36,8 +38,6 @@
class Selection extends \Magento\Framework\Model\AbstractModel
{
/**
* Catalog data
*
* @var \Magento\Catalog\Helper\Data
*/
protected $_catalogData;
Expand Down Expand Up @@ -82,7 +82,9 @@ public function beforeSave()
{
if (!$this->_catalogData->isPriceGlobal() && $this->getWebsiteId()) {
$this->setData('tmp_selection_price_value', $this->getSelectionPriceValue());
$this->setData('tmp_selection_price_type', $this->getSelectionPriceType());
$this->setSelectionPriceValue($this->getOrigData('selection_price_value'));
$this->setSelectionPriceType($this->getOrigData('selection_price_type'));
}
parent::beforeSave();
}
Expand All @@ -98,6 +100,9 @@ public function afterSave()
if (null !== $this->getData('tmp_selection_price_value')) {
$this->setSelectionPriceValue($this->getData('tmp_selection_price_value'));
}
if (null !== $this->getData('tmp_selection_price_type')) {
$this->setSelectionPriceType($this->getData('tmp_selection_price_type'));
}
$this->getResource()->saveSelectionPrice($this);

if (!$this->getDefaultPriceScope()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<element name="minPrice" type="text" selector="span[data-price-type='minPrice']"/>
<element name="maxPrice" type="text" selector="span[data-price-type='minPrice']"/>
<element name="asLowAsFinalPrice" type="text" selector="div.price-box.price-final_price p.minimal-price > span.price-final_price span.price"/>
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price > span.price-final_price span.price"/>
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price p.price-from span.price-final_price span.price-wrapper span.price"/>
<element name="productBundleOptionsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/../input" parameterized="true" timeout="30"/>
<element name="productBundleOneOptionInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/..//input[contains(@class, 'option')]" parameterized="true" timeout="30"/>
<element name="productBundleOptionQty" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/..//input[contains(@class, 'qty')]" parameterized="true" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ public function testAddChildCouldNotSave(): void
->method('create')
->willReturn($bundle);

$selection = $this->createPartialMock(Selection::class, ['save']);
$selection = $this->createPartialMock(Selection::class, ['save', 'load']);
$selection->expects($this->once())->method('save')
->willReturnCallback(
static function () {
Expand Down Expand Up @@ -696,7 +696,7 @@ public function testAddChild(): void
->willReturn($selections);
$this->bundleFactoryMock->expects($this->once())->method('create')->willReturn($bundle);

$selection = $this->createPartialMock(Selection::class, ['save', 'getId']);
$selection = $this->createPartialMock(Selection::class, ['save', 'getId', 'load']);
$selection->expects($this->once())->method('save');
$selection->expects($this->once())->method('getId')->willReturn(42);
$this->bundleSelectionMock->expects($this->once())->method('create')->willReturn($selection);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2014 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
* ************************************************************************
*/
declare(strict_types=1);

namespace Magento\Catalog\Api;

/**
* Intended to allow setting 'is_filterable' property for specific attribute as integer value via REST/SOAP API
*
* @api
*/
interface ProductAttributeIsFilterableManagementInterface
{
/**
* Retrieve 'is_filterable' property for specific attribute as integer
*
* @param string $attributeCode
* @return int
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function get(string $attributeCode): int;

/**
* Set 'is_filterable' property for specific attribute as integer
*
* @param string $attributeCode
* @param int $isFilterable
* @return bool
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Exception\StateException
*/
public function set(string $attributeCode, int $isFilterable): bool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Catalog\Model\Entity\Attribute;
use Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker;
use Magento\Framework\Data\FormFactory;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Registry;

/**
Expand Down Expand Up @@ -58,6 +59,7 @@ public function __construct(
* @inheritDoc
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @throws LocalizedException
*/
protected function _prepareForm()
{
Expand Down Expand Up @@ -176,28 +178,34 @@ protected function _prepareForm()
['form' => $form, 'attribute' => $attributeObject]
);

$dependencies = $this->getLayout()->createBlock(
\Magento\Backend\Block\Widget\Form\Element\Dependence::class
)->addFieldMap(
"is_html_allowed_on_front",
'html_allowed_on_front'
)->addFieldMap(
"frontend_input",
'frontend_input_type'
)->addFieldMap(
"is_searchable",
'searchable'
)->addFieldMap(
"is_visible_in_advanced_search",
'advanced_search'
)->addFieldDependence(
'advanced_search',
'searchable',
'1'
);
$this->_eventManager->dispatch(
'adminhtml_catalog_product_attribute_edit_frontend_prepare_field_dependencies',
['dependencies' => $dependencies]
);

// define field dependencies
$this->setChild(
'form_after',
$this->getLayout()->createBlock(
\Magento\Backend\Block\Widget\Form\Element\Dependence::class
)->addFieldMap(
"is_html_allowed_on_front",
'html_allowed_on_front'
)->addFieldMap(
"frontend_input",
'frontend_input_type'
)->addFieldMap(
"is_searchable",
'searchable'
)->addFieldMap(
"is_visible_in_advanced_search",
'advanced_search'
)->addFieldDependence(
'advanced_search',
'searchable',
'1'
)
$dependencies
);

$this->setForm($form);
Expand Down
21 changes: 20 additions & 1 deletion app/code/Magento/Catalog/Helper/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ private function preparePageMetadata(ResultPage $resultPage, $product)
$pageConfig = $resultPage->getConfig();

$metaTitle = $product->getMetaTitle();
$pageConfig->setMetaTitle($metaTitle);
$productMetaTitle = $metaTitle ? $this->addConfigValues($metaTitle) : null;
$pageConfig->setMetaTitle($productMetaTitle);
$pageConfig->getTitle()->set($metaTitle ?: $product->getName());

$keyword = $product->getMetaKeyword();
Expand Down Expand Up @@ -294,4 +295,22 @@ public function prepareAndRender(ResultPage $resultPage, $productId, $controller
$this->preparePageMetadata($resultPage, $product);
return $this;
}

/**
* Add Prefix and Suffix as per the configuration.
*
* @param string $title
* @return string
*/
private function addConfigValues(string $title): string
{
$preparedTitle = $this->scopeConfig->getValue(
'design/head/title_prefix',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) . ' ' . $title . ' ' . $this->scopeConfig->getValue(
'design/head/title_suffix',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return trim($preparedTitle);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
/************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2014 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
* ************************************************************************
*/
declare(strict_types=1);

namespace Magento\Catalog\Model\Product\Attribute;

use Magento\Catalog\Api\ProductAttributeIsFilterableManagementInterface;
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;

class IsFilterableManagement implements ProductAttributeIsFilterableManagementInterface
{
/**
* @var ProductAttributeRepositoryInterface
*/
private ProductAttributeRepositoryInterface $productAttributeRepository;

/**
* @param ProductAttributeRepositoryInterface $productAttributeRepository
*/
public function __construct(
ProductAttributeRepositoryInterface $productAttributeRepository
) {
$this->productAttributeRepository = $productAttributeRepository;
}

/**
* @inheritdoc
*/
public function get(string $attributeCode): int
{
$attribute = $this->productAttributeRepository->get($attributeCode);

return (int)$attribute->getIsFilterable();
}

/**
* @inheritdoc
*/
public function set(string $attributeCode, int $isFilterable): bool
{
$attribute = $this->productAttributeRepository->get($attributeCode);
$attribute->setIsFilterable($isFilterable);
$this->productAttributeRepository->save($attribute);

return true;
}
}
10 changes: 1 addition & 9 deletions app/code/Magento/Catalog/Model/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
*/
protected $instancesById = [];

/**
* @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
*/
protected $initializationHelper;

/**
* @var \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory
*/
Expand Down Expand Up @@ -195,7 +190,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
/**
* ProductRepository constructor.
* @param ProductFactory $productFactory
* @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper
* @param \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory
* @param ResourceModel\Product\CollectionFactory $collectionFactory
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
Expand Down Expand Up @@ -225,7 +219,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
*/
public function __construct(
ProductFactory $productFactory,
\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
\Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
Expand Down Expand Up @@ -253,7 +246,6 @@ public function __construct(
) {
$this->productFactory = $productFactory;
$this->collectionFactory = $collectionFactory;
$this->initializationHelper = $initializationHelper;
$this->searchResultsFactory = $searchResultsFactory;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->resourceModel = $resourceModel;
Expand Down Expand Up @@ -940,7 +932,7 @@ private function joinPositionField(
foreach ($filterGroup->getFilters() as $filter) {
if ($filter->getField() === 'category_id') {
$filterValue = $filter->getValue();
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue ?? '');
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue);
}
}
}
Expand Down
Loading

0 comments on commit c8fd019

Please sign in to comment.