Skip to content

Commit d74c186

Browse files
author
Oleksandr Karpenko
committed
Merge branch 'develop' of https://github.corp.magento.com/magento2/magento2ce into BUGS
2 parents 35eb848 + 481bc3b commit d74c186

File tree

44 files changed

+302
-117
lines changed

Some content is hidden

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

44 files changed

+302
-117
lines changed

app/code/Magento/Backend/Block/Widget/Button/Item.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
namespace Magento\Backend\Block\Widget\Button;
88

99
/**
10-
* @method string getButtonKey
11-
* @method string getRegion
12-
* @method string getName
13-
* @method int getLevel
14-
* @method int getSortOrder
15-
* @method string getTitle
10+
* @method string getButtonKey()
11+
* @method string getRegion()
12+
* @method string getName()
13+
* @method int getLevel()
14+
* @method int getSortOrder()
15+
* @method string getTitle()
1616
*/
1717
class Item extends \Magento\Framework\DataObject
1818
{

app/code/Magento/Backend/Block/Widget/Button/Toolbar/Container.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Magento\Backend\Block\Widget\Button\ContextInterface;
1010

1111
/**
12-
* @method \Magento\Backend\Block\Widget\Button\Item getButtonItem
13-
* @method ContextInterface getContext
12+
* @method \Magento\Backend\Block\Widget\Button\Item getButtonItem()
13+
* @method ContextInterface getContext()
1414
* @method ContextInterface setContext(ContextInterface $context)
1515
*/
1616
class Container extends \Magento\Framework\View\Element\AbstractBlock

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ class Advanced extends Generic
3131
*/
3232
protected $_yesNo;
3333

34+
/**
35+
* @var array
36+
*/
37+
protected $disableScopeChangeList;
38+
3439
/**
3540
* @param \Magento\Backend\Block\Template\Context $context
3641
* @param \Magento\Framework\Registry $registry
3742
* @param \Magento\Framework\Data\FormFactory $formFactory
3843
* @param Yesno $yesNo
3944
* @param Data $eavData
45+
* @param array $disableScopeChangeList
4046
* @param array $data
4147
*/
4248
public function __construct(
@@ -45,10 +51,12 @@ public function __construct(
4551
\Magento\Framework\Data\FormFactory $formFactory,
4652
Yesno $yesNo,
4753
Data $eavData,
54+
array $disableScopeChangeList = ['sku'],
4855
array $data = []
4956
) {
5057
$this->_yesNo = $yesNo;
5158
$this->_eavData = $eavData;
59+
$this->disableScopeChangeList = $disableScopeChangeList;
5260
parent::__construct($context, $registry, $formFactory, $data);
5361
}
5462

@@ -229,7 +237,7 @@ protected function _prepareForm()
229237
);
230238

231239
$this->_eventManager->dispatch('product_attribute_form_build', ['form' => $form]);
232-
if ($attributeObject->getId() && !$attributeObject->getIsUserDefined()) {
240+
if (in_array($attributeObject->getAttributeCode(), $this->disableScopeChangeList)) {
233241
$form->getElement('is_global')->setDisabled(1);
234242
}
235243
$this->setForm($form);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Product attribute add/edit form options tab
99
*
1010
* @method \Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Options setReadOnly(bool $value)
11-
* @method null|bool getReadOnly
11+
* @method null|bool getReadOnly()
1212
*
1313
* @author Magento Core Team <core@magentocommerce.com>
1414
*/

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,14 @@ public function getCustomOptionsUrl()
461461
{
462462
return $this->getUrl('catalog/*/customOptions');
463463
}
464+
465+
/**
466+
* Return current product id
467+
*
468+
* @return null|int
469+
*/
470+
public function getCurrentProductId()
471+
{
472+
return $this->getProduct()->getId();
473+
}
464474
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Popup/Grid.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,19 @@ public function _prepareMassaction()
6262
protected function _prepareCollection()
6363
{
6464
parent::_prepareCollection();
65-
$this->getCollection()->addFieldToFilter('has_options', 1);
65+
66+
if (null !== $this->getRequest()->getParam('current_product_id')) {
67+
$this->getCollection()->getSelect()->where(
68+
'e.entity_id != ?',
69+
$this->getRequest()->getParam('current_product_id')
70+
);
71+
}
72+
73+
$this->getCollection()->getSelect()->distinct()->join(
74+
['opt' => $this->getCollection()->getTable('catalog_product_option')],
75+
'opt.product_id = e.entity_id',
76+
null
77+
);
6678

6779
return $this;
6880
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ public function __construct(
3636
public function getAssignedProducts($categoryId)
3737
{
3838
$category = $this->categoryRepository->get($categoryId);
39-
$productsPosition = $category->getProductsPosition();
4039

41-
/** @var \Magento\Framework\Data\Collection\AbstractDb $products */
40+
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $products */
4241
$products = $category->getProductCollection();
42+
$products->addFieldToSelect('position');
4343

4444
/** @var \Magento\Catalog\Api\Data\CategoryProductLinkInterface[] $links */
4545
$links = [];
4646

4747
/** @var \Magento\Catalog\Model\Product $product */
48-
foreach ($products->getItems() as $productId => $product) {
48+
foreach ($products->getItems() as $product) {
4949
/** @var \Magento\Catalog\Api\Data\CategoryProductLinkInterface $link */
5050
$link = $this->productLinkFactory->create();
5151
$link->setSku($product->getSku())
52-
->setPosition($productsPosition[$productId])
52+
->setPosition($product->getData('cat_index_position'))
5353
->setCategoryId($category->getId());
5454
$links[] = $link;
5555
}

app/code/Magento/Catalog/Model/Config/Source/Product/Options/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function toOptionArray()
4343
$types[] = ['label' => __($type['label']), 'value' => $type['name']];
4444
}
4545
if (count($types)) {
46-
$groups[] = ['label' => __($option['label']), 'value' => $types];
46+
$groups[] = ['label' => __($option['label']), 'value' => $types, 'optgroup-name' => $option['label']];
4747
}
4848
}
4949

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @method array getAssociatedProductIds()
2626
* @method Product setNewVariationsAttributeSetId(int $value)
2727
* @method int getNewVariationsAttributeSetId()
28-
* @method int getPriceType
28+
* @method int getPriceType()
2929
* @method \Magento\Catalog\Model\ResourceModel\Product\Collection getCollection()
3030
* @method string getUrlKey()
3131
* @method Product setUrlKey(string $urlKey)

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function beforeSave($object)
8585
// For duplicating we need copy original images.
8686
$duplicate = [];
8787
foreach ($value['images'] as &$image) {
88-
if (empty($image['value_id'])) {
88+
if (empty($image['value_id']) || !empty($image['removed'])) {
8989
continue;
9090
}
9191
$duplicate[$image['value_id']] = $this->copyImage($image['file']);

0 commit comments

Comments
 (0)