_addMessageTemplate( static::MSG_NOT_ALLOWED_DELETE, 'You cannot delete this %itemName% because it has subcategories and/or the products tied to it' ); return $this; } protected function _doList() { $this->_saveBackUrl(); $this->_addFilterItem(); $this->_addLinksItem(); $item = array( 'list' => $this->_getDataObj()->getCategoryTree(), 'link' => array('product' => Qs_SiteMap::getAliasByItem('ECommerce_Product_Admin_')), 'tpl' => $this->getTemplate('list.tpl'), ); $this->_addItem($item); $this->_doc->addStylesheet('css/thirdpart/jquery.treeview.css'); $this->_doc->addScript('js/jquery.treeview.js'); $this->_doc->addScript('js/app/ECommerce/product/tree.js'); $this->_doc->addInitObject('App_Product_Tree'); $this->_postList(); return $this; } protected function _doDelete() { if (!$this->_getDataObj()->isAllowDelete()) { $this->_setBackError(self::MSG_NOT_ALLOWED_DELETE); $this->_doBack(); } parent::_doDelete(); } protected function _createMessage($messageKey, array $messageVariables = null) { if ('delete' == $this->_action) { $isSubcategory = (0 != $this->_getDataObj()->getData('parentId')); } else if ('updateOrder' == $this->_action) { $this->_getDataObj()->clearData(); $isSubcategory = (null !== $this->_getDataObj()->getData('parentId')); } else { $this->_getDataObj()->clearData(); $isSubcategory = (0 != $this->_getDataObj()->getData('parentId')); } if ($isSubcategory) { $messageVariables['itemName'] = $this->getConfig('subItemName'); $messageVariables['itemsName'] = $this->getConfig('subItemsName'); } return parent::_createMessage($messageKey, $messageVariables); } protected function _createHeader($headerKey) { if (!isset($this->_pageHeaderTemplates[$headerKey])) { return null; } $messageVariables = array(); if ((Qs_Request::getRequestValue('parentId') || $this->_getDataObj()->getData('parentId')) || (in_array($this->_action, array('reorder')) && Qs_Request::getRequestValue('id')) ) { $messageVariables['itemName'] = $this->getConfig('subItemName'); $messageVariables['itemsName'] = $this->getConfig('subItemsName'); } return $this->_renderMessage($this->_pageHeaderTemplates[$headerKey], $messageVariables); } protected function _doNew() { $options = array(); $options['defaults'] = array( 'parentId' => (int) Qs_Request::getRequestValue('parentId', 0), 'enabled' => 'y' ); $form = $this->_getNewForm($options); $form->setDefaults(); $this->_addFormItem($form); $this->_postNew(); return $this; } protected function _getDefaultLinks() { $links = parent::_getDefaultLinks(); unset($links['reorder']); return $links; } }