/**
  * Ajax handler to response configuration fieldset of composite product in quote items
  *
  * @return \Magento\Framework\View\Result\Layout
  */
 public function execute()
 {
     // Prepare data
     $configureResult = new \Magento\Framework\DataObject();
     try {
         $quoteItemId = (int) $this->getRequest()->getParam('id');
         if (!$quoteItemId) {
             throw new \Magento\Framework\Exception\LocalizedException(__('Quote item id is not received.'));
         }
         $quoteItem = $this->_objectManager->create('Magento\\Quote\\Model\\Quote\\Item')->load($quoteItemId);
         if (!$quoteItem->getId()) {
             throw new \Magento\Framework\Exception\LocalizedException(__('Quote item is not loaded.'));
         }
         $configureResult->setOk(true);
         $optionCollection = $this->_objectManager->create('Magento\\Quote\\Model\\Quote\\Item\\Option')->getCollection()->addItemFilter([$quoteItemId]);
         $quoteItem->setOptions($optionCollection->getOptionsByItem($quoteItem));
         $configureResult->setBuyRequest($quoteItem->getBuyRequest());
         $configureResult->setCurrentStoreId($quoteItem->getStoreId());
         $configureResult->setProductId($quoteItem->getProductId());
         $sessionQuote = $this->_objectManager->get('Magento\\Backend\\Model\\Session\\Quote');
         $configureResult->setCurrentCustomerId($sessionQuote->getCustomerId());
     } catch (\Exception $e) {
         $configureResult->setError(true);
         $configureResult->setMessage($e->getMessage());
     }
     // Render page
     /** @var \Magento\Catalog\Helper\Product\Composite $helper */
     $helper = $this->_objectManager->get('Magento\\Catalog\\Helper\\Product\\Composite');
     return $helper->renderConfigureResult($configureResult);
 }
 /**
  * Ajax handler to response configuration fieldset of composite product in order
  *
  * @return \Magento\Framework\View\Result\Layout
  */
 public function execute()
 {
     // Prepare data
     $productId = (int) $this->getRequest()->getParam('id');
     $configureResult = new \Magento\Framework\DataObject();
     $configureResult->setOk(true);
     $configureResult->setProductId($productId);
     $sessionQuote = $this->_objectManager->get('Magento\\Backend\\Model\\Session\\Quote');
     $configureResult->setCurrentStoreId($sessionQuote->getStore()->getId());
     $configureResult->setCurrentCustomerId($sessionQuote->getCustomerId());
     // Render page
     /** @var \Magento\Catalog\Helper\Product\Composite $helper */
     $helper = $this->_objectManager->get('Magento\\Catalog\\Helper\\Product\\Composite');
     return $helper->renderConfigureResult($configureResult);
 }
예제 #3
0
 /**
  * Ajax handler to response configuration fieldset of composite product in customer's wishlist.
  *
  * @return \Magento\Framework\View\Result\Layout
  */
 public function execute()
 {
     $configureResult = new \Magento\Framework\DataObject();
     try {
         $this->_initData();
         $configureResult->setProductId($this->_wishlistItem->getProductId());
         $configureResult->setBuyRequest($this->_wishlistItem->getBuyRequest());
         $configureResult->setCurrentStoreId($this->_wishlistItem->getStoreId());
         $configureResult->setCurrentCustomerId($this->_wishlist->getCustomerId());
         $configureResult->setOk(true);
     } catch (Exception $e) {
         $configureResult->setError(true);
         $configureResult->setMessage($e->getMessage());
     }
     return $this->_objectManager->get('Magento\\Catalog\\Helper\\Product\\Composite')->renderConfigureResult($configureResult);
 }
예제 #4
0
 /**
  * Ajax handler to response configuration fieldset of composite product in customer's cart
  *
  * @return \Magento\Framework\View\Result\Layout
  */
 public function executeInternal()
 {
     $configureResult = new \Magento\Framework\DataObject();
     try {
         $this->_initData();
         $quoteItem = $this->_quoteItem;
         $optionCollection = $this->_objectManager->create('Magento\\Quote\\Model\\Quote\\Item\\Option')->getCollection()->addItemFilter($quoteItem);
         $quoteItem->setOptions($optionCollection->getOptionsByItem($quoteItem));
         $configureResult->setOk(true);
         $configureResult->setProductId($quoteItem->getProductId());
         $configureResult->setBuyRequest($quoteItem->getBuyRequest());
         $configureResult->setCurrentStoreId($quoteItem->getStoreId());
         $configureResult->setCurrentCustomerId($this->_customerId);
     } catch (\Exception $e) {
         $configureResult->setError(true);
         $configureResult->setMessage($e->getMessage());
     }
     return $this->_objectManager->get('Magento\\Catalog\\Helper\\Product\\Composite')->renderConfigureResult($configureResult);
 }