_addMessageTemplate( static::MSG_NOT_ALLOWED_DELETE, 'You cannot delete this %itemName% because it has subcategories and/or the products are tied to it' ); return $this; } protected function _doList() { $this->_saveBackUrl(); $this->_addFilterItem(); $this->_addLinksItem(); $categoryTree= $this->_getDataObj()->getCategoryTree(); $item = array( 'list' => $categoryTree, '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/category/tree.js'); $this->_doc->addInitObject('App_Product_Category_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 $messagePlaceholders = null) { $isSubcategory = false; 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) { $messagePlaceholders['itemName'] = $this->getConfig('subItemName'); $messagePlaceholders['itemsName'] = $this->getConfig('subItemsName'); } return parent::_createMessage($messageKey, $messagePlaceholders); } protected function _createHeader($headerKey) { if (!isset($this->_pageHeaderTemplates[$headerKey])) { return null; } $messagePlaceholders = $this->_messagePlaceholders; if ((Qs_Request::getRequestValue('parentId') || $this->_getDataObj()->getData('parentId')) || (in_array($this->_action, array('reorder')) && Qs_Request::getRequestValue('id')) ) { $messagePlaceholders['itemName'] = $this->getConfig('subItemName'); $messagePlaceholders['itemsName'] = $this->getConfig('subItemsName'); } return $this->_renderMessage($this->_pageHeaderTemplates[$headerKey], $messagePlaceholders); } 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; } }