Skip to content

Commit a6a8b3c

Browse files
committed
Merge branch 'MAGETWO-34346' into MAGETWO-31159
2 parents 5e96ad7 + 47b227b commit a6a8b3c

File tree

18 files changed

+195
-139
lines changed

18 files changed

+195
-139
lines changed

app/code/Magento/Catalog/Api/Data/CategoryAttributeInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99
interface CategoryAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface
1010
{
1111
const ENTITY_TYPE_CODE = 'catalog_category';
12-
13-
const DEFAULT_ATTRIBUTE_SET_ID = 3;
1412
}

app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99
interface ProductAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface
1010
{
1111
const ENTITY_TYPE_CODE = 'catalog_product';
12-
13-
const DEFAULT_ATTRIBUTE_SET_ID = 4;
1412
}

app/code/Magento/Catalog/Model/Category/AttributeRepository.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,30 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface
2424
*/
2525
protected $eavAttributeRepository;
2626

27+
/**
28+
* @var \Magento\Eav\Model\Config
29+
*/
30+
protected $eavConfig;
31+
2732
/**
2833
* @param \Magento\Framework\Api\Config\MetadataConfig $metadataConfig
2934
* @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder
3035
* @param \Magento\Framework\Api\FilterBuilder $filterBuilder
3136
* @param \Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository
37+
* @param \Magento\Eav\Model\Config $eavConfig
3238
*/
3339
public function __construct(
3440
\Magento\Framework\Api\Config\MetadataConfig $metadataConfig,
3541
\Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder,
3642
\Magento\Framework\Api\FilterBuilder $filterBuilder,
37-
\Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository
43+
\Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository,
44+
\Magento\Eav\Model\Config $eavConfig
3845
) {
3946
$this->metadataConfig = $metadataConfig;
4047
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
4148
$this->filterBuilder = $filterBuilder;
4249
$this->eavAttributeRepository = $eavAttributeRepository;
50+
$this->eavConfig = $eavConfig;
4351
}
4452

4553
/**
@@ -69,11 +77,14 @@ public function get($attributeCode)
6977
*/
7078
public function getCustomAttributesMetadata($dataObjectClassName = null)
7179
{
80+
$defaultAttributeSetId = $this->eavConfig
81+
->getEntityType(\Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE)
82+
->getDefaultAttributeSetId();
7283
$searchCriteria = $this->searchCriteriaBuilder->addFilter(
7384
[
7485
$this->filterBuilder
7586
->setField('attribute_set_id')
76-
->setValue(\Magento\Catalog\Api\Data\CategoryAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID)
87+
->setValue($defaultAttributeSetId)
7788
->create(),
7889
]
7990
);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,14 @@ public function deleteById($attributeCode)
216216
*/
217217
public function getCustomAttributesMetadata($dataObjectClassName = null)
218218
{
219+
$defaultAttributeSetId = $this->eavConfig
220+
->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE)
221+
->getDefaultAttributeSetId();
219222
$searchCriteria = $this->searchCriteriaBuilder->addFilter(
220223
[
221224
$this->filterBuilder
222225
->setField('attribute_set_id')
223-
->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID)
226+
->setValue($defaultAttributeSetId)
224227
->create(),
225228
]
226229
);

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
7171
*/
7272
protected $metadataService;
7373

74+
/**
75+
* @var \Magento\Eav\Model\Config
76+
*/
77+
protected $eavConfig;
78+
7479
/**
7580
* @param ProductFactory $productFactory
7681
* @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper
@@ -81,6 +86,8 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
8186
* @param Resource\Product $resourceModel
8287
* @param \Magento\Framework\Api\FilterBuilder $filterBuilder
8388
* @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface
89+
* @param \Magento\Eav\Model\Config $eavConfig
90+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8491
*/
8592
public function __construct(
8693
ProductFactory $productFactory,
@@ -91,7 +98,8 @@ public function __construct(
9198
\Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository,
9299
\Magento\Catalog\Model\Resource\Product $resourceModel,
93100
\Magento\Framework\Api\FilterBuilder $filterBuilder,
94-
\Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface
101+
\Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface,
102+
\Magento\Eav\Model\Config $eavConfig
95103
) {
96104
$this->productFactory = $productFactory;
97105
$this->collectionFactory = $collectionFactory;
@@ -102,6 +110,7 @@ public function __construct(
102110
$this->attributeRepository = $attributeRepository;
103111
$this->filterBuilder = $filterBuilder;
104112
$this->metadataService = $metadataServiceInterface;
113+
$this->eavConfig = $eavConfig;
105114
}
106115

107116
/**
@@ -261,12 +270,14 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
261270
{
262271
/** @var \Magento\Catalog\Model\Resource\Product\Collection $collection */
263272
$collection = $this->collectionFactory->create();
264-
273+
$defaultAttributeSetId = $this->eavConfig
274+
->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE)
275+
->getDefaultAttributeSetId();
265276
$extendedSearchCriteria = $this->searchCriteriaBuilder->addFilter(
266277
[
267278
$this->filterBuilder
268279
->setField('attribute_set_id')
269-
->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID)
280+
->setValue($defaultAttributeSetId)
270281
->create(),
271282
]
272283
);

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
<script>
1515
require([
16+
'jquery',
1617
"prototype",
1718
"extjs/ext-tree-checkbox",
1819
"mage/adminhtml/form"
19-
], function(){
20+
], function(jQuery){
2021

2122
//<![CDATA[
2223

@@ -69,7 +70,7 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, {
6970
}
7071
});
7172

72-
Ext.onReady(function()
73+
jQuery(function()
7374
{
7475
var categoryLoader = new Ext.tree.TreeLoader({
7576
dataUrl: '<?php echo $block->getLoadTreeUrl() ?>'

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ function _renderNewTree(config, scopeParams) {
272272
//updateContent(url); //commented since ajax requests replaced with http ones to load a category
273273
}
274274

275-
Ext.onReady(function () {
275+
jQuery(function () {
276276
categoryLoader = new Ext.tree.TreeLoader({
277277
dataUrl:'<?php echo $block->getLoadTreeUrl() ?>'
278278
});

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div id="<?php echo $_divId ?>" class="tree"></div>
1313

1414
<script>
15-
require(["prototype", "extjs/ext-tree-checkbox"], function(){
15+
require(['jquery', "prototype", "extjs/ext-tree-checkbox"], function(jQuery){
1616

1717
var tree<?php echo $block->getId() ?>;
1818

@@ -54,7 +54,7 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, {
5454
}
5555
});
5656

57-
Ext.onReady(function()
57+
jQuery(function()
5858
{
5959
var emptyNodeAdded = <?php echo($block->getWithEmptyNode() ? 'false' : 'true') ?>;
6060

app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ require([
3535
"extjs/ext-tree-checkbox",
3636
'Magento_DesignEditor/js/tools-files'
3737
], function(jQuery){
38-
39-
Ext.onReady(function(){
38+
jQuery(function(){
4039
var Tree = Ext.tree;
4140
var tree = new Tree.TreePanel('tree', {
4241
animate:true,

app/code/Magento/UrlRewrite/Controller/Router.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function match(\Magento\Framework\App\RequestInterface $request)
8585
return $this->processRedirect($request, $rewrite);
8686
}
8787

88+
$request->setAlias(\Magento\Framework\UrlInterface::REWRITE_REQUEST_PATH_ALIAS, $rewrite->getRequestPath());
8889
$request->setPathInfo('/' . $rewrite->getTargetPath());
8990
return $this->actionFactory->create('Magento\Framework\App\Action\Forward', ['request' => $request]);
9091
}

0 commit comments

Comments
 (0)