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
Model
Layer
Filter
Price
_files
products_advanced_rollback.php
Go to the documentation of this file.
1
<?php
7
$prices
= [5, 10, 15, 20, 50, 100, 150];
8
10
$registry
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->get(\
Magento
\Framework\Registry::class);
11
12
$registry
->unregister(
'isSecureArea'
);
13
$registry
->register(
'isSecureArea'
,
true
);
14
16
$productRepository
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
17
\
Magento
\Catalog\Api\ProductRepositoryInterface::class
18
);
19
21
$lastProductId
= 0;
22
foreach
(
$prices
as
$price
) {
24
$product
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
25
\
Magento
\Catalog\Model\Product::class
26
);
27
$productId
=
$lastProductId
+ 1;
28
try
{
29
$product
=
$productRepository
->get(
'simple-'
.
$productId
,
false
,
null
,
true
);
30
$productRepository
->delete(
$product
);
31
}
catch
(\
Magento
\Framework\Exception\NoSuchEntityException $e) {
32
//Product already removed
33
}
34
35
$lastProductId
++;
36
}
37
39
$collection
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()
40
->create(\
Magento
\Catalog\Model\
ResourceModel
\Category\Collection::class);
41
$collection
42
->addAttributeToFilter(
'level'
, 2)
43
->load()
44
->delete();
45
46
$registry
->unregister(
'isSecureArea'
);
47
$registry
->register(
'isSecureArea'
,
false
);
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
$productId
$productId
Definition:
website_attribute_sync.php:26
$price
$price
Definition:
product_alert.php:10
$collection
$collection
Definition:
products_advanced_rollback.php:39
$lastProductId
$lastProductId
Definition:
products_advanced_rollback.php:21
$prices
$prices
Definition:
products_advanced_rollback.php:7
Magento
$productRepository
$productRepository
Definition:
products_advanced_rollback.php:16
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$registry
$registry
Definition:
products_advanced_rollback.php:10
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125