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
module-catalog
Model
Plugin
QuoteItemProductOption.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Model\Plugin
;
7
8
use
Magento\Quote\Model\Quote\Item\ToOrderItem
as QuoteToOrderItem;
9
use
Magento\Quote\Model\Quote\Item\AbstractItem
as AbstractQuoteItem;
10
use
Magento\Catalog\Api\Data\ProductCustomOptionInterface
as
ProductOption
;
11
15
class
QuoteItemProductOption
16
{
27
public
function
beforeConvert
(
28
QuoteToOrderItem $subject,
29
AbstractQuoteItem
$quoteItem
,
30
$data
= []
31
) {
32
if
(!is_array(
$quoteItem
->getOptions())) {
33
return
;
34
}
35
36
foreach
(
$quoteItem
->getOptions() as $itemOption) {
37
$code
= explode(
'_'
, $itemOption->getCode());
38
39
if
(!isset(
$code
[1]) || !is_numeric(
$code
[1])) {
40
continue
;
41
}
42
43
$option
=
$quoteItem
->getProduct()->getOptionById(
$code
[1]);
44
45
if
(!
$option
||
$option
->getType() != ProductOption::OPTION_TYPE_FILE) {
46
continue
;
47
}
48
49
try
{
50
$option
->groupFactory(
$option
->getType())
51
->setQuoteItemOption($itemOption)
52
->copyQuoteToOrder();
53
}
catch
(\Exception $e) {
54
continue
;
55
}
56
}
57
}
58
}
Magento\Catalog\Model\Product\Option
Magento\Catalog\Model\Plugin
Definition:
Log.php:8
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$quoteItem
$quoteItem
Definition:
quote.php:38
Magento\Catalog\Model\Plugin\QuoteItemProductOption
Definition:
QuoteItemProductOption.php:15
Magento\Quote\Model\Quote\Item\ToOrderItem
Definition:
ToOrderItem.php:18
Magento\Catalog\Model\Plugin\QuoteItemProductOption\beforeConvert
beforeConvert(QuoteToOrderItem $subject, AbstractQuoteItem $quoteItem, $data=[])
Definition:
QuoteItemProductOption.php:27
Magento\Quote\Model\Quote\Item\AbstractItem
Definition:
AbstractItem.php:50
$option
$option
Definition:
product_configurable_with_single_child.php:38
Magento\Catalog\Api\Data\ProductCustomOptionInterface
Definition:
ProductCustomOptionInterface.php:13
$code
$code
Definition:
info.phtml:12