Skip to content

Commit b2fcaba

Browse files
committed
Merge remote-tracking branch 'frontend/develop' into MAGETWO-58802
2 parents 7003b2f + a3adb88 commit b2fcaba

File tree

88 files changed

+1068
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1068
-109
lines changed

app/code/Magento/Backend/Block/Widget/Form/Container.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class Container extends \Magento\Backend\Block\Widget\Container
3737
* @var string
3838
*/
3939
protected $_blockGroup = 'Magento_Backend';
40+
41+
/**
42+
* @var string
43+
*/
44+
const PARAM_BLOCK_GROUP = 'block_group';
45+
46+
/**
47+
* @var string
48+
*/
49+
const PARAM_MODE = 'mode';
4050

4151
/**
4252
* @var string
@@ -49,6 +59,12 @@ class Container extends \Magento\Backend\Block\Widget\Container
4959
protected function _construct()
5060
{
5161
parent::_construct();
62+
if ($this->hasData(self::PARAM_BLOCK_GROUP)) {
63+
$this->_blockGroup = $this->_getData(self::PARAM_BLOCK_GROUP);
64+
}
65+
if ($this->hasData(self::PARAM_MODE)) {
66+
$this->_mode = $this->_getData(self::PARAM_MODE);
67+
}
5268

5369
$this->addButton(
5470
'back',

app/code/Magento/Catalog/Model/Product.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ public function getIdentities()
22742274
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
22752275
}
22762276
}
2277-
2277+
22782278
if (($this->getOrigData('status') != $this->getData('status')) || $this->isStockStatusChanged()) {
22792279
foreach ($this->getCategoryIds() as $categoryId) {
22802280
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
@@ -2289,7 +2289,7 @@ public function getIdentities()
22892289

22902290
/**
22912291
* Check whether stock status changed
2292-
*
2292+
*
22932293
* @return bool
22942294
*/
22952295
private function isStockStatusChanged()
@@ -2307,7 +2307,7 @@ private function isStockStatusChanged()
23072307
&& ($stockItem->getIsInStock() != $stockData['is_in_stock'])
23082308
);
23092309
}
2310-
2310+
23112311
/**
23122312
* Reload PriceInfo object
23132313
*

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ public function export()
817817
while (true) {
818818
++$page;
819819
$entityCollection = $this->_getEntityCollection(true);
820-
$entityCollection->setOrder('has_options', 'asc');
820+
$entityCollection->setOrder('entity_id', 'asc');
821821
$entityCollection->setStoreId(Store::DEFAULT_STORE_ID);
822822
$this->_prepareEntityCollection($entityCollection);
823823
$this->paginateCollection($page, $this->getItemsPerPage());

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,10 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
561561
/** @var array */
562562
protected $productUrlSuffix = [];
563563

564-
/** @var array */
564+
/**
565+
* @var array
566+
* @deprecated
567+
*/
565568
protected $productUrlKeys = [];
566569

