-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/2.4-develop' into spartans_pr_15…
…042024
- Loading branch information
Showing
11 changed files
with
986 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
app/code/Magento/QuoteGraphQl/Model/CartItem/DataProvider/CustomizableOptionValue/File.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* ADOBE CONFIDENTIAL | ||
* | ||
* Copyright 2024 Adobe | ||
* All Rights Reserved. | ||
* | ||
* NOTICE: All information contained herein is, and remains | ||
* the property of Adobe and its suppliers, if any. The intellectual | ||
* and technical concepts contained herein are proprietary to Adobe | ||
* and its suppliers and are protected by all applicable intellectual | ||
* property laws, including trade secret and copyright laws. | ||
* Dissemination of this information or reproduction of this material | ||
* is strictly forbidden unless prior written permission is obtained | ||
* from Adobe. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue; | ||
|
||
use Magento\Catalog\Model\Product\Option; | ||
use Magento\Catalog\Model\Product\Option\Type\Text as TextOptionType; | ||
use Magento\Quote\Model\Quote\Item as QuoteItem; | ||
use Magento\Quote\Model\Quote\Item\Option as SelectedOption; | ||
use Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValueInterface; | ||
|
||
class File implements CustomizableOptionValueInterface | ||
{ | ||
/** | ||
* @param PriceUnitLabel $priceUnitLabel | ||
*/ | ||
public function __construct( | ||
private readonly PriceUnitLabel $priceUnitLabel | ||
) { | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getData( | ||
QuoteItem $cartItem, | ||
Option $option, | ||
SelectedOption $selectedOption | ||
): array { | ||
/** @var TextOptionType $optionTypeRenderer */ | ||
$optionTypeRenderer = $option->groupFactory($option->getType()); | ||
$optionTypeRenderer->setOption($option); | ||
$priceValueUnits = $this->priceUnitLabel->getData($option->getPriceType()); | ||
$optionTypeRenderer->setData('configuration_item_option', $selectedOption); | ||
$value = $optionTypeRenderer->getFormattedOptionValue($selectedOption->getValue()); | ||
$selectedOptionValueData = [ | ||
'id' => $selectedOption->getId(), | ||
'label' => $option->getTitle(), | ||
'value' => $value, | ||
'price' => [ | ||
'type' => strtoupper($option->getPriceType()), | ||
'units' => $priceValueUnits, | ||
'value' => $option->getPrice(), | ||
], | ||
]; | ||
return [$selectedOptionValueData]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.