Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Catalog
_files
product_different_store_prices.php
Go to the documentation of this file.
1
<?php
7
use
Magento\TestFramework\Helper\Bootstrap
;
8
use
Magento\Framework\Indexer\IndexerRegistry
;
9
use
Magento\Catalog\Model\Product
;
10
use
Magento\Catalog\Model\Product\Type
;
11
use
Magento\Catalog\Model\Product\Visibility
;
12
use
Magento\Catalog\Model\Product\Attribute\Source\Status
;
13
use
Magento\Catalog\Api\ProductRepositoryInterface
;
14
15
require
__DIR__
.
'/../../Store/_files/core_fixturestore.php'
;
16
17
$objectManager
= Bootstrap::getObjectManager();
18
20
$indexerRegistry
=
$objectManager
->create(IndexerRegistry::class);
21
$indexer
=
$indexerRegistry
->get(
'catalogsearch_fulltext'
);
22
23
$indexer
->reindexAll();
24
26
$product
=
$objectManager
->create(Product::class);
27
$product
->isObjectNew(
true
);
28
$product
->setTypeId(Type::TYPE_SIMPLE)
29
->setAttributeSetId(4)
30
->setWebsiteIds([1])
31
->setName(
'Simple Product'
)
32
->setSku(
'tier_prices'
)
33
->setPrice(10)
34
->setWeight(1)
35
->setShortDescription(
"Short description"
)
36
->setTaxClassId(0)
37
->setDescription(
'Description with <b>html tag</b>'
)
38
->setMetaTitle(
'meta title'
)
39
->setMetaKeyword(
'meta keyword'
)
40
->setMetaDescription(
'meta description'
)
41
->setVisibility(Visibility::VISIBILITY_BOTH)
42
->setStatus(Status::STATUS_ENABLED)
43
->setStockData(
44
[
45
'use_config_manage_stock'
=> 1,
46
'qty'
=> 100,
47
'is_qty_decimal'
=> 0,
48
'is_in_stock'
=> 1,
49
]
50
);
51
53
$productRepository
=
$objectManager
->create(ProductRepositoryInterface::class);
54
$productRepository
->save(
$product
);
55
56
$product
->setStoreId(
$store
->getId());
57
$product
->setPrice(15);
58
$productRepository
->save(
$product
);
Magento\Catalog\Model\Product\Attribute\Source\Status
Definition:
Status.php:18
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$productRepository
$productRepository
Definition:
product_different_store_prices.php:53
Magento\Catalog\Api\ProductRepositoryInterface
Definition:
ProductRepositoryInterface.php:14
$indexerRegistry
$indexerRegistry
Definition:
product_different_store_prices.php:20
Magento\Catalog\Model\Product
Definition:
ActionTest.php:6
$objectManager
$objectManager
Definition:
product_different_store_prices.php:17
Magento\Framework\Indexer\IndexerRegistry
Definition:
IndexerRegistry.php:12
$store
$store
Definition:
payment_configuration_rollback.php:33
$product
$product
Definition:
product_different_store_prices.php:26
Magento\Catalog\Model\Product\Visibility
Definition:
Visibility.php:17
$indexer
$indexer
Definition:
product_different_store_prices.php:21
Magento\Catalog\Model\Product\Type
Definition:
AbstractTypeTest.php:7