Skip to content

Commit 55dcd20

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-96016
2 parents a3dbeae + c49da73 commit 55dcd20

File tree

41 files changed

+1227
-160
lines changed

Some content is hidden

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

41 files changed

+1227
-160
lines changed

app/code/Magento/Catalog/Helper/Data.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Api\CategoryRepositoryInterface;
99
use Magento\Catalog\Api\ProductRepositoryInterface;
10+
use Magento\Store\Model\ScopeInterface;
1011
use Magento\Customer\Model\Session as CustomerSession;
1112
use Magento\Framework\Exception\NoSuchEntityException;
1213
use Magento\Framework\Pricing\PriceCurrencyInterface;
@@ -273,7 +274,8 @@ public function setStoreId($store)
273274

274275
/**
275276
* Return current category path or get it from current category
276-
* and creating array of categories|product paths for breadcrumbs
277+
*
278+
* Creating array of categories|product paths for breadcrumbs
277279
*
278280
* @return array
279281
*/
@@ -382,6 +384,7 @@ public function getLastViewedUrl()
382384

383385
/**
384386
* Split SKU of an item by dashes and spaces
387+
*
385388
* Words will not be broken, unless this length is greater than $length
386389
*
387390
* @param string $sku
@@ -410,14 +413,15 @@ public function getAttributeHiddenFields()
410413
/**
411414
* Retrieve Catalog Price Scope
412415
*
413-
* @return int
416+
* @return int|null
414417
*/
415-
public function getPriceScope()
418+
public function getPriceScope(): ?int
416419
{
417-
return $this->scopeConfig->getValue(
420+
$priceScope = $this->scopeConfig->getValue(
418421
self::XML_PATH_PRICE_SCOPE,
419-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
422+
ScopeInterface::SCOPE_STORE
420423
);
424+
return isset($priceScope) ? (int)$priceScope : null;
421425
}
422426

423427
/**
@@ -439,7 +443,7 @@ public function isUsingStaticUrlsAllowed()
439443
{
440444
return $this->scopeConfig->isSetFlag(
441445
self::CONFIG_USE_STATIC_URLS,
442-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
446+
ScopeInterface::SCOPE_STORE
443447
);
444448
}
445449

@@ -454,7 +458,7 @@ public function isUrlDirectivesParsingAllowed()
454458
{
455459
return $this->scopeConfig->isSetFlag(
456460
self::CONFIG_PARSE_URL_DIRECTIVES,
457-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
461+
ScopeInterface::SCOPE_STORE,
458462
$this->_storeId
459463
);
460464
}
@@ -472,19 +476,22 @@ public function getPageTemplateProcessor()
472476

473477
/**
474478
* Whether to display items count for each filter option
479+
*
475480
* @param int $storeId Store view ID
476481
* @return bool
477482
*/
478483
public function shouldDisplayProductCountOnLayer($storeId = null)
479484
{
480485
return $this->scopeConfig->isSetFlag(
481486
self::XML_PATH_DISPLAY_PRODUCT_COUNT,
482-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
487+
ScopeInterface::SCOPE_STORE,
483488
$storeId
484489
);
485490
}
486491

487492
/**
493+
* Convert tax address array to address data object with country id and postcode
494+
*
488495
* @param array $taxAddress
489496
* @return \Magento\Customer\Api\Data\AddressInterface|null
490497
*/

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public function execute($entity, $arguments = [])
8181
__('Tier prices data should be array, but actually other type is received')
8282
);
8383
}
84-
$websiteId = $this->storeManager->getStore($entity->getStoreId())->getWebsiteId();
84+
$websiteId = (int)$this->storeManager->getStore($entity->getStoreId())->getWebsiteId();
8585
$isGlobal = $attribute->isScopeGlobal() || $websiteId === 0;
8686
$identifierField = $this->metadataPoll->getMetadata(ProductInterface::class)->getLinkField();
87-
$productId = (int) $entity->getData($identifierField);
87+
$productId = (int)$entity->getData($identifierField);
8888

8989
// prepare original data to compare
9090
$origPrices = [];
@@ -93,7 +93,7 @@ public function execute($entity, $arguments = [])
9393
$origPrices = $entity->getOrigData($attribute->getName());
9494
}
9595

96-
$old = $this->prepareOriginalDataToCompare($origPrices, $isGlobal);
96+
$old = $this->prepareOldTierPriceToCompare($origPrices);
9797
// prepare data for save
9898
$new = $this->prepareNewDataForSave($priceRows, $isGlobal);
9999

@@ -214,21 +214,18 @@ private function isWebsiteGlobal(int $websiteId): bool
214214
}
215215

