KJ\Magento\Command\Order\Create\DummyCommand::addItemToQuote PHP Method

addItemToQuote() protected method

protected addItemToQuote ( )
    protected function addItemToQuote()
    {
        $product = $this->getProduct();
        $quote = $this->getQuote();
        $request = null;
        if (!$product->getData('options_readonly')) {
            $customOptions = $this->_getCustomOptions();
            $param = array('product' => $product->getId(), 'qty' => 1, 'options' => $customOptions);
            $request = new \Varien_Object();
            $request->setData($param);
        }
        /** @var \Mage_Sales_Model_Quote_Item $quoteItem */
        $quoteItem = $quote->addProduct($product, $request);
        if (is_string($quoteItem)) {
            throw new \Exception(sprintf("Error: {$quoteItem}"));
        }
        $quoteItem->setQuote($quote);
        $quoteItem->checkData();
        return $this;
    }