Example #1
0
 /**
  * Update order
  *
  * PUT /api/orders/{id}
  */
 public function putAction()
 {
     $id = $this->Request()->getParam('id');
     $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0);
     $params = $this->Request()->getPost();
     if ($useNumberAsId) {
         $order = $this->resource->updateByNumber($id, $params);
     } else {
         $order = $this->resource->update($id, $params);
     }
     $location = $this->apiBaseUrl . 'orders/' . $order->getId();
     $data = array('id' => $order->getId(), 'location' => $location);
     $this->View()->assign(array('success' => true, 'data' => $data));
 }
Example #2
0
    /**
     * Update order
     *
     * PUT /api/orders/{id}
     */
    public function putAction()
    {
        $id = $this->Request()->getParam('id');
        $params = $this->Request()->getPost();

        $order = $this->resource->update($id, $params);

        $location = $this->apiBaseUrl . 'orders/' . $order->getId();
        $data = array(
            'id'       => $order->getId(),
            'location' => $location
        );

        $this->View()->assign(array('success' => true, 'data' => $data));
        $this->Response()->setHeader('Location', $location);
    }
 /**
  * Stores the id of the created order into the plenty_order table
  *
  * @param Enlight_Event_EventArgs $arguments
  * @return boolean
  */
 public function onOrderSaveOrderProcessDetails(Enlight_Event_EventArgs $arguments)
 {
     $orderResource = new \Shopware\Components\Api\Resource\Order();
     $orderResource->setManager(Shopware()->Models());
     $orderId = $orderResource->getIdFromNumber($arguments->getSubject()->sOrderNumber);
     Shopware()->Db()->query('
 		INSERT INTO plenty_order
 			SET shopwareId = ?
 	', array($orderId));
     return true;
 }