_setMessage($message, static::MSG_LOCKED); parent::_init(); $this->_initOrder(); return $this; } protected function _lock() { $result = parent::_lock(); if (!$result) { $this->_setBackUrl($this->_getBackUrl(PARENT_PAGE_FINAL)); } return $result; } protected function _isLocked() { $result = parent::_isLocked(); if ($result) { $this->_setBackUrl($this->_getBackUrl(PARENT_PAGE_FINAL)); } return $result; } protected function _initOrder() { App_ECommerce_Order_Admin_View::getTabs()->addTabs(); $param = $this->getRestParam(1); $action = $this->getRestParam(0); if (null !== Qs_Request::getRequestValue('action')) { $action = Qs_Request::getRequestValue('action'); } if (count($this->getRestParams()) == 2 && filter_var($param, FILTER_VALIDATE_INT)) { $this->_getDataObj()->setPrimaryKey($param); if (!$this->_getDataObj()->getData() || !$this->_getDataObj()->isValidPage()) { $this->_setBackUrl(Qs_SiteMap::findFirst(null, ['type' => 'ECommerce_Order_Admin_'], null, 'url')); $this->_setBackError(static::MSG_DATA_UNAVAILABLE); $this->_doBack(); } $this->setAction($action); $this->_getDataObj()->clearData(); } else { $this->_setBackUrl(Qs_SiteMap::findFirst(null, ['type' => 'ECommerce_Order_Admin_'], null, 'url')); $this->_setBackError(static::MSG_DATA_UNAVAILABLE); $this->_doBack(); } } protected function _getCart() { if (null === $this->_cart) { $this->_cart = new App_ECommerce_Cart_Admin_Obj(); $this->_cart->setPrimaryKey( $this->_cart->getCartIdByTransaction($this->_getDataObj()->getPrimaryKey()) ); } return $this->_cart; } protected function _doNextAjax() { $form = $this->_getNewForm(); $this->_displayJson($form->validateAjax()); } protected function _doCancel() { $orderUrl = Qs_SiteMap::findFirst('', 'url'); if ($this->getRestParam(0) == 'new') { $orderUrl .= '?action=cancelOrder&id=' . $this->getRestParam(1); } $this->_setBackUrl($orderUrl); parent::_doCancel(); } protected function _doEdit() { if (!$this->_lock()) { $this->_setBackAttention($this->_createMessage(static::MSG_LOCKED, $this->_getLocker())); $this->_doBack(); } return $this->_doNew(); } protected function _prepareShippingData($orderData, $validate = true) { $this->_setBackUrl( Qs_SiteMap::findFirst(null, ['type' => 'ECommerce_Order_Admin_Customer_'], null, 'url') . '/' . App_ECommerce_Order_Admin_View::getTabs()->getRestAlias() ); return parent::_prepareShippingData($orderData, $validate); } }