567570
/**
@@ -1508,6 +1511,10 @@ protected function _saveProducts()
15081511
}
15091512
$rowScope = $this->getRowScope($rowData);
15101513

1514+
if (empty($rowData[self::URL_KEY])) {
1515+
$rowData[self::URL_KEY] = $this->getUrlKey($rowData);
1516+
}
1517+
15111518
$rowSku = $rowData[self::COL_SKU];
15121519

15131520
if (null === $rowSku) {
@@ -2562,12 +2569,14 @@ protected function getProductUrlSuffix($storeId = null)
25622569
protected function getUrlKey($rowData)
25632570
{
25642571
if (!empty($rowData[self::URL_KEY])) {
2565-
$this->productUrlKeys[$rowData[self::COL_SKU]] = $rowData[self::URL_KEY];
2572+
return $rowData[self::URL_KEY];
2573+
}
2574+
2575+
if (!empty($rowData[self::COL_NAME])) {
2576+
return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
25662577
}
2567-
$urlKey = !empty($this->productUrlKeys[$rowData[self::COL_SKU]])
2568-
? $this->productUrlKeys[$rowData[self::COL_SKU]]
2569-
: $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
2570-
return $urlKey;
2578+
2579+
return '';
25712580
}
25722581

25732582
/**

app/code/Magento/CatalogImportExport/Test/Unit/Model/Export/ProductTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public function testExportCountZeroBreakInternalCalls()
403403
$this->product->expects($this->once())->method('_prepareEntityCollection')->with($this->abstractCollection);
404404
$this->product->expects($this->once())->method('getItemsPerPage')->willReturn($itemsPerPage);
405405
$this->product->expects($this->once())->method('paginateCollection')->with($page, $itemsPerPage);
406-
$this->abstractCollection->expects($this->once())->method('setOrder')->with('has_options', 'asc');
406+
$this->abstractCollection->expects($this->once())->method('setOrder')->with('entity_id', 'asc');
407407
$this->abstractCollection->expects($this->once())->method('setStoreId')->with(Store::DEFAULT_STORE_ID);
408408

409409
$this->abstractCollection->expects($this->once())->method('count')->willReturn(0);
@@ -434,7 +434,7 @@ public function testExportCurPageEqualToLastBreakInternalCalls()
434434
$this->product->expects($this->once())->method('_prepareEntityCollection')->with($this->abstractCollection);
435435
$this->product->expects($this->once())->method('getItemsPerPage')->willReturn($itemsPerPage);
436436
$this->product->expects($this->once())->method('paginateCollection')->with($page, $itemsPerPage);
437-
$this->abstractCollection->expects($this->once())->method('setOrder')->with('has_options', 'asc');
437+
$this->abstractCollection->expects($this->once())->method('setOrder')->with('entity_id', 'asc');
438438
$this->abstractCollection->expects($this->once())->method('setStoreId')->with(Store::DEFAULT_STORE_ID);
439439

440440
$this->abstractCollection->expects($this->once())->method('count')->willReturn(1);
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CatalogInventory\Setup;
7+
8+
use Magento\CatalogInventory\Api\StockConfigurationInterface;
9+
use Magento\Framework\Indexer\AbstractProcessor;
10+
use Magento\Framework\Setup\UpgradeDataInterface;
11+
use Magento\Framework\Setup\ModuleContextInterface;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Store\Model\StoreManagerInterface;
14+
15+
/**
16+
* Upgrade Data script
17+
* @codeCoverageIgnore
18+
*/
19+
class UpgradeData implements UpgradeDataInterface
20+
{
21+
/**
22+
* @var StockConfigurationInterface
23+
*/
24+
private $configuration;
25+
26+
/**
27+
* @var AbstractProcessor
28+
*/
29+
private $indexerProcessor;
30+
31+
/**
32+
* @var StoreManagerInterface
33+
*/
34+
private $storeManager;
35+
36+
/**
37+
* @param StockConfigurationInterface $configuration
38+
* @param StoreManagerInterface $storeManager
39+
* @param AbstractProcessor $indexerProcessor
40+
*/
41+
public function __construct(
42+
StockConfigurationInterface $configuration,
43+
StoreManagerInterface $storeManager,
44+
AbstractProcessor $indexerProcessor
45+
) {
46+
$this->configuration = $configuration;
47+
$this->storeManager = $storeManager;
48+
$this->indexerProcessor = $indexerProcessor;
49+
}
50+
51+
/**
52+
* {@inheritdoc}
53+
*/
54+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
55+
{
56+
$setup->startSetup();
57+
if (version_compare($context->getVersion(), '2.0.2') < 0) {
58+
$this->upgradeCatalogInventoryStockItem($setup);
59+
}
60+
$setup->endSetup();
61+
}
62+
63+
/**
64+
* @param ModuleDataSetupInterface $setup
65+
* @return void
66+
*/
67+
private function upgradeCatalogInventoryStockItem($setup)
68+
{
69+
$setup->getConnection()->update(
70+
$setup->getTable('cataloginventory_stock_item'),
71+
['website_id' => $this->configuration->getDefaultScopeId()],
72+
['website_id = ?' => $this->storeManager->getWebsite()->getId()]
73+
);
74+
$this->indexerProcessor->getIndexer()->invalidate();
75+
}
76+
}

