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
Sales
_files
order_status_history_for_search.php
Go to the documentation of this file.
1
<?php
7
use
Magento\Sales\Api\OrderStatusHistoryRepositoryInterface
;
8
use
Magento\Sales\Model\Order\Status\History
;
9
use
Magento\TestFramework\Helper\Bootstrap
;
10
11
require
'default_rollback.php'
;
12
require
__DIR__
.
'/order.php'
;
13
14
$comments
= [
15
[
16
'comment'
=>
'comment 1'
,
17
'is_visible_on_front'
=> 1,
18
'is_customer_notified'
=> 1,
19
],
20
[
21
'comment'
=>
'comment 2'
,
22
'is_visible_on_front'
=> 1,
23
'is_customer_notified'
=> 1,
24
],
25
[
26
'comment'
=>
'comment 3'
,
27
'is_visible_on_front'
=> 1,
28
'is_customer_notified'
=> 1,
29
],
30
[
31
'comment'
=>
'comment 4'
,
32
'is_visible_on_front'
=> 1,
33
'is_customer_notified'
=> 1,
34
],
35
[
36
'comment'
=>
'comment 5'
,
37
'is_visible_on_front'
=> 0,
38
'is_customer_notified'
=> 1,
39
],
40
];
41
43
$historyRepository
= Bootstrap::getObjectManager()->get(OrderStatusHistoryRepositoryInterface::class);
44
45
foreach
(
$comments
as
$data
) {
47
$comment = Bootstrap::getObjectManager()->create(History::class);
48
$comment->setParentId(
$order
->getId());
49
$comment->setComment(
$data
[
'comment'
]);
50
$comment->setIsVisibleOnFront(
$data
[
'is_visible_on_front'
]);
51
$comment->setIsCustomerNotified(
$data
[
'is_customer_notified'
]);
52
$historyRepository
->save($comment);
53
}
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$order
$order
Definition:
order.php:55
$comments
$comments
Definition:
order_status_history_for_search.php:14
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$historyRepository
$historyRepository
Definition:
order_status_history_for_search.php:43
Magento\Sales\Model\Order\Status\History
Definition:
Validator.php:7
Magento\Sales\Api\OrderStatusHistoryRepositoryInterface
Definition:
OrderStatusHistoryRepositoryInterface.php:18