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
Downloadable
_files
order_with_downloadable_product_with_additional_options.php
Go to the documentation of this file.
1
<?php
7
$billingAddress
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
8
\
Magento
\Sales\Model\Order\Address::class,
9
[
10
'data'
=> [
11
'firstname'
=>
'guest'
,
12
'lastname'
=>
'guest'
,
13
'email'
=>
'
[email protected]
'
,
14
'street'
=>
'street'
,
15
'city'
=>
'Los Angeles'
,
16
'region'
=>
'CA'
,
17
'postcode'
=>
'1'
,
18
'country_id'
=>
'US'
,
19
'telephone'
=>
'1'
,
20
]
21
]
22
);
23
$billingAddress
->setAddressType(
'billing'
);
24
25
$payment
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
26
\
Magento
\Sales\Model\Order\Payment::class
27
);
28
$payment
->setMethod(
'checkmo'
);
29
30
$orderItem
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
31
\
Magento
\Sales\Model\Order\Item::class
32
);
33
$orderItem
->setProductId(
34
1
35
)->setProductType(
36
\
Magento
\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
37
)->setBasePrice(
38
100
39
)->setQtyOrdered(
40
1
41
);
42
$orderItem
->setProductOptions([
'additional_options'
=> [
'additional_option_key'
=>
'additional_option_value'
]]);
43
44
$order
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(\
Magento
\Sales\Model\Order::class);
45
$order
->setCustomerEmail(
46
'
[email protected]
'
47
)->addItem(
48
$orderItem
49
)->setIncrementId(
50
'100000001'
51
)->setCustomerIsGuest(
52
true
53
)->setStoreId(
54
1
55
)->setEmailSent(
56
1
57
)->setBillingAddress(
58
$billingAddress
59
)->setPayment(
60
$payment
61
);
62
$order
->save();
$order
$order
Definition:
order_with_downloadable_product_with_additional_options.php:44
$payment
$payment
Definition:
order_with_downloadable_product_with_additional_options.php:25
$orderItem
$orderItem
Definition:
order_with_downloadable_product_with_additional_options.php:30
Magento
$billingAddress
$billingAddress
Definition:
order_with_downloadable_product_with_additional_options.php:7
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125