Skip to content

Commit 5c82f8c

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'mainline/develop' into bugs
2 parents 380be50 + fc32492 commit 5c82f8c

File tree

30 files changed

+602
-50
lines changed

30 files changed

+602
-50
lines changed

app/code/Magento/Bundle/Model/Product/Price.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ public function getFinalPrice($qty, $product)
183183
$finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
184184
$finalPrice += $this->getTotalBundleItemsPrice($product, $qty);
185185

186+
$finalPrice = max(0, $finalPrice);
186187
$product->setFinalPrice($finalPrice);
187-
return max(0, $product->getData('final_price'));
188+
return $finalPrice;
188189
}
189190

190191
/**

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ protected function _prepareForm()
7070
}
7171
$this->_coreRegistry->register('attribute_type_hidden_fields', $_hiddenFields);
7272

73-
$this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $form]);
74-
7573
$frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
7674
$frontendInputElm->setValues($frontendInputValues);
7775

76+
$this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $form]);
77+
7878
return $this;
7979
}
8080

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function createActionPage($title = null)
8888
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
8989
$resultPage = $this->resultPageFactory->create();
9090
if ($this->getRequest()->getParam('popup')) {
91-
if ($this->getRequest()->getParam('product_tab') == 'variations') {
91+
if ($this->getRequest()->getParam('product_tab') === 'variations') {
9292
$resultPage->addHandle(['popup', 'catalog_product_attribute_edit_product_tab_variations_popup']);
9393
} else {
9494
$resultPage->addHandle(['popup', 'catalog_product_attribute_edit_popup']);

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class StockDataFilter
1616
/**
1717
* The greatest value which could be stored in CatalogInventory Qty field
1818
*/
19-
const MAX_QTY_VALUE = 99999999.9999;
19+
const MAX_QTY_VALUE = 99999999;
2020

2121
/**
2222
* @var ScopeConfigInterface

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
142142
*/
143143
protected $optionInstance;
144144

145-
/**
146-
* @var bool
147-
*/
148-
protected $optionsInitialized = false;
149-
150145
/**
151146
* @var array
152147
*/
@@ -1901,6 +1896,7 @@ public function addOption(Product\Option $option)
19011896
{
19021897
$options = (array)$this->getData('options');
19031898
$options[] = $option;
1899+
$option->setProduct($this);
19041900
$this->setData('options', $options);
19051901
return $this;
19061902
}

app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\CatalogInventory\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter;
89
use Magento\Catalog\Model\Locator\LocatorInterface;
910
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
1011
use Magento\CatalogInventory\Api\StockRegistryInterface;
@@ -213,6 +214,7 @@ private function prepareMeta()
213214
'validation' => [
214215
'validate-number' => true,
215216
'validate-digits' => true,
217+
'less-than-equals-to' => StockDataFilter::MAX_QTY_VALUE,
216218
],
217219
'imports' => [
218220
'handleChanges' => '${$.provider}:data.product.stock_data.is_qty_decimal',

app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<item name="validation" xsi:type="array">
9797
<item name="validate-number" xsi:type="boolean">true</item>
9898
<item name="validate-digits" xsi:type="boolean">true</item>
99+
<item name="less-than-equals-to" xsi:type="number">99999999</item>
99100
</item>
100101
<item name="sortOrder" xsi:type="number">200</item>
101102
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>

app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ define([
2121

2222
this.validation['validate-number'] = !isDigits;
2323
this.validation['validate-digits'] = isDigits;
24+
this.validation['less-than-equals-to'] = isDigits ? 99999999 : 99999999.9999;
2425
this.validate();
2526
}
2627
});

app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ protected function _getItemsData()
8484
->getProductCollection();
8585
$optionsFacetedData = $productCollection->getFacetedData($attribute->getAttributeCode());
8686

87+
if (count($optionsFacetedData) === 0
88+
&& $this->getAttributeIsFilterable($attribute) !== static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
89+
) {
90+
return $this->itemDataBuilder->build();
91+
}
92+
8793
$productSize = $productCollection->getSize();
8894

8995
$options = $attribute->getFrontend()
@@ -100,9 +106,8 @@ protected function _getItemsData()
100106
: 0;
101107
// Check filter type
102108
if (
103-
$count === 0
104-
&& $this->getAttributeIsFilterable($attribute) === static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
105-
&& !$this->isOptionReducesResults($count, $productSize)
109+
$this->getAttributeIsFilterable($attribute) === static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
110+
&& (!$this->isOptionReducesResults($count, $productSize) || $count === 0)
106111
) {
107112
continue;
108113
}

app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\CatalogSearch\Model\ResourceModel\Fulltext;
77

8+
use Magento\CatalogSearch\Model\Search\RequestGenerator;
89
use Magento\Framework\DB\Select;
910
use Magento\Framework\Exception\StateException;
1011
use Magento\Framework\Search\Adapter\Mysql\TemporaryStorage;
@@ -398,14 +399,17 @@ public function getFacetedData($field)
398399
$this->_renderFilters();
399400
$result = [];
400401
$aggregations = $this->searchResult->getAggregations();
401-
$bucket = $aggregations->getBucket($field . '_bucket');
402-
if ($bucket) {
403-
foreach ($bucket->getValues() as $value) {
404-
$metrics = $value->getMetrics();
405-
$result[$metrics['value']] = $metrics;
402+
// This behavior is for case with empty object when we got EmptyRequestDataException
403+
if (null !== $aggregations) {
404+
$bucket = $aggregations->getBucket($field . RequestGenerator::BUCKET_SUFFIX);
405+
if ($bucket) {
406+
foreach ($bucket->getValues() as $value) {
407+
$metrics = $value->getMetrics();
408+
$result[$metrics['value']] = $metrics;
409+
}
410+
} else {
411+
throw new StateException(__('Bucket does not exist'));
406412
}
407-
} else {
408-
throw new StateException(__('Bucket do not exists'));
409413
}
410414
return $result;
411415
}

0 commit comments

Comments
 (0)