コード例 #1
0
 /**
  * @param Varien_Event_Observer
  * @return EbayEnterprise_Inventory_Model_Observer
  * @throws EbayEnterprise_Inventory_Exception_Quantity_Unavailable_Exception
  * @throws Exception
  */
 public function handleAfterSetItemQty(Varien_Event_Observer $observer)
 {
     /** @var Mage_Sales_Model_Quote_Item $item */
     $item = $observer->getEvent()->getItem();
     try {
         $this->quantityService->checkQuoteItemInventory($item);
     } catch (EbayEnterprise_Inventory_Exception_Quantity_Collector_Exception $e) {
         $this->logger->logException($e, $this->logContext->getMetaData(__CLASS__, [], $e));
         $this->logger->warning('Caught the following exception: {exception_message}.', $this->logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
     } catch (EbayEnterprise_Inventory_Exception_Quantity_Unavailable_Exception $e) {
         $this->logger->logException($e, $this->logContext->getMetaData(__CLASS__, [], $e));
         $this->logger->warning('Caught the following exception: {exception_message}.', $this->logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
         if ($this->app->getStore()->isAdmin()) {
             // Handling admin exception here because it is not
             // being caught in the admin controller causing it
             // to display exception traces in the page.
             return $this->handleAdminOrderException($e, $item->getQuote());
         }
         // Continue to throw the exception in the frontend and let
         // the frontend controller handle it.
         throw $e;
     }
     return $this;
 }