123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Bundle\Block\Checkout\Cart\Item;
- use Magento\Bundle\Helper\Catalog\Product\Configuration;
- use Magento\Framework\Pricing\PriceCurrencyInterface;
- use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
- /**
- * Shopping cart item render block
- *
- * @api
- * @since 100.0.2
- */
- class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer
- {
- /**
- * Bundle catalog product configuration
- *
- * @var Configuration
- */
- protected $_bundleProductConfiguration = null;
- /**
- * @param \Magento\Framework\View\Element\Template\Context $context
- * @param \Magento\Catalog\Helper\Product\Configuration $productConfig
- * @param \Magento\Checkout\Model\Session $checkoutSession
- * @param \Magento\Catalog\Block\Product\ImageBuilder|\Magento\Catalog\Helper\Image $imageBuilder
- * @param \Magento\Framework\Url\Helper\Data $urlHelper
- * @param \Magento\Framework\Message\ManagerInterface $messageManager
- * @param PriceCurrencyInterface $priceCurrency
- * @param \Magento\Framework\Module\Manager $moduleManager
- * @param InterpretationStrategyInterface $messageInterpretationStrategy
- * @param Configuration $bundleProductConfiguration
- * @param array $data
- * @SuppressWarnings(PHPMD.ExcessiveParameterList)
- */
- public function __construct(
- \Magento\Framework\View\Element\Template\Context $context,
- \Magento\Catalog\Helper\Product\Configuration $productConfig,
- \Magento\Checkout\Model\Session $checkoutSession,
- \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder,
- \Magento\Framework\Url\Helper\Data $urlHelper,
- \Magento\Framework\Message\ManagerInterface $messageManager,
- PriceCurrencyInterface $priceCurrency,
- \Magento\Framework\Module\Manager $moduleManager,
- InterpretationStrategyInterface $messageInterpretationStrategy,
- Configuration $bundleProductConfiguration,
- array $data = []
- ) {
- $this->_bundleProductConfiguration = $bundleProductConfiguration;
- parent::__construct(
- $context,
- $productConfig,
- $checkoutSession,
- $imageBuilder,
- $urlHelper,
- $messageManager,
- $priceCurrency,
- $moduleManager,
- $messageInterpretationStrategy,
- $data
- );
- $this->_isScopePrivate = true;
- }
- /**
- * Overloaded method for getting list of bundle options
- * Caches result in quote item, because it can be used in cart 'recent view' and on same page in cart checkout
- *
- * @return array
- */
- public function getOptionList()
- {
- return $this->_bundleProductConfiguration->getOptions($this->getItem());
- }
- /**
- * Return cart item error messages
- *
- * @return array
- */
- public function getMessages()
- {
- $messages = [];
- $quoteItem = $this->getItem();
- // Add basic messages occuring during this page load
- $baseMessages = $quoteItem->getMessage(false);
- if ($baseMessages) {
- foreach ($baseMessages as $message) {
- $messages[] = ['text' => $message, 'type' => $quoteItem->getHasError() ? 'error' : 'notice'];
- }
- }
- return $messages;
- }
- }
|