init
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Stemcell\Checkout\Block\Cart\Item\Bundle;
|
||||
|
||||
use Magento\Bundle\Helper\Catalog\Product\Configuration;
|
||||
use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface;
|
||||
use Magento\Customer\Model\Session;
|
||||
use Magento\Framework\Data\CollectionFactory;
|
||||
use Magento\Framework\Pricing\PriceCurrencyInterface;
|
||||
use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
|
||||
use Stemcell\Customer\Model\ResourceModel;
|
||||
|
||||
class Renderer extends \Stemcell\Checkout\Block\Cart\Item\Renderer
|
||||
{
|
||||
/**
|
||||
* Bundle catalog product configuration
|
||||
*
|
||||
* @var Configuration
|
||||
*/
|
||||
protected Configuration $_bundleProductConfiguration;
|
||||
|
||||
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,
|
||||
ResourceModel\Lab\Collection $labCollection,
|
||||
ResourceModel\Salesperson\Collection $salespersonCollection,
|
||||
CollectionFactory $baseCollectionFactory,
|
||||
Session $customerSession,
|
||||
Configuration $bundleProductConfiguration,
|
||||
array $data = [],
|
||||
ItemResolverInterface $itemResolver = null
|
||||
) {
|
||||
$this->_bundleProductConfiguration = $bundleProductConfiguration;
|
||||
parent::__construct(
|
||||
$context,
|
||||
$productConfig,
|
||||
$checkoutSession,
|
||||
$imageBuilder,
|
||||
$urlHelper,
|
||||
$messageManager,
|
||||
$priceCurrency,
|
||||
$moduleManager,
|
||||
$messageInterpretationStrategy,
|
||||
$labCollection,
|
||||
$salespersonCollection,
|
||||
$baseCollectionFactory,
|
||||
$customerSession,
|
||||
$data,
|
||||
$itemResolver
|
||||
);
|
||||
}
|
||||
|
||||
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 occurring during this page load
|
||||
$baseMessages = $quoteItem->getMessage(false);
|
||||
if ($baseMessages) {
|
||||
foreach ($baseMessages as $message) {
|
||||
$messages[] = ['text' => $message, 'type' => $quoteItem->getHasError() ? 'error' : 'notice'];
|
||||
}
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user