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));

           }
       }
2
  • Can you show your REST api code ?
    – BornCoder
    Jan 31, 2017 at 12:38
  • I have already posted it. Jan 31, 2017 at 12:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.