app/code/Magento/CatalogInventory/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@
7474
<type name="Magento\Catalog\Api\ProductRepositoryInterface">
7575
<plugin name="catalogInventoryAroundSave" sortOrder="20" type="Magento\CatalogInventory\Model\Plugin\AroundProductRepositorySave"/>
7676
</type>
77+
<type name="Magento\CatalogInventory\Setup\UpgradeData">
78+
<arguments>
79+
<argument name="indexerProcessor" xsi:type="object">Magento\CatalogInventory\Model\Indexer\Stock\Processor</argument>
80+
</arguments>
81+
</type>
7782
</config>

app/code/Magento/CatalogInventory/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_CatalogInventory" setup_version="2.0.1">
9+
<module name="Magento_CatalogInventory" setup_version="2.0.2">
1010
<sequence>
1111
<module name="Magento_Catalog"/>
1212
</sequence>

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\CatalogWidget\Block\Product;
108

119
use Magento\Framework\DataObject\IdentityInterface;
1210
use Magento\Widget\Block\BlockInterface;
11+
use Magento\Framework\Pricing\PriceCurrencyInterface;
1312

1413
/**
1514
* Catalog Products List widget block
@@ -81,6 +80,11 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem
8180
*/
8281
protected $conditionsHelper;
8382

83+
/**
84+
* @var PriceCurrencyInterface
85+
*/
86+
private $priceCurrency;
87+
8488
/**
8589
* @param \Magento\Catalog\Block\Product\Context $context
8690
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
@@ -144,6 +148,7 @@ public function getCacheKeyInfo()
144148

145149
return [
146150
'CATALOG_PRODUCTS_LIST_WIDGET',
151+
$this->getPriceCurrency()->getCurrencySymbol(),
147152
$this->_storeManager->getStore()->getId(),
148153
$this->_design->getDesignTheme()->getId(),
149154
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
@@ -351,4 +356,19 @@ public function getTitle()
351356
{
352357
return $this->getData('title');
353358
}
359+
360+
/**
361+
* @return PriceCurrencyInterface
362+
*
363+
* @deprecated
364+
*/
365+
private function getPriceCurrency()
366+
{
367+
if ($this->priceCurrency === null) {
368+
$this->priceCurrency = \Magento\Framework\App\ObjectManager::getInstance()
369+
->get(PriceCurrencyInterface::class);
370+
}
371+
return $this->priceCurrency;
372+
373+
}
354374
}

app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1212
use Magento\Catalog\Model\Product\Visibility;
13+
use Magento\Framework\Pricing\PriceCurrencyInterface;
1314

1415
/**
1516
* Class ProductsListTest
@@ -72,6 +73,11 @@ class ProductsListTest extends \PHPUnit_Framework_TestCase
7273
*/
7374
protected $layout;
7475

76+
/**
77+
* @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
78+
*/
79+
private $priceCurrency;
80+
7581
protected function setUp()
7682
{
7783
$this->collectionFactory =
@@ -105,11 +111,13 @@ protected function setUp()
105111
);
106112
$this->request = $arguments['context']->getRequest();
107113
$this->layout = $arguments['context']->getLayout();
114+
$this->priceCurrency = $this->getMock(PriceCurrencyInterface::class);
108115

109116
$this->productsList = $objectManagerHelper->getObject(
110117
\Magento\CatalogWidget\Block\Product\ProductsList::class,
111118
$arguments
112119
);
120+
$objectManagerHelper->setBackwardCompatibleProperty($this->productsList, 'priceCurrency', $this->priceCurrency);
113121
}
114122

115123
public function testGetCacheKeyInfo()
@@ -130,9 +138,11 @@ public function testGetCacheKeyInfo()
130138
$this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1);
131139

132140
$this->request->expects($this->once())->method('getParams')->willReturn('request_params');
141+
$this->priceCurrency->expects($this->once())->method('getCurrencySymbol')->willReturn('$');
133142

134143
$cacheKey = [
135144
'CATALOG_PRODUCTS_LIST_WIDGET',
145+
'$',
136146
1,
137147
'blank',
138148
'context_group',

0 commit comments

Comments
 (0)