Exemplo n.º 1
0
 /**
  * Adds error information to the quote.
  * Automatically sets error flag.
  *
  * @param string $type An internal error type ('error', 'qty', etc.), passed then to adding messages routine
  * @param string|null $origin Usually a name of module, that embeds error
  * @param int|null $code Error code, unique for origin, that sets it
  * @param string|null $message Error message
  * @param \Magento\Framework\Object|null $additionalData Any additional data, that caller would like to store
  * @return $this
  */
 public function addErrorInfo($type = 'error', $origin = null, $code = null, $message = null, $additionalData = null)
 {
     if (!isset($this->_errorInfoGroups[$type])) {
         $this->_errorInfoGroups[$type] = $this->_statusListFactory->create();
     }
     $this->_errorInfoGroups[$type]->addItem($origin, $code, $message, $additionalData);
     if ($message !== null) {
         $this->addMessage($message, $type);
     }
     $this->_setHasError(true);
     return $this;
 }
Exemplo n.º 2
0
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param ExtensionAttributesFactory $extensionFactory
  * @param AttributeValueFactory $customAttributeFactory
  * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
  * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
  * @param \Magento\Sales\Model\Status\ListFactory $statusListFactory
  * @param \Magento\Framework\Locale\FormatInterface $localeFormat
  * @param Item\OptionFactory $itemOptionFactory
  * @param Item\Compare $quoteItemCompare
  * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
  * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
  * @param array $data
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, \Magento\Sales\Model\Status\ListFactory $statusListFactory, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Quote\Model\Quote\Item\OptionFactory $itemOptionFactory, \Magento\Quote\Model\Quote\Item\Compare $quoteItemCompare, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     $this->_errorInfos = $statusListFactory->create();
     $this->_localeFormat = $localeFormat;
     $this->_itemOptionFactory = $itemOptionFactory;
     $this->quoteItemCompare = $quoteItemCompare;
     $this->stockRegistry = $stockRegistry;
     parent::__construct($context, $registry, $extensionFactory, $customAttributeFactory, $productRepository, $priceCurrency, $resource, $resourceCollection, $data);
 }
Exemplo n.º 3
0
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Catalog\Model\ProductFactory $productFactory
  * @param \Magento\Sales\Model\Status\ListFactory $statusListFactory
  * @param \Magento\Framework\Locale\FormatInterface $localeFormat
  * @param Item\OptionFactory $itemOptionFactory
  * @param \Magento\Sales\Helper\Quote\Item\Compare $compareHelper
  * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService
  * @param \Magento\Framework\Model\Resource\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\Db $resourceCollection
  * @param array $data
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Sales\Model\Status\ListFactory $statusListFactory, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, \Magento\Sales\Helper\Quote\Item\Compare $compareHelper, \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array())
 {
     $this->_errorInfos = $statusListFactory->create();
     $this->_localeFormat = $localeFormat;
     $this->_itemOptionFactory = $itemOptionFactory;
     $this->_compareHelper = $compareHelper;
     $this->stockItemService = $stockItemService;
     parent::__construct($context, $registry, $productFactory, $resource, $resourceCollection, $data);
 }