mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 17:27:36 +00:00
- replaced release version with package version in @since and @depreacated tags - removed @since tag from private properties/methods and non @api classes
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Bundle\Model\Plugin;
|
|
|
|
use Magento\Quote\Model\Quote\Item\ToOrderItem;
|
|
use Magento\Sales\Api\Data\OrderItemInterface;
|
|
use Magento\Quote\Model\Quote\Item\AbstractItem;
|
|
|
|
/**
|
|
* Plugin for Magento\Quote\Model\Quote\Item\ToOrderItem
|
|
*/
|
|
class QuoteItem
|
|
{
|
|
/**
|
|
* Add bundle attributes to order data
|
|
*
|
|
* @param ToOrderItem $subject
|
|
* @param OrderItemInterface $orderItem
|
|
* @param AbstractItem $item
|
|
* @param array $data
|
|
* @return OrderItemInterface
|
|
*
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
*/
|
|
public function afterConvert(ToOrderItem $subject, OrderItemInterface $orderItem, AbstractItem $item, $data = [])
|
|
{
|
|
if ($attributes = $item->getProduct()->getCustomOption('bundle_selection_attributes')) {
|
|
$productOptions = $orderItem->getProductOptions();
|
|
$productOptions['bundle_selection_attributes'] = $attributes->getValue();
|
|
$orderItem->setProductOptions($productOptions);
|
|
}
|
|
|
|
return $orderItem;
|
|
}
|
|
}
|