Skip to content

Commit 7eb7b53

Browse files
author
Roman Lytvynenko
committed
MAGETWO-99769: SKU search weight is ignored
1 parent e4c562d commit 7eb7b53

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Catalog\Api\ProductRepositoryInterface;
8+
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\Product\Attribute\Source\Status;
10+
use Magento\Catalog\Model\Product\Type;
11+
use Magento\Catalog\Model\Product\Visibility;
12+
use Magento\TestFramework\Helper\Bootstrap;
13+
14+
/** @var ProductRepositoryInterface $productRepository */
15+
$productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class);
16+
$product = Bootstrap::getObjectManager()->create(Product::class);
17+
$product->setTypeId(Type::TYPE_SIMPLE)
18+
->setAttributeSetId(4)
19+
->setWebsiteIds([1])
20+
->setName('1-2-3-4')
21+
->setSku('testsku')
22+
->setPrice(10)
23+
->setTaxClassId(0)
24+
->setVisibility(Visibility::VISIBILITY_BOTH)
25+
->setStatus(Status::STATUS_ENABLED)
26+
->setStockData(
27+
[
28+
'use_config_manage_stock' => 1,
29+
'qty' => 100,
30+
'is_qty_decimal' => 0,
31+
'is_in_stock' => 1,
32+
]
33+
);
34+
$productRepository->save($product);
35+
36+
$product = Bootstrap::getObjectManager()->create(Product::class);
37+
$product->setTypeId(Type::TYPE_SIMPLE)
38+
->setAttributeSetId(4)
39+
->setWebsiteIds([1])
40+
->setName('test')
41+
->setSku('1-2-3-4')
42+
->setPrice(10)
43+
->setTaxClassId(0)
44+
->setVisibility(Visibility::VISIBILITY_BOTH)
45+
->setStatus(Status::STATUS_ENABLED)
46+
->setStockData(
47+
[
48+
'use_config_manage_stock' => 1,
49+
'qty' => 100,
50+
'is_qty_decimal' => 0,
51+
'is_in_stock' => 1,
52+
]
53+
);
54+
$productRepository->save($product);

0 commit comments

Comments
 (0)