public function acceptOrder() { if ($this->order()->save()) { $this->order()->accept(); $this->setOrderAccepted(); // delete all scheduled abandoned cart notifications \Shop\Models\CartsAbandoned::deleteQueuedEmails($this->cart()); $this->cart()->remove(); \Dsc\System::instance()->get('session')->set('shop.just_completed_order', true); \Dsc\System::instance()->get('session')->set('shop.just_completed_order_id', (string) $this->__order->id); } return $this; }
protected function afterSave() { parent::afterSave(); // cart has been updated, // so delete all scheduled abandoned cart notifications \Shop\Models\CartsAbandoned::deleteQueuedEmails($this); // and reset its array of email notifications $this->abandoned_notifications = array(); $this->store(); }