protected function _preDispatch($action) { $this->_type = $this->_getTypeModel()->getById($this->getRequest()->getParam('type_id', 0)); if (!$this->_type) { $this->_type = $this->_getTypeModel()->getDefault(); } parent::_preDispatch($action); }
protected function _preDispatch($action) { switch (strtolower($this->getRouteMatch()->getAction())) { case 'create': case 'save': $this->_item = []; $this->_type = $this->_getTypeModel()->getById($this->getRequest()->getParam('type_id', 1)); break; default: $this->_item = $this->_getListModel()->getById($this->getRequest()->getParam('listing_id', 0)); $this->_type = $this->_getTypeModel()->getById($this->_item['listing_type_id']); break; } parent::_preDispatch($action); }