Skip to content

Commit

Permalink
Merge branch '2.4-develop' into 2.4.0-develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php
  • Loading branch information
dvoskoboinikov committed Feb 7, 2020
2 parents dd41108 + ba8fae3 commit 506eb20
Show file tree
Hide file tree
Showing 254 changed files with 10,485 additions and 1,990 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
</test>
</tests>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ define([
*/
onError: function () {
self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized'));
self.reInitPayPal();
}
}, self.paypalButtonSelector);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCardinalCommerceSettingsHiddenTest">
<annotations>
<stories value="Cardinal Commerce Settings"/>
<features value="CardinalCommerce"/>
<title value="CardinalCommerce settings hidden" />
<description value="CardinalCommerce config shouldn't be visible if the 3D secure is disabled for Authorize.Net."/>
Expand Down
4 changes: 1 addition & 3 deletions app/code/Magento/Catalog/Block/Rss/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Class Category
*
* @package Magento\Catalog\Block\Rss
* Category feed block
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
Expand Down
28 changes: 18 additions & 10 deletions app/code/Magento/Catalog/Block/Rss/Product/NewProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
use Magento\Framework\App\Rss\DataProviderInterface;

/**
* Class NewProducts
* @package Magento\Catalog\Block\Rss\Product
* New products feed block
*/
class NewProducts extends \Magento\Framework\View\Element\AbstractBlock implements DataProviderInterface
{
Expand Down Expand Up @@ -55,6 +54,8 @@ public function __construct(
}

/**
* Init
*
* @return void
*/
protected function _construct()
Expand All @@ -64,15 +65,15 @@ protected function _construct()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function isAllowed()
{
return $this->_scopeConfig->isSetFlag('rss/catalog/new', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getRssData()
{
Expand All @@ -97,10 +98,13 @@ public function getRssData()
$item->setAllowedInRss(true);
$item->setAllowedPriceInRss(true);

$this->_eventManager->dispatch('rss_catalog_new_xml_callback', [
'row' => $item->getData(),
'product' => $item
]);
$this->_eventManager->dispatch(
'rss_catalog_new_xml_callback',
[
'row' => $item->getData(),
'product' => $item
]
);

if (!$item->getAllowedInRss()) {
continue;
Expand Down Expand Up @@ -132,6 +136,8 @@ public function getRssData()
}

/**
* Get store id
*
* @return int
*/
protected function getStoreId()
Expand Down Expand Up @@ -177,14 +183,16 @@ protected function renderPriceHtml(\Magento\Catalog\Model\Product $product)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCacheLifetime()
{
return 600;
}

/**
* Get feeds
*
* @return array
*/
public function getFeeds()
Expand All @@ -199,7 +207,7 @@ public function getFeeds()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function isAuthRequired()
{
Expand Down
15 changes: 11 additions & 4 deletions app/code/Magento/Catalog/Block/Rss/Product/Special.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
use Magento\Framework\App\Rss\DataProviderInterface;

/**
* Class Special
* @package Magento\Catalog\Block\Rss\Product
* Special products feed block
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Special extends \Magento\Framework\View\Element\AbstractBlock implements DataProviderInterface
Expand Down Expand Up @@ -98,6 +97,8 @@ public function __construct(
}

/**
* Init
*
* @return void
*/
protected function _construct()
Expand All @@ -107,6 +108,8 @@ protected function _construct()
}

/**
* Get RSS data
*
* @return array
*/
public function getRssData()
Expand Down Expand Up @@ -156,6 +159,8 @@ public function getRssData()
}

/**
* Get entry data
*
* @param \Magento\Catalog\Model\Product $item
* @return array
*/
Expand Down Expand Up @@ -245,14 +250,16 @@ public function isAllowed()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCacheLifetime()
{
return 600;
}

/**
* Get feeds
*
* @return array
*/
public function getFeeds()
Expand All @@ -266,7 +273,7 @@ public function getFeeds()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function isAuthRequired()
{
Expand Down
32 changes: 26 additions & 6 deletions app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
namespace Magento\Catalog\Block\Ui;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\ProductRenderFactory;
use Magento\Catalog\Model\ProductRepository;
use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorComposite;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\EntityManager\Hydrator;
use Magento\Framework\Registry;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\Url;
use Magento\Framework\View\Element\Template;
use Magento\Store\Model\Store;
use Magento\Catalog\Model\ProductRenderFactory;
use Magento\Catalog\Model\ProductRepository;
use Magento\Framework\EntityManager\Hydrator;
use Magento\Store\Model\StoreManager;

/**
Expand All @@ -25,6 +27,7 @@
*
* @api
* @since 101.1.0
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ProductViewCounter extends Template
{
Expand Down Expand Up @@ -68,6 +71,13 @@ class ProductViewCounter extends Template
*/
private $registry;

/**
* Core store config
*
* @var ScopeConfigInterface
*/
private $scopeConfig;

/**
* @param Template\Context $context
* @param ProductRepository $productRepository
Expand All @@ -78,6 +88,8 @@ class ProductViewCounter extends Template
* @param SerializerInterface $serialize
* @param Url $url
* @param Registry $registry
* @param ScopeConfigInterface|null $scopeConfig
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
Template\Context $context,
Expand All @@ -88,7 +100,8 @@ public function __construct(
Hydrator $hydrator,
SerializerInterface $serialize,
Url $url,
Registry $registry
Registry $registry,
?ScopeConfigInterface $scopeConfig = null
) {
parent::__construct($context);
$this->productRepository = $productRepository;
Expand All @@ -99,6 +112,7 @@ public function __construct(
$this->serialize = $serialize;
$this->url = $url;
$this->registry = $registry;
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
}

/**
Expand All @@ -116,14 +130,19 @@ public function getCurrentProductData()
{
/** @var ProductInterface $product */
$product = $this->registry->registry('product');
$productsScope = $this->scopeConfig->getValue(
'catalog/recently_products/scope',
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
);
/** @var Store $store */
$store = $this->storeManager->getStore();

if (!$product || !$product->getId()) {
return $this->serialize->serialize([
'items' => [],
'store' => $store->getId(),
'currency' => $store->getCurrentCurrency()->getCode()
'currency' => $store->getCurrentCurrency()->getCode(),
'productCurrentScope' => $productsScope
]);
}

Expand All @@ -140,7 +159,8 @@ public function getCurrentProductData()
$product->getId() => $data
],
'store' => $store->getId(),
'currency' => $store->getCurrentCurrency()->getCode()
'currency' => $store->getCurrentCurrency()->getCode(),
'productCurrentScope' => $productsScope
];

return $this->serialize->serialize($currentProductData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Framework\Exception\LocalizedException;

/**
* Class Upload
* Upload product image action controller
*/
class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterface
{
Expand Down
28 changes: 26 additions & 2 deletions app/code/Magento/Catalog/CustomerData/CompareProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
namespace Magento\Catalog\CustomerData;

use Magento\Customer\CustomerData\SectionSourceInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\LocalizedException;

/**
* Catalog Product Compare Widget
*/
class CompareProducts implements SectionSourceInterface
{
/**
Expand All @@ -24,23 +30,33 @@ class CompareProducts implements SectionSourceInterface
*/
private $outputHelper;

/**
* Core store config
*
* @var ScopeConfigInterface
*/
private $scopeConfig;

/**
* @param \Magento\Catalog\Helper\Product\Compare $helper
* @param \Magento\Catalog\Model\Product\Url $productUrl
* @param \Magento\Catalog\Helper\Output $outputHelper
* @param ScopeConfigInterface|null $scopeConfig
*/
public function __construct(
\Magento\Catalog\Helper\Product\Compare $helper,
\Magento\Catalog\Model\Product\Url $productUrl,
\Magento\Catalog\Helper\Output $outputHelper
\Magento\Catalog\Helper\Output $outputHelper,
?ScopeConfigInterface $scopeConfig = null
) {
$this->helper = $helper;
$this->productUrl = $productUrl;
$this->outputHelper = $outputHelper;
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getSectionData()
{
Expand All @@ -54,18 +70,26 @@ public function getSectionData()
}

/**
* Get the list of compared product items
*
* @return array
* @throws LocalizedException
*/
protected function getItems()
{
$items = [];
$productsScope = $this->scopeConfig->getValue(
'catalog/recently_products/scope',
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
);
/** @var \Magento\Catalog\Model\Product $item */
foreach ($this->helper->getItemCollection() as $item) {
$items[] = [
'id' => $item->getId(),
'product_url' => $this->productUrl->getUrl($item),
'name' => $this->outputHelper->productAttribute($item, $item->getName(), 'name'),
'remove_url' => $this->helper->getPostDataRemove($item),
'productScope' => $productsScope
];
}
return $items;
Expand Down
Loading

0 comments on commit 506eb20

Please sign in to comment.