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
CatalogSearch
_files
product_configurable_not_available_rollback.php
Go to the documentation of this file.
1
<?php
6
use
Magento\Catalog\Api\Data\ProductInterface
;
7
use
Magento\Framework\Api\SearchCriteriaBuilder
;
8
use
Magento\TestFramework\Helper\Bootstrap
;
9
10
$objectManager
= Bootstrap::getObjectManager();
11
13
$registry
=
$objectManager
->get(\
Magento
\Framework\Registry::class);
14
15
$registry
->unregister(
'isSecureArea'
);
16
$registry
->register(
'isSecureArea'
,
true
);
17
19
$productRepository
= Bootstrap::getObjectManager()
20
->get(\
Magento
\Catalog\Api\ProductRepositoryInterface::class);
21
22
$productSkus
= [
'simple_not_avalilable_1110'
,
'simple_not_avalilable_1120'
,
'configurable_not_available'
];
24
$searchCriteriaBuilder
= Bootstrap::getObjectManager()->get(SearchCriteriaBuilder::class);
25
$searchCriteriaBuilder
->addFilter(ProductInterface::SKU,
$productSkus
,
'in'
);
26
$result
=
$productRepository
->getList(
$searchCriteriaBuilder
->create());
27
foreach
(
$result
->getItems() as
$product
) {
28
$productRepository
->delete(
$product
);
29
}
30
31
require
__DIR__
.
'/../../../Magento/Framework/Search/_files/configurable_attribute_rollback.php'
;
32
33
$registry
->unregister(
'isSecureArea'
);
34
$registry
->register(
'isSecureArea'
,
false
);
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
$productSkus
$productSkus
Definition:
product_configurable_not_available_rollback.php:22
$registry
$registry
Definition:
product_configurable_not_available_rollback.php:13
Magento\Framework\Api\SearchCriteriaBuilder
Definition:
SearchCriteriaBuilder.php:14
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$objectManager
$objectManager
Definition:
product_configurable_not_available_rollback.php:10
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$productRepository
$productRepository
Definition:
product_configurable_not_available_rollback.php:19
$searchCriteriaBuilder
$searchCriteriaBuilder
Definition:
product_configurable_not_available_rollback.php:24
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14