Example #1
0
 public function saveOrder($Data)
 {
     $Data['clientaddress']['phone'] = $Data['contactData']['phone'];
     $Data['clientaddress']['phone2'] = $Data['contactData']['phone2'];
     $Data['clientaddress']['email'] = $Data['contactData']['email'];
     $Data['deliveryAddress']['phone'] = $Data['contactData']['phone'];
     $Data['deliveryAddress']['phone2'] = $Data['contactData']['phone2'];
     $Data['deliveryAddress']['email'] = $Data['contactData']['email'];
     Db::getInstance()->beginTransaction();
     try {
         $clientId = $Data['clientid'];
         if ($clientId == NULL || $clientId == 0) {
             $clientId = Session::getActiveClientid();
         }
         $orderId = $this->addOrder($Data, $clientId);
         $this->addOrderClientData($Data['clientaddress'], $clientId, $orderId);
         $this->addOrderClientDeliveryData($Data['deliveryAddress'], $orderId);
         $this->addOrderProduct($Data['cart'], $orderId);
         App::getModel('order')->updateSessionString($orderId);
         $this->syncStock();
         Event::dispatch($this, 'frontend.order.saveOrder', array('id' => $orderId, 'data' => $Data));
     } catch (Exception $e) {
         throw new FrontendException($e->getMessage());
     }
     Db::getInstance()->commit();
     return $orderId;
 }
Example #2
0
 public function save($Data, $id = 0)
 {
     Db::getInstance()->beginTransaction();
     try {
         if ($id > 0) {
             $this->deleteView($id);
             $this->deleteTranslation($id);
             $this->deleteDeliverer($id);
             $this->updateProducer($Data, $id);
             $this->updateProducerPhoto($Data, $id);
         } else {
             $id = $this->addProducer($Data);
         }
         $this->addDeliverer($Data['deliverer'], $id);
         $this->addView($Data['view'], $id);
         $this->addTranslation($Data, $id);
         Event::dispatch($this, 'admin.producer.model.save', array('id' => $id, 'data' => $Data));
     } catch (Exception $e) {
         throw new CoreException(_('ERR_PRODUCER_SAVE'), 10, $e->getMessage());
     }
     Db::getInstance()->commit();
 }
Example #3
0
 /**
  * Fires an event, which will notify the handlers for the event $identifier.
  * 
  * @param string $identifier
  * @param \Notify\Event $event
  * @return \Notify\Event
  */
 public function trigger($identifier, Event $event)
 {
     return $event->dispatch($this, $this->getListenerQueue($identifier));
 }