Example #1
0
 private function changeProductQty(Ess_M2ePro_Model_Magento_Product $magentoProduct, Ess_M2ePro_Model_Magento_Product_StockItem $magentoStockItem, $action, $qty)
 {
     $result = true;
     switch ($action) {
         case self::ACTION_ADD:
             $magentoStockItem->addQty($qty, false);
             break;
         case self::ACTION_SUB:
             try {
                 $magentoStockItem->subtractQty($qty, false);
             } catch (Exception $e) {
                 $result = false;
                 $this->order->setActionRequired(true);
                 $this->order->addErrorLog('Qty for product "%name%" cannot be reserved. Reason: %msg%', array('!name' => $magentoProduct->getName(), 'msg' => $e->getMessage()));
             }
             break;
     }
     return $result;
 }
Example #2
0
 public function getName()
 {
     $cacheKey = array(__METHOD__);
     if ($this->isCacheEnabled && !is_null($cacheResult = $this->getCache()->getData($cacheKey))) {
         return $cacheResult;
     }
     return $this->getCache()->setData($cacheKey, parent::getName());
 }