216216
/**
217-
* Prepare original data to compare.
217+
* Prepare old data to compare.
218218
*
219219
* @param array|null $origPrices
220-
* @param bool $isGlobal
221220
* @return array
222221
*/
223-
private function prepareOriginalDataToCompare(?array $origPrices, bool $isGlobal = true): array
222+
private function prepareOldTierPriceToCompare(?array $origPrices): array
224223
{
225224
$old = [];
226225
if (is_array($origPrices)) {
227226
foreach ($origPrices as $data) {
228-
if ($isGlobal === $this->isWebsiteGlobal((int)$data['website_id'])) {
229-
$key = $this->getPriceKey($data);
230-
$old[$key] = $data;
231-
}
227+
$key = $this->getPriceKey($data);
228+
$old[$key] = $data;
232229
}
233230
}
234231

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ interface CustomizableOptionInterface @typeResolver(class: "Magento\\CatalogGrap
358358
title: String @doc(description: "The display name for this option")
359359
required: Boolean @doc(description: "Indicates whether the option is required")
360360
sort_order: Int @doc(description: "The order in which the option is displayed")
361+
option_id: Int @doc(description: "Option ID")
361362
}
362363

363364
interface CustomizableProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "CustomizableProductInterface contains information about customizable product options.") {

app/code/Magento/Customer/Model/Indexer/Source.php

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Customer\Model\Indexer;
77

8+
use Magento\Customer\Model\ResourceModel\Customer\Indexer\CollectionFactory;
89
use Magento\Customer\Model\ResourceModel\Customer\Indexer\Collection;
910
use Magento\Framework\App\ResourceConnection\SourceProviderInterface;
1011
use Traversable;
@@ -25,35 +26,35 @@ class Source implements \IteratorAggregate, \Countable, SourceProviderInterface
2526
private $batchSize;
2627

2728
/**
28-
* @param \Magento\Customer\Model\ResourceModel\Customer\Indexer\CollectionFactory $collection
29+
* @param CollectionFactory $collectionFactory
2930
* @param int $batchSize
3031
*/
3132
public function __construct(
32-
\Magento\Customer\Model\ResourceModel\Customer\Indexer\CollectionFactory $collectionFactory,
33+
CollectionFactory $collectionFactory,
3334
$batchSize = 10000
3435
) {
3536
$this->customerCollection = $collectionFactory->create();
3637
$this->batchSize = $batchSize;
3738
}
3839

3940
/**
40-
* {@inheritdoc}
41+
* @inheritdoc
4142
*/
4243
public function getMainTable()
4344
{
4445
return $this->customerCollection->getMainTable();
4546
}
4647

4748
/**
48-
* {@inheritdoc}
49+
* @inheritdoc
4950
*/
5051
public function getIdFieldName()
5152
{
5253
return $this->customerCollection->getIdFieldName();
5354
}
5455

5556
/**
56-
* {@inheritdoc}
57+
* @inheritdoc
5758
*/
5859
public function addFieldToSelect($fieldName, $alias = null)
5960
{
@@ -62,15 +63,15 @@ public function addFieldToSelect($fieldName, $alias = null)
6263
}
6364

6465
/**
65-
* {@inheritdoc}
66+
* @inheritdoc
6667
*/
6768
public function getSelect()
6869
{
6970
return $this->customerCollection->getSelect();
7071
}
7172

7273
/**
73-
* {@inheritdoc}
74+
* @inheritdoc
7475
*/
7576
public function addFieldToFilter($attribute, $condition = null)
7677
{
@@ -79,7 +80,7 @@ public function addFieldToFilter($attribute, $condition = null)
7980
}
8081

8182
/**
82-
* @return int
83+
* @inheritdoc
8384
*/
8485
public function count()
8586
{
@@ -105,4 +106,28 @@ public function getIterator()
105106
$pageNumber++;
106107
} while ($pageNumber <= $lastPage);
107108
}
109+
110+
/**
111+
* Joins Attribute
112+
*
113+
* @param string $alias alias for the joined attribute
114+
* @param string|\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
115+
* @param string $bind attribute of the main entity to link with joined $filter
116+
* @param string|null $filter primary key for the joined entity (entity_id default)
117+
* @param string $joinType inner|left
118+
* @param int|null $storeId
119+
* @return void
120+
* @throws \Magento\Framework\Exception\LocalizedException
121+
* @see Collection::joinAttribute()
122+
*/
123+
public function joinAttribute(
124+
string $alias,
125+
$attribute,
126+
string $bind,
127+
?string $filter = null,
128+
string $joinType = 'inner',
129+
?int $storeId = null
130+
): void {
131+
$this->customerCollection->joinAttribute($alias, $attribute, $bind, $filter, $joinType, $storeId);
132+
}
108133
}

0 commit comments

Comments
 (0)