0

I have a custom field in order "order_type". So, when a customer choose an option for order type, it will be saved in quote. It's working in front-end fine. But it's not updating when I am using REST API. My code is as below in V1.php.

    protected function _create(array $data){
       $quoteId=$data['data']['cart_id'];
       $order_type=$data['data']['order_type'];
       try {   
            $store = $this->_getStore();
            $storeId = Mage::app()->getStore($store)->getId();
                    $quote = Mage::getModel('sales/quote')->setStoreId($storeId)->load($quoteId);
                    $quote->setOrderType($order_type);
                    $quote->collectTotals()->save();
            $result=array("success"=>true,"msg"=>"Saved successfully.");
            return $this->getResponse()->appendBody(json_encode($result));
           }
       catch (Mage_Core_Exception $e) {
              $result=array("success"=>false,"msg"=>$e->getMessage());
              return $this->getResponse()->appendBody(json_encode($result));
          } catch (Exception $e) {
              $result=array("success"=>false,"msg"=>"Checckout information not updated.");
              return $this->getResponse()->appendBody(json_encode($result));

           }
       }
  • Can you show your REST api code ? – BornCoder Jan 31 '17 at 12:38
  • I have already posted it. – Prasanta Hatui Jan 31 '17 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.