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
Paypal
_files
quote_payflowpro.php
Go to the documentation of this file.
1
<?php
6
use
Magento\Catalog\Api\Data\ProductInterface
;
7
use
Magento\Catalog\Api\ProductRepositoryInterface
;
8
use
Magento\CatalogInventory\Api\Data\StockItemInterface
;
9
use
Magento\Framework\ObjectManagerInterface
;
10
use
Magento\Quote\Model\Quote
;
11
use
Magento\Quote\Model\Quote\Address
;
12
use
Magento\Quote\Model\QuoteRepository
;
13
use
Magento\TestFramework\Helper\Bootstrap
;
14
15
require
'fixed_discount.php'
;
16
18
$objectManager
= Bootstrap::getObjectManager();
19
20
$addressData
= [
21
'firstname'
=>
'John'
,
22
'lastname'
=>
'Doe'
,
23
'company'
=>
''
,
24
'email'
=>
'
[email protected]
'
,
25
'street'
=> [
26
0 =>
'test1'
,
27
],
28
'city'
=>
'Test'
,
29
'region_id'
=>
'1'
,
30
'region'
=>
''
,
31
'postcode'
=>
'9001'
,
32
'country_id'
=>
'US'
,
33
'telephone'
=>
'11111111'
,
34
];
36
$billingAddress
=
$objectManager
->create(Address::class, [
'data'
=>
$addressData
]);
37
$billingAddress
->setAddressType(
'billing'
);
38
39
$shippingAddress
= clone
$billingAddress
;
40
$shippingAddress
->setAddressType(
'shipping'
)
41
->setId(
null
);
42
44
$quote
=
$objectManager
->create(Quote::class);
45
$quote
->setCustomerIsGuest(
true
)
46
->setReservedOrderId(
'100000015'
)
47
->setBillingAddress(
$billingAddress
)
48
->setShippingAddress(
$shippingAddress
);
49
51
$productRepository
=
$objectManager
->get(ProductRepositoryInterface::class);
52
for
(
$i
= 1;
$i
<= 3;
$i
++) {
54
$product
=
$objectManager
->create(ProductInterface::class);
55
$product
->setTypeId(
'simple'
)
56
->setName(
'Simple '
.
$i
)
57
->setSku(
'simple'
.
$i
)
58
->setAttributeSetId(4)
59
->setPrice(5.69 +
$i
* 2)
60
->setWeight(1);
61
63
$stockItem
=
$objectManager
->create(StockItemInterface::class);
64
$stockItem
->setQty(10)
65
->setIsInStock(
true
);
66
$extensionAttributes
=
$product
->getExtensionAttributes();
67
$extensionAttributes
->setStockItem(
$stockItem
);
68
69
$item
=
$productRepository
->save(
$product
);
70
$quote
->addProduct(
$item
,
$i
);
71
}
72
73
$quote
->setCouponCode(
$coupon
->getCode());
74
$quote
->collectTotals();
75
77
$quoteRepository
=
$objectManager
->get(QuoteRepository::class);
78
$quoteRepository
->save(
$quote
);
$shippingAddress
$shippingAddress
Definition:
quote_payflowpro.php:39
Magento\CatalogInventory\Api\Data\StockItemInterface
Definition:
StockItemInterface.php:19
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
$coupon
$coupon
Definition:
fixed_discount.php:34
$stockItem
$stockItem
Definition:
configurable_options_advanced_inventory.php:24
$item
$item
Definition:
partial_invoice.php:27
Magento\Quote\Model\QuoteRepository
Definition:
LoadHandler.php:6
Magento\Catalog\Api\ProductRepositoryInterface
Definition:
ProductRepositoryInterface.php:14
Magento\Quote\Model\Quote\Address
Definition:
BillingAddressPersister.php:6
$addressData
$addressData
Definition:
quote_payflowpro.php:20
$quoteRepository
$quoteRepository
Definition:
quote_payflowpro.php:77
$extensionAttributes
$extensionAttributes
Definition:
payment.php:22
Magento\Quote\Model\Quote
Definition:
AddressTest.php:6
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$objectManager
$objectManager
Definition:
quote_payflowpro.php:18
$quote
$quote
Definition:
quote_payflowpro.php:44
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14
$i
$i
Definition:
gallery.phtml:31
$productRepository
$productRepository
Definition:
quote_payflowpro.php:51
$billingAddress
$billingAddress
Definition:
quote_payflowpro.php:36