* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 1.4 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminGroupShop extends AdminTab { public function __construct() { $this->table = 'group_shop'; $this->className = 'GroupShop'; $this->edit = true; $this->delete = false; $this->deleted = false; $this->fieldsDisplay = array( 'id_group_shop' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('County'), 'width' => 130, 'filter_key' => 'b!name'), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active')); parent::__construct(); } public function postProcess() { if (Tools::isSubmit('delete'.$this->table) OR Tools::isSubmit('status') OR Tools::isSubmit('status'.$this->table)) { $object = $this->loadObject(); if(GroupShop::getTotalGroupShops() == 1) $this->_errors[] = Tools::displayError('You cannot delete or disable the last groupshop.'); elseif($object->haveShops()) $this->_errors[] = Tools::displayError('You cannot delete or disable a groupshop which have this shops using it.'); if (sizeof($this->_errors)) return false; } return parent::postProcess(); } public function displayForm($isMainTab = true) { parent::displayForm($isMainTab); if (!($obj = $this->loadObject(true))) return; if (Shop::getTotalShops() > 1 AND $obj->id) $disabled = 'disabled="disabled"'; else $disabled = ''; echo '
'; } }