51 \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface
125 abstract public function getQuote();
142 if (
$product ===
null && $this->getProductId()) {
143 $product = clone $this->productRepository->getById(
144 $this->getProductId(),
155 if (is_array($this->_optionsByCode)) {
156 $product->setCustomOptions($this->_optionsByCode);
180 parent::beforeSave();
196 $this->_parentItem = $parentItem;
197 $parentItem->addChild($this);
230 $this->setHasChildren(
true);
231 $this->_children[] = $child;
244 if (!is_array($messages)) {
245 $messages = [$messages];
248 if (!in_array(
$message, $messagesExists)) {
276 return join(
"\n", $this->_messages);
289 foreach ($this->_messages as $key =>
$message) {
291 unset($this->_messages[$key]);
306 $this->_messages = [];
317 return $this->
getQuote()->getStore();
345 $this->
setHasError(
true)->setMessage($e->getMessage());
349 __(
'Some of the products below do not have all the required options.')
352 $this->
setHasError(
true)->setMessage(
__(
'Something went wrong during the item options declaration.'));
353 $this->
getQuote()->setHasError(
true)->addMessage(
__(
'We found an item options declaration error.'));
357 $this->
setHasError(
true)->setMessage(
__(
'Some of the selected options are not currently available.'));
361 if ($this->getHasConfigurationUnavailableError()) {
365 __(
'Selected option(s) or their combination is not currently available.')
370 __(
'Some item options or their combination are not currently available.'),
371 'unavailable-configuration' 373 $this->unsHasConfigurationUnavailableError();
414 $this->setRowTotal($this->priceCurrency->round($total));
415 $this->setBaseRowTotal($this->priceCurrency->round($baseTotal));
429 if ($this->hasCustomPrice()) {
430 $price = $this->getCustomPrice();
449 if ($this->hasOriginalCustomPrice()) {
450 $price = $this->getOriginalCustomPrice();
466 if (!$this->hasBaseCalculationPrice()) {
467 if ($this->hasCustomPrice()) {
468 $price = (double)$this->getCustomPrice();
476 $this->setBaseCalculationPrice(
$price);
478 return $this->
_getData(
'base_calculation_price');
488 if (!$this->hasBaseCalculationPrice()) {
489 if ($this->hasOriginalCustomPrice()) {
490 $price = (double)$this->getOriginalCustomPrice();
498 $this->setBaseCalculationPrice(
$price);
500 return $this->
_getData(
'base_calculation_price');
537 return $this->
_getData(
'base_original_price');
548 $this->setCalculationPrice(
$value);
549 $this->setBaseCalculationPrice(
null);
571 $this->setBaseCalculationPrice(
null);
597 $this->setCalculationPrice(
null);
610 $this->_parentItem =
null;
611 $this->_children = [];
612 $this->_messages = [];
625 $calculate = $this->
getParentItem()->getProduct()->getPriceType();
627 $calculate = $this->
getProduct()->getPriceType();
630 if (
null !== $calculate &&
647 $shipmentType = $this->
getParentItem()->getProduct()->getShipmentType();
649 $shipmentType = $this->
getProduct()->getShipmentType();
652 if (
null !== $shipmentType &&
653 (
int)$shipmentType === \
Magento\Catalog\Model\
Product\
Type\AbstractType::SHIPMENT_SEPARATELY
668 $totalDiscountAmount = 0;
673 $totalDiscountAmount += $child->getDiscountAmount();
676 $totalDiscountAmount = $this->getDiscountAmount();
678 return $totalDiscountAmount;
removeMessageByText($text)
getBaseCalculationPriceOriginal()
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
getCalculationPriceOriginal()
setParentItem($parentItem)
getBaseCalculationPrice()
setConvertedPrice($value)
setData($key, $value=null)