Skip to content

Commit cae6f5f

Browse files
author
Slabko,Michael(mslabko)
committed
Merge pull request #613 from magento-goinc/MAGETWO-37174
[GoInc] Product Variation Update
2 parents 2cb2fa5 + 0f75a5e commit cae6f5f

File tree

100 files changed

+2770
-1325
lines changed

Some content is hidden

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

100 files changed

+2770
-1325
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,17 @@ protected function _prepareLayout()
7070
/**
7171
* Get html of Price Type select element
7272
*
73+
* @param string $extraParams
7374
* @return string
7475
*/
75-
public function getPriceTypeSelectHtml()
76+
public function getPriceTypeSelectHtml($extraParams = '')
7677
{
7778
if ($this->getCanEditPrice() === false) {
78-
$this->getChildBlock('option_price_type')->setExtraParams('disabled="disabled"');
79+
$extraParams .= ' disabled="disabled"';
80+
$this->getChildBlock('option_price_type');
7981
}
82+
$this->getChildBlock('option_price_type')->setExtraParams($extraParams);
83+
8084
return $this->getChildHtml('option_price_type');
8185
}
8286
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public function getPriceTypeSelectHtml($extraParams = '')
9090
'product_option_<%- data.id %>_select_<%- data.select_id %>_price_type'
9191
)->setName(
9292
'product[options][<%- data.id %>][values][<%- data.select_id %>][price_type]'
93-
)->setExtraParams($extraParams);
93+
);
9494

95-
return parent::getPriceTypeSelectHtml();
95+
return parent::getPriceTypeSelectHtml($extraParams);
9696
}
9797
}

app/code/Magento/Catalog/Ui/Component/FilterFactory.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,19 @@ public function __construct(\Magento\Framework\View\Element\UiComponentFactory $
3434
/**
3535
* @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
3636
* @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
37+
* @param array $config
3738
* @return \Magento\Ui\Component\Listing\Columns\ColumnInterface
3839
*/
39-
public function create($attribute, $context)
40+
public function create($attribute, $context, $config = [])
4041
{
4142
$columnName = $attribute->getAttributeCode();
42-
$config = [
43-
'dataScope' => $columnName,
44-
'label' => __($attribute->getDefaultFrontendLabel()),
45-
];
43+
$config = array_merge(
44+
[
45+
'dataScope' => $columnName,
46+
'label' => __($attribute->getDefaultFrontendLabel()),
47+
],
48+
$config
49+
);
4650
if ($attribute->usesSource() && $attribute->getSourceModel()) {
4751
$config['options'] = $attribute->getSource()->getAllOptions();
4852
$config['caption'] = __('Select...');
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Ui\Component\Listing\Attribute;
7+
8+
abstract class AbstractRepository implements RepositoryInterface
9+
{
10+
/**
11+
* @var null|\Magento\Catalog\Api\Data\ProductAttributeInterface[]
12+
*/
13+
protected $attributes;
14+
15+
/** @var \Magento\Framework\Api\SearchCriteriaBuilder */
16+
protected $searchCriteriaBuilder;
17+
18+
/**
19+
* @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $productAttributeRepository
20+
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
21+
*/
22+
public function __construct(
23+
\Magento\Catalog\Api\ProductAttributeRepositoryInterface $productAttributeRepository,
24+
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
25+
) {
26+
$this->productAttributeRepository = $productAttributeRepository;
27+
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
28+
}
29+
30+
/**
31+
* {@inheritdoc}
32+
*/
33+
abstract protected function buildSearchCriteria();
34+
35+
/**
36+
* @return \Magento\Catalog\Api\Data\ProductAttributeInterface[]
37+
*/
38+
public function getList()
39+
{
40+
if (null == $this->attributes) {
41+
$this->attributes = $this->productAttributeRepository
42+
->getList($this->buildSearchCriteria())
43+
->getItems();
44+
}
45+
return $this->attributes;
46+
}
47+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Ui\Component\Listing\Attribute;
7+
8+
class Repository extends AbstractRepository
9+
{
10+
/**
11+
* {@inheritdoc}
12+
*/
13+
protected function buildSearchCriteria()
14+
{
15+
return $this->searchCriteriaBuilder->addFilter('additional_table.is_used_in_grid', 1)->create();
16+
}
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Ui\Component\Listing\Attribute;
7+
8+
interface RepositoryInterface
9+
{
10+
/**
11+
* Get attributes
12+
*
13+
* @return \Magento\Catalog\Api\Data\ProductAttributeInterface[]
14+
*/
15+
public function getList();
16+
}

app/code/Magento/Catalog/Ui/Component/Listing/AttributeRepository.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

app/code/Magento/Catalog/Ui/Component/Listing/Columns.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ class Columns extends \Magento\Ui\Component\Listing\Columns
1212
*/
1313
const DEFAULT_COLUMNS_MAX_ORDER = 100;
1414

15+
/** @var \Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface */
16+
protected $attributeRepository;
17+
1518
/**
1619
* @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
1720
* @param \Magento\Catalog\Ui\Component\ColumnFactory $columnFactory
18-
* @param AttributeRepository $attributeRepository
21+
* @param \Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface $attributeRepository
1922
* @param array $components
2023
* @param array $data
2124
*/
2225
public function __construct(
2326
\Magento\Framework\View\Element\UiComponent\ContextInterface $context,
2427
\Magento\Catalog\Ui\Component\ColumnFactory $columnFactory,
25-
\Magento\Catalog\Ui\Component\Listing\AttributeRepository $attributeRepository,
28+
\Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface $attributeRepository,
2629
array $components = [],
2730
array $data = []
2831
) {

app/code/Magento/Catalog/Ui/Component/Listing/Filters.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
class Filters extends \Magento\Ui\Component\Filters
99
{
1010
/**
11-
* @var AttributeRepository
11+
* @var \Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface
1212
*/
1313
protected $attributeRepository;
1414

1515
/**
1616
* @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
1717
* @param \Magento\Catalog\Ui\Component\FilterFactory $filterFactory
18-
* @param AttributeRepository $attributeRepository
18+
* @param \Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface $attributeRepository
1919
* @param array $components
2020
* @param array $data
2121
*/
2222
public function __construct(
2323
\Magento\Framework\View\Element\UiComponent\ContextInterface $context,
2424
\Magento\Catalog\Ui\Component\FilterFactory $filterFactory,
25-
\Magento\Catalog\Ui\Component\Listing\AttributeRepository $attributeRepository,
25+
\Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface $attributeRepository,
2626
array $components = [],
2727
array $data = []
2828
) {

app/code/Magento/Catalog/etc/adminhtml/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@
7979
<type name="Magento\Catalog\Model\Product\Action">
8080
<plugin name="invalidate_pagecache_after_update_product_attributes" type="Magento\Catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache"/>
8181
</type>
82+
<preference for="Magento\Catalog\Ui\Component\Listing\Attribute\RepositoryInterface" type="Magento\Catalog\Ui\Component\Listing\Attribute\Repository"/>
8283
</config>

0 commit comments

Comments
 (0)