![]()
getConfigView()->getMediaAttributes('Magento_Catalog', Image::MEDIA_TYPE_CONFIG_NODE, $imageId);
- return isset($attributes[$attributeName]) ? $attributes[$attributeName] : $default;
+ return $attributes[$attributeName] ?? $default;
}
/**
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Delete.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Delete.php
index 8f570e35989cb..0a54475b15f9c 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Delete.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Delete.php
@@ -44,12 +44,12 @@ public function execute()
$this->_eventManager->dispatch('catalog_controller_category_delete', ['category' => $category]);
$this->_auth->getAuthStorage()->setDeletedPath($category->getPath());
$this->categoryRepository->delete($category);
- $this->messageManager->addSuccess(__('You deleted the category.'));
+ $this->messageManager->addSuccessMessage(__('You deleted the category.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
return $resultRedirect->setPath('catalog/*/edit', ['_current' => true]);
} catch (\Exception $e) {
- $this->messageManager->addError(__('Something went wrong while trying to delete the category.'));
+ $this->messageManager->addErrorMessage(__('Something went wrong while trying to delete the category.'));
return $resultRedirect->setPath('catalog/*/edit', ['_current' => true]);
}
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php
index 775097c5eba1d..ca7652ebb43b5 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php
@@ -54,7 +54,7 @@ protected function _validateProducts()
}
if ($error) {
- $this->messageManager->addError($error);
+ $this->messageManager->addErrorMessage($error);
}
return !$error;
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
index 82496446aef9f..0fbf9054ef1bd 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
@@ -192,7 +192,7 @@ public function execute()
$this->_eventManager->dispatch('catalog_product_to_website_change', ['products' => $productIds]);
}
- $this->messageManager->addSuccess(
+ $this->messageManager->addSuccessMessage(
__('A total of %1 record(s) were updated.', count($this->attributeHelper->getProductIds()))
);
@@ -205,9 +205,9 @@ public function execute()
$this->_productPriceIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
}
} catch (\Magento\Framework\Exception\LocalizedException $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
- $this->messageManager->addException(
+ $this->messageManager->addExceptionMessage(
$e,
__('Something went wrong while updating the product(s) attributes.')
);
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php
index bb18436be6102..a873f08d082d7 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php
@@ -68,7 +68,7 @@ public function execute()
$response->setError(true);
$response->setMessage($e->getMessage());
} catch (\Exception $e) {
- $this->messageManager->addException(
+ $this->messageManager->addExceptionMessage(
$e,
__('Something went wrong while updating the product(s) attributes.')
);
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete.php
index cc5a658a9296d..bef6aee0e2afd 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete.php
@@ -21,23 +21,23 @@ public function execute()
// entity type check
$model->load($id);
if ($model->getEntityTypeId() != $this->_entityTypeId) {
- $this->messageManager->addError(__('We can\'t delete the attribute.'));
+ $this->messageManager->addErrorMessage(__('We can\'t delete the attribute.'));
return $resultRedirect->setPath('catalog/*/');
}
try {
$model->delete();
- $this->messageManager->addSuccess(__('You deleted the product attribute.'));
+ $this->messageManager->addSuccessMessage(__('You deleted the product attribute.'));
return $resultRedirect->setPath('catalog/*/');
} catch (\Exception $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
return $resultRedirect->setPath(
'catalog/*/edit',
['attribute_id' => $this->getRequest()->getParam('attribute_id')]
);
}
}
- $this->messageManager->addError(__('We can\'t find an attribute to delete.'));
+ $this->messageManager->addErrorMessage(__('We can\'t find an attribute to delete.'));
return $resultRedirect->setPath('catalog/*/');
}
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Edit.php
index fd97aaa50389e..a99cbdbade181 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Edit.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Edit.php
@@ -25,14 +25,14 @@ public function execute()
$model->load($id);
if (!$model->getId()) {
- $this->messageManager->addError(__('This attribute no longer exists.'));
+ $this->messageManager->addErrorMessage(__('This attribute no longer exists.'));
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('catalog/*/');
}
// entity type check
if ($model->getEntityTypeId() != $this->_entityTypeId) {
- $this->messageManager->addError(__('This attribute cannot be edited.'));
+ $this->messageManager->addErrorMessage(__('This attribute cannot be edited.'));
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('catalog/*/');
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Duplicate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Duplicate.php
index 7e8b03a66f603..63e52eead064c 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Duplicate.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Duplicate.php
@@ -43,11 +43,11 @@ public function execute()
$product = $this->productBuilder->build($this->getRequest());
try {
$newProduct = $this->productCopier->copy($product);
- $this->messageManager->addSuccess(__('You duplicated the product.'));
+ $this->messageManager->addSuccessMessage(__('You duplicated the product.'));
$resultRedirect->setPath('catalog/*/edit', ['_current' => true, 'id' => $newProduct->getId()]);
} catch (\Exception $e) {
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
$resultRedirect->setPath('catalog/*/edit', ['_current' => true]);
}
return $resultRedirect;
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php
index 838bce7272250..1b9316a95ad59 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php
@@ -52,12 +52,12 @@ public function execute()
if (($productId && !$product->getEntityId())) {
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
- $this->messageManager->addError(__('This product doesn\'t exist.'));
+ $this->messageManager->addErrorMessage(__('This product doesn\'t exist.'));
return $resultRedirect->setPath('catalog/*/');
} elseif ($productId === 0) {
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
- $this->messageManager->addError(__('Invalid product id. Should be numeric value greater than 0'));
+ $this->messageManager->addErrorMessage(__('Invalid product id. Should be numeric value greater than 0'));
return $resultRedirect->setPath('catalog/*/');
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group/Save.php
index 4909e22775e55..8a5f375f2b706 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group/Save.php
@@ -29,12 +29,12 @@ public function execute()
);
if ($model->itemExists()) {
- $this->messageManager->addError(__('A group with the same name already exists.'));
+ $this->messageManager->addErrorMessage(__('A group with the same name already exists.'));
} else {
try {
$model->save();
} catch (\Exception $e) {
- $this->messageManager->addError(__('Something went wrong while saving this group.'));
+ $this->messageManager->addErrorMessage(__('Something went wrong while saving this group.'));
}
}
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php
index b49a4dabe223c..f2695311732f0 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php
@@ -36,10 +36,10 @@ public function execute()
$resultRedirect = $this->resultRedirectFactory->create();
try {
$this->attributeSetRepository->deleteById($setId);
- $this->messageManager->addSuccess(__('The attribute set has been removed.'));
+ $this->messageManager->addSuccessMessage(__('The attribute set has been removed.'));
$resultRedirect->setPath('catalog/*/');
} catch (\Exception $e) {
- $this->messageManager->addError(__('We can\'t delete this set right now.'));
+ $this->messageManager->addErrorMessage(__('We can\'t delete this set right now.'));
$resultRedirect->setUrl($this->_redirect->getRedirectUrl($this->getUrl('*')));
}
return $resultRedirect;
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
index dfddcf7e92b97..c5dd9ce6d8e77 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
@@ -127,15 +127,15 @@ public function execute()
$model->initFromSkeleton($this->getRequest()->getParam('skeleton_set'));
}
$model->save();
- $this->messageManager->addSuccess(__('You saved the attribute set.'));
+ $this->messageManager->addSuccessMessage(__('You saved the attribute set.'));
} catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
$hasError = true;
} catch (\Magento\Framework\Exception\LocalizedException $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
$hasError = true;
} catch (\Exception $e) {
- $this->messageManager->addException($e, __('Something went wrong while saving the attribute set.'));
+ $this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the attribute set.'));
$hasError = true;
}
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php
index 63f46fd32e6f7..e131bfe38c546 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php
@@ -137,7 +137,7 @@ public function execute()
$response->setError(true);
$response->setMessages([$e->getMessage()]);
} catch (\Exception $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
$layout = $this->layoutFactory->create();
$layout->initMessages();
$response->setError(true);
diff --git a/app/code/Magento/Catalog/Controller/Product/Compare/Clear.php b/app/code/Magento/Catalog/Controller/Product/Compare/Clear.php
index 30470d13f002d..568fbf1d05677 100644
--- a/app/code/Magento/Catalog/Controller/Product/Compare/Clear.php
+++ b/app/code/Magento/Catalog/Controller/Product/Compare/Clear.php
@@ -30,12 +30,12 @@ public function execute()
try {
$items->clear();
- $this->messageManager->addSuccess(__('You cleared the comparison list.'));
+ $this->messageManager->addSuccessMessage(__('You cleared the comparison list.'));
$this->_objectManager->get(\Magento\Catalog\Helper\Product\Compare::class)->calculate();
} catch (\Magento\Framework\Exception\LocalizedException $e) {
- $this->messageManager->addError($e->getMessage());
+ $this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
- $this->messageManager->addException($e, __('Something went wrong clearing the comparison list.'));
+ $this->messageManager->addExceptionMessage($e, __('Something went wrong clearing the comparison list.'));
}
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
diff --git a/app/code/Magento/Catalog/Controller/Product/Compare/Remove.php b/app/code/Magento/Catalog/Controller/Product/Compare/Remove.php
index fadb94761a236..2acbe5ce4d582 100644
--- a/app/code/Magento/Catalog/Controller/Product/Compare/Remove.php
+++ b/app/code/Magento/Catalog/Controller/Product/Compare/Remove.php
@@ -44,7 +44,7 @@ public function execute()
$item->delete();
$productName = $this->_objectManager->get(\Magento\Framework\Escaper::class)
->escapeHtml($product->getName());
- $this->messageManager->addSuccess(
+ $this->messageManager->addSuccessMessage(
__('You removed product %1 from the comparison list.', $productName)
);
$this->_eventManager->dispatch(
diff --git a/app/code/Magento/Catalog/Controller/Product/View.php b/app/code/Magento/Catalog/Controller/Product/View.php
index 4c577eb897589..ed437361fddd3 100644
--- a/app/code/Magento/Catalog/Controller/Product/View.php
+++ b/app/code/Magento/Catalog/Controller/Product/View.php
@@ -78,13 +78,16 @@ public function execute()
if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) {
$product = $this->_initProduct();
+
if (!$product) {
return $this->noProductRedirect();
}
+
if ($specifyOptions) {
$notice = $product->getTypeInstance()->getSpecifyOptionMessage();
- $this->messageManager->addNotice($notice);
+ $this->messageManager->addNoticeMessage($notice);
}
+
if ($this->getRequest()->isAjax()) {
$this->getResponse()->representJson(
$this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)->jsonEncode([
diff --git a/app/code/Magento/Catalog/Cron/FrontendActionsFlush.php b/app/code/Magento/Catalog/Cron/FrontendActionsFlush.php
index 6e7699abb4776..99e9898eab3c0 100644
--- a/app/code/Magento/Catalog/Cron/FrontendActionsFlush.php
+++ b/app/code/Magento/Catalog/Cron/FrontendActionsFlush.php
@@ -57,8 +57,7 @@ private function getLifeTimeByNamespace($namespace)
];
}
- return isset($configuration['lifetime']) ?
- (int) $configuration['lifetime'] : FrontendStorageConfigurationInterface::DEFAULT_LIFETIME;
+ return (int)$configuration['lifetime'] ?? FrontendStorageConfigurationInterface::DEFAULT_LIFETIME;
}
/**
diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php
index 9eebcdb2df34f..ae20cda460796 100644
--- a/app/code/Magento/Catalog/Helper/Data.php
+++ b/app/code/Magento/Catalog/Helper/Data.php
@@ -32,6 +32,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
const CONFIG_USE_STATIC_URLS = 'cms/wysiwyg/use_static_urls_in_catalog';
+ /**
+ * @deprecated
+ * @see \Magento\Catalog\Helper\Output::isDirectivesExists
+ */
const CONFIG_PARSE_URL_DIRECTIVES = 'catalog/frontend/parse_url_directives';
const XML_PATH_DISPLAY_PRODUCT_COUNT = 'catalog/layered_navigation/display_product_count';
@@ -443,6 +447,8 @@ public function isUsingStaticUrlsAllowed()
* Check if the parsing of URL directives is allowed for the catalog
*
* @return bool
+ * @deprecated
+ * @see \Magento\Catalog\Helper\Output::isDirectivesExists
*/
public function isUrlDirectivesParsingAllowed()
{
@@ -457,6 +463,7 @@ public function isUrlDirectivesParsingAllowed()
* Retrieve template processor for catalog content
*
* @return \Magento\Framework\Filter\Template
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function getPageTemplateProcessor()
{
diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php
index 4f128d639b2bb..758e59790d241 100644
--- a/app/code/Magento/Catalog/Helper/Image.php
+++ b/app/code/Magento/Catalog/Helper/Image.php
@@ -859,7 +859,7 @@ public function getFrame()
*/
protected function getAttribute($name)
{
- return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
+ return $this->attributes[$name] ?? null;
}
/**
diff --git a/app/code/Magento/Catalog/Helper/Output.php b/app/code/Magento/Catalog/Helper/Output.php
index facd5351f269a..33e261dc353b4 100644
--- a/app/code/Magento/Catalog/Helper/Output.php
+++ b/app/code/Magento/Catalog/Helper/Output.php
@@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Catalog\Helper;
use Magento\Catalog\Model\Category as ModelCategory;
@@ -45,20 +47,29 @@ class Output extends \Magento\Framework\App\Helper\AbstractHelper
protected $_escaper;
/**
+ * @var array
+ */
+ private $directivePatterns;
+
+ /**
+ * Output constructor.
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Eav\Model\Config $eavConfig
* @param Data $catalogData
* @param \Magento\Framework\Escaper $escaper
+ * @param array $directivePatterns
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Eav\Model\Config $eavConfig,
Data $catalogData,
- \Magento\Framework\Escaper $escaper
+ \Magento\Framework\Escaper $escaper,
+ $directivePatterns = []
) {
$this->_eavConfig = $eavConfig;
$this->_catalogData = $catalogData;
$this->_escaper = $escaper;
+ $this->directivePatterns = $directivePatterns;
parent::__construct($context);
}
@@ -105,7 +116,7 @@ public function addHandler($method, $handler)
public function getHandlers($method)
{
$method = strtolower($method);
- return isset($this->_handlers[$method]) ? $this->_handlers[$method] : [];
+ return $this->_handlers[$method] ?? [];
}
/**
@@ -134,6 +145,7 @@ public function process($method, $result, $params)
* @param string $attributeName
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function productAttribute($product, $attributeHtml, $attributeName)
{
@@ -151,10 +163,12 @@ public function productAttribute($product, $attributeHtml, $attributeName)
$attributeHtml = nl2br($attributeHtml);
}
}
- if ($attribute->getIsHtmlAllowedOnFront() && $attribute->getIsWysiwygEnabled()) {
- if ($this->_catalogData->isUrlDirectivesParsingAllowed()) {
- $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
- }
+ if ($attributeHtml !== null
+ && $attribute->getIsHtmlAllowedOnFront()
+ && $attribute->getIsWysiwygEnabled()
+ && $this->isDirectivesExists($attributeHtml)
+ ) {
+ $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
}
$attributeHtml = $this->process(
@@ -173,6 +187,7 @@ public function productAttribute($product, $attributeHtml, $attributeName)
* @param string $attributeHtml
* @param string $attributeName
* @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function categoryAttribute($category, $attributeHtml, $attributeName)
{
@@ -185,10 +200,13 @@ public function categoryAttribute($category, $attributeHtml, $attributeName)
) {
$attributeHtml = $this->_escaper->escapeHtml($attributeHtml);
}
- if ($attribute->getIsHtmlAllowedOnFront() && $attribute->getIsWysiwygEnabled()) {
- if ($this->_catalogData->isUrlDirectivesParsingAllowed()) {
- $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
- }
+ if ($attributeHtml !== null
+ && $attribute->getIsHtmlAllowedOnFront()
+ && $attribute->getIsWysiwygEnabled()
+ && $this->isDirectivesExists($attributeHtml)
+
+ ) {
+ $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
}
$attributeHtml = $this->process(
'categoryAttribute',
@@ -197,4 +215,22 @@ public function categoryAttribute($category, $attributeHtml, $attributeName)
);
return $attributeHtml;
}
+
+ /**
+ * Check if string has directives
+ *
+ * @param string $attributeHtml
+ * @return bool
+ */
+ public function isDirectivesExists($attributeHtml)
+ {
+ $matches = false;
+ foreach ($this->directivePatterns as $pattern) {
+ if (preg_match($pattern, $attributeHtml)) {
+ $matches = true;
+ break;
+ }
+ }
+ return $matches;
+ }
}
diff --git a/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/NativeAttributeCondition.php b/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/NativeAttributeCondition.php
index d072acf4c719c..71b9a9c470374 100644
--- a/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/NativeAttributeCondition.php
+++ b/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/NativeAttributeCondition.php
@@ -77,7 +77,7 @@ private function mapConditionType(string $conditionType, string $field): string
];
}
- return isset($conditionsMap[$conditionType]) ? $conditionsMap[$conditionType] : $conditionType;
+ return $conditionsMap[$conditionType] ?? $conditionType;
}
/**
diff --git a/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php b/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php
index f8cf810ffb570..8de708dd467c8 100644
--- a/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php
+++ b/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php
@@ -21,8 +21,13 @@ class ProductCategoryFilter implements CustomFilterInterface
*/
public function apply(Filter $filter, AbstractDb $collection)
{
- $conditionType = $filter->getConditionType() ?: 'eq';
- $categoryFilter = [$conditionType => [$filter->getValue()]];
+ $value = $filter->getValue();
+ $conditionType = $filter->getConditionType() ?: 'in';
+ $filterValue = [$value];
+ if (($conditionType === 'in' || $conditionType === 'nin') && is_string($value)) {
+ $filterValue = explode(',', $value);
+ }
+ $categoryFilter = [$conditionType => $filterValue];
/** @var Collection $collection */
$collection->addCategoriesFilter($categoryFilter);
diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php
index d2ffd6f440041..5dce940308a4f 100644
--- a/app/code/Magento/Catalog/Model/Config.php
+++ b/app/code/Magento/Catalog/Model/Config.php
@@ -381,7 +381,7 @@ public function getProductTypeName($id)
$this->loadProductTypes();
- return isset($this->_productTypesById[$id]) ? $this->_productTypesById[$id] : false;
+ return $this->_productTypesById[$id] ?? false;
}
/**
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php
index 09dbed350c5e4..f8121b55dbf99 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php
@@ -8,6 +8,7 @@
use Magento\Catalog\Model\ResourceModel\Indexer\ActiveTableSwitcher;
use Magento\Framework\DB\Query\Generator as QueryGenerator;
use Magento\Framework\App\ResourceConnection;
+use Magento\Indexer\Model\ProcessManager;
/**
* Class Full reindex action
@@ -44,6 +45,11 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio
*/
private $activeTableSwitcher;
+ /**
+ * @var ProcessManager
+ */
+ private $processManager;
+
/**
* @param ResourceConnection $resource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -52,9 +58,10 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio
* @param \Magento\Framework\Indexer\BatchSizeManagementInterface|null $batchSizeManagement
* @param \Magento\Framework\Indexer\BatchProviderInterface|null $batchProvider
* @param \Magento\Framework\EntityManager\MetadataPool|null $metadataPool
- * @param \Magento\Indexer\Model\Indexer\StateFactory|null $stateFactory
* @param int|null $batchRowsCount
* @param ActiveTableSwitcher|null $activeTableSwitcher
+ * @param ProcessManager $processManager
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Framework\App\ResourceConnection $resource,
@@ -65,7 +72,8 @@ public function __construct(
\Magento\Framework\Indexer\BatchProviderInterface $batchProvider = null,
\Magento\Framework\EntityManager\MetadataPool $metadataPool = null,
$batchRowsCount = null,
- ActiveTableSwitcher $activeTableSwitcher = null
+ ActiveTableSwitcher $activeTableSwitcher = null,
+ ProcessManager $processManager = null
) {
parent::__construct(
$resource,
@@ -85,6 +93,7 @@ public function __construct(
);
$this->batchRowsCount = $batchRowsCount;
$this->activeTableSwitcher = $activeTableSwitcher ?: $objectManager->get(ActiveTableSwitcher::class);
+ $this->processManager = $processManager ?: $objectManager->get(ProcessManager::class);
}
/**
@@ -133,6 +142,38 @@ public function execute()
return $this;
}
+ /**
+ * Run reindexation
+ *
+ * @return void
+ */
+ protected function reindex()
+ {
+ $userFunctions = [];
+
+ foreach ($this->storeManager->getStores() as $store) {
+ if ($this->getPathFromCategoryId($store->getRootCategoryId())) {
+ $userFunctions[$store->getId()] = function () use ($store) {
+ return $this->reindexStore($store);
+ };
+ }
+ }
+
+ $this->processManager->execute($userFunctions);
+ }
+
+ /**
+ * Execute indexation by store
+ *
+ * @param \Magento\Store\Model\Store $store
+ */
+ private function reindexStore($store)
+ {
+ $this->reindexRootCategory($store);
+ $this->reindexAnchorCategories($store);
+ $this->reindexNonAnchorCategories($store);
+ }
+
/**
* Publish data from tmp to replica table
*
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/TableMaintainer.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/TableMaintainer.php
index 1278434fcad43..105a6dbf30456 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/TableMaintainer.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/TableMaintainer.php
@@ -139,7 +139,7 @@ public function getMainTable(int $storeId)
public function createTablesForStore(int $storeId)
{
$mainTableName = $this->getMainTable($storeId);
- //Create index table for store based on on main replica table
+ //Create index table for store based on main replica table
//Using main replica table is necessary for backward capability and TableResolver plugin work
$this->createTable(
$this->getTable(AbstractAction::MAIN_INDEX_TABLE . $this->additionalTableSuffix),
diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php
index a4db630f0234b..d21a8666ec0ac 100644
--- a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php
+++ b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php
@@ -241,7 +241,7 @@ protected function _createItem($label, $value, $count = 0)
}
/**
- * Get all product ids from from collection with applied filters
+ * Get all product ids from collection with applied filters
*
* @return array
*/
diff --git a/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverComposite.php b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverComposite.php
new file mode 100644
index 0000000000000..68d0877c6cd66
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverComposite.php
@@ -0,0 +1,61 @@
+itemResolvers = $itemResolvers;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFinalProduct(ItemInterface $item) : ProductInterface
+ {
+ $finalProduct = $item->getProduct();
+ foreach ($this->itemResolvers as $resolver) {
+ $resolvedProduct = $this->getItemResolverInstance($resolver)->getFinalProduct($item);
+ if ($resolvedProduct !== $finalProduct) {
+ $finalProduct = $resolvedProduct;
+ break;
+ }
+ }
+ return $finalProduct;
+ }
+
+ /**
+ * Get the instance of the item resolver by class name.
+ *
+ * @param string $className
+ * @return ItemResolverInterface
+ */
+ private function getItemResolverInstance(string $className) : ItemResolverInterface
+ {
+ if (!isset($this->itemResolversInstances[$className])) {
+ $this->itemResolversInstances[$className] = ObjectManager::getInstance()->get($className);
+ }
+ return $this->itemResolversInstances[$className];
+ }
+}
diff --git a/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverInterface.php b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverInterface.php
new file mode 100644
index 0000000000000..35c0a7835cb6c
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverInterface.php
@@ -0,0 +1,26 @@
+ self::OPTION_GROUP_DATE,
];
- return isset($optionGroupsToTypes[$type]) ? $optionGroupsToTypes[$type] : '';
+ return $optionGroupsToTypes[$type] ?? '';
}
/**
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
index 2390a049fbeb6..c388be8b6f394 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
@@ -279,7 +279,7 @@ public function getFormattedOptionValue($optionValue)
*/
public function getCustomizedView($optionInfo)
{
- return isset($optionInfo['value']) ? $optionInfo['value'] : $optionInfo;
+ return $optionInfo['value'] ?? $optionInfo;
}
/**
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Validator/Pool.php b/app/code/Magento/Catalog/Model/Product/Option/Validator/Pool.php
index 1e00654249556..2256f031098f1 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Validator/Pool.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Validator/Pool.php
@@ -29,6 +29,6 @@ public function __construct(array $validators)
*/
public function get($type)
{
- return isset($this->validators[$type]) ? $this->validators[$type] : $this->validators['default'];
+ return $this->validators[$type] ?? $this->validators['default'];
}
}
diff --git a/app/code/Magento/Catalog/Model/Product/Type.php b/app/code/Magento/Catalog/Model/Product/Type.php
index dc3971397acb2..7be199884be1f 100644
--- a/app/code/Magento/Catalog/Model/Product/Type.php
+++ b/app/code/Magento/Catalog/Model/Product/Type.php
@@ -232,7 +232,7 @@ public function getOptions()
public function getOptionText($optionId)
{
$options = $this->getOptionArray();
- return isset($options[$optionId]) ? $options[$optionId] : null;
+ return $options[$optionId] ?? null;
}
/**
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
index 9b87515450a12..0189263d7cdfb 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
@@ -913,7 +913,7 @@ private function mapConditionType($conditionType)
'eq' => 'in',
'neq' => 'nin'
];
- return isset($conditionsMap[$conditionType]) ? $conditionsMap[$conditionType] : $conditionType;
+ return $conditionsMap[$conditionType] ?? $conditionType;
}
/**
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php
index 4775b96e3a448..179da06b59990 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php
@@ -307,7 +307,7 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje
}
/**
- * Get first col from from first row for option table
+ * Get first col from first row for option table
*
* @param string $tableName
* @param int $optionId
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php
index 91bb99ca971a7..4ebcd1f4b9ae4 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php
@@ -300,7 +300,7 @@ protected function _saveValueTitles(AbstractModel $object)
}
/**
- * Get first col from from first row for option table
+ * Get first col from first row for option table
*
* @param string $tableName
* @param int $optionId
diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/DisallowUsingHtmlForProductName.php b/app/code/Magento/Catalog/Setup/Patch/Data/DisallowUsingHtmlForProductName.php
index ea8f6bbf39b31..226b94ceb1749 100644
--- a/app/code/Magento/Catalog/Setup/Patch/Data/DisallowUsingHtmlForProductName.php
+++ b/app/code/Magento/Catalog/Setup/Patch/Data/DisallowUsingHtmlForProductName.php
@@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-
+declare(strict_types=1);
namespace Magento\Catalog\Setup\Patch\Data;
use Magento\Catalog\Setup\CategorySetupFactory;
diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/EnableDirectiveParsing.php b/app/code/Magento/Catalog/Setup/Patch/Data/EnableDirectiveParsing.php
new file mode 100644
index 0000000000000..f881b2f49f600
--- /dev/null
+++ b/app/code/Magento/Catalog/Setup/Patch/Data/EnableDirectiveParsing.php
@@ -0,0 +1,67 @@
+moduleDataSetup = $moduleDataSetup;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function apply()
+ {
+ $configTable = $this->moduleDataSetup->getTable('core_config_data');
+ $select = $this->moduleDataSetup->getConnection()->select()
+ ->from($configTable)
+ ->where('path = ?', 'catalog/frontend/parse_url_directives');
+ $config = $this->moduleDataSetup->getConnection()->fetchAll($select);
+ if (!empty($config)) {
+ $this->moduleDataSetup->getConnection()->update(
+ $configTable,
+ ['value' => '1'],
+ ['path = ?' => 'catalog/frontend/parse_url_directives', 'value IN (?)' => '0']
+ );
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getDependencies()
+ {
+ return [];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAliases()
+ {
+ return [];
+ }
+}
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml
index f64812fd5bf49..bca6ae2b60bf3 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml
@@ -181,6 +181,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml
index 25f059c84f4ef..4376e78242fbd 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml
@@ -45,4 +45,9 @@
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
index ccb5da7a6af6f..48313230ff1ca 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
@@ -197,6 +197,15 @@
magento-logo
png
+
+ magento-again
+ 1.00
+ Upload File
+ Yes
+ magento-again.jpg
+ magento-again
+ jpg
+
霁产品
simple
diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml
index 35fa00efcfe8e..be7c44e378f08 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml
@@ -16,5 +16,6 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml
new file mode 100644
index 0000000000000..1042b1e5a5464
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml
index de3c2b731a3d5..98afed124c698 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml
@@ -28,5 +28,6 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml
index 4892e25818e2c..19b3a5cc127a7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml
@@ -23,6 +23,10 @@
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoDetailsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoDetailsSection.xml
index 40f49fc2cc77b..5688811cb96a6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoDetailsSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoDetailsSection.xml
@@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
index 7e1bec48aeebc..42ca3836e6c1c 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
@@ -14,6 +14,7 @@
+
@@ -63,5 +64,10 @@
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml
new file mode 100644
index 0000000000000..902f51c4a15a7
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml
@@ -0,0 +1,271 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $1,000.00
+ grabTextFromSubtotalField1
+
+
+
+
+
+
+ $1,350.00
+ grabTextFromSubtotalField2
+
+
+
+
+
+
+ $1,640.00
+ grabTextFromSubtotalField3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $1,500.00
+ grabTextFromSubtotalField4
+
+
+
+ $1,500.00
+ grabTextFromCheckoutCartSummarySectionSubtotal1
+
+
+
+
+
+ $1,500.00
+ grabTextFromMiniCartSubtotalField
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $1,500.00
+ grabTextFromSubtotalField5
+
+
+
+
+
+
+
+
+
+
+
+
+ $1,500.00
+ grabTextFromSubtotalField6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $4,000.00
+ grabTextFromSubtotalField7
+
+
+
+ $4,000.00
+ grabTextFromCheckoutCartSummarySectionSubtotal2
+
+
+
+
+
+ $4,000.00
+ grabTextFromMiniCartSubtotalField2
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php
index 942a87ce3414f..157c72fcedf10 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php
@@ -66,7 +66,7 @@ public function testApplyWithoutCondition()
$collectionMock->expects($this->once())
->method('addCategoriesFilter')
- ->with(['eq' => ['value']]);
+ ->with(['in' => ['value']]);
$this->assertTrue($this->model->apply($filterMock, $collectionMock));
}
diff --git a/app/code/Magento/Catalog/Ui/Component/FilterFactory.php b/app/code/Magento/Catalog/Ui/Component/FilterFactory.php
index fcc500c891607..dd8eaffb0a658 100644
--- a/app/code/Magento/Catalog/Ui/Component/FilterFactory.php
+++ b/app/code/Magento/Catalog/Ui/Component/FilterFactory.php
@@ -71,8 +71,6 @@ public function create($attribute, $context, $config = [])
*/
protected function getFilterType($attribute)
{
- return isset($this->filterMap[$attribute->getFrontendInput()])
- ? $this->filterMap[$attribute->getFrontendInput()]
- : $this->filterMap['default'];
+ return $this->filterMap[$attribute->getFrontendInput()] ?? $this->filterMap['default'];
}
}
diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php
index c96498b054d25..8ea6d8b9e5a06 100644
--- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php
+++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns.php
@@ -80,6 +80,6 @@ public function prepare()
*/
protected function getFilterType($frontendInput)
{
- return isset($this->filterMap[$frontendInput]) ? $this->filterMap[$frontendInput] : $this->filterMap['default'];
+ return $this->filterMap[$frontendInput] ?? $this->filterMap['default'];
}
}
diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php
index 7cd81419c0347..34e4c7afda989 100755
--- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php
+++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php
@@ -854,7 +854,7 @@ private function getFormElementsMapValue($value)
{
$valueMap = $this->formElementMapper->getMappings();
- return isset($valueMap[$value]) ? $valueMap[$value] : $value;
+ return $valueMap[$value] ?? $value;
}
/**
diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml
index e6dbb10e811b4..71a799fd22427 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/system.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml
@@ -92,18 +92,12 @@
Whether to show "All" option in the "Show X Per Page" dropdown
Magento\Config\Model\Config\Source\Yesno
-
-
- E.g. {{media url="path/to/image.jpg"}} {{skin url="path/to/picture.gif"}}. Dynamic directives parsing impacts catalog performance.
- Magento\Config\Model\Config\Source\Yesno
-
1
Magento\Catalog\Model\Config\CatalogClone\Media\Image
-
Magento\Config\Model\Config\Backend\Image
catalog/product/placeholder
catalog/product/placeholder
diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml
index 9f1fb020ef95a..c9e18e7b8c823 100644
--- a/app/code/Magento/Catalog/etc/di.xml
+++ b/app/code/Magento/Catalog/etc/di.xml
@@ -70,7 +70,8 @@
-
+
+
@@ -173,10 +174,17 @@
- Magento\Catalog\Model\Template\Filter
+ Magento\Widget\Model\Template\Filter
Magento\Catalog\Model\Session\Proxy
+
+
+
+ - \Magento\Framework\Filter\Template::CONSTRUCTION_PATTERN
+
+
+
9,15,30
diff --git a/app/code/Magento/Catalog/etc/widget.xml b/app/code/Magento/Catalog/etc/widget.xml
index a11d206e2ce42..f3b37d7d32e31 100644
--- a/app/code/Magento/Catalog/etc/widget.xml
+++ b/app/code/Magento/Catalog/etc/widget.xml
@@ -296,7 +296,7 @@
-
+
diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv
index f2a7cf0b1950b..a399f67e3130f 100644
--- a/app/code/Magento/Catalog/i18n/en_US.csv
+++ b/app/code/Magento/Catalog/i18n/en_US.csv
@@ -658,7 +658,6 @@ Comma-separated.,Comma-separated.
"Product Listing Sort by","Product Listing Sort by"
"Allow All Products per Page","Allow All Products per Page"
"Whether to show ""All"" option in the ""Show X Per Page"" dropdown","Whether to show ""All"" option in the ""Show X Per Page"" dropdown"
-"Allow Dynamic Media URLs","Allow Dynamic Media URLs"
"E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance.","E.g. {{media url=""path/to/image.jpg""}} {{skin url=""path/to/picture.gif""}}. Dynamic directives parsing impacts catalog performance."
"Product Image Placeholders","Product Image Placeholders"
"Search Engine Optimization","Search Engine Optimization"
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js b/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js
index 475c9d2dc0601..94300e31f74b5 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js
@@ -67,10 +67,10 @@ define([
},
/**
- * Has weight swither
+ * Has weight switcher
* @returns {*}
*/
- hasWeightSwither: function () {
+ hasWeightSwitcher: function () {
return this.$weightSwitcher().is(':visible');
},
@@ -107,7 +107,7 @@ define([
'Magento_Catalog/js/product/weight-handler': function () {
this.bindAll();
- if (this.hasWeightSwither()) {
+ if (this.hasWeightSwitcher()) {
this.switchWeight();
}
},
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html
index 04b4990f9cace..bf17624517f2a 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html
+++ b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html
@@ -14,7 +14,8 @@
event="load: $parent.onPreviewLoad.bind($parent)"
attr="
src: $parent.getFilePreview($file),
- alt: $file.name">
+ alt: $file.name,
+ title: $file.name">