public function postProcess() { if (Tools::isSubmit('delete' . $this->table) || Tools::isSubmit('status') || Tools::isSubmit('status' . $this->table)) { $object = $this->loadObject(); if (ShopGroup::getTotalShopGroup() == 1) { $this->errors[] = Tools::displayError('You cannot delete or disable the last shop group.'); } elseif ($object->haveShops()) { $this->errors[] = Tools::displayError('You cannot delete or disable a shop group in use.'); } if (count($this->errors)) { return false; } } return parent::postProcess(); }
public function postProcess() { if (Tools::isSubmit('delete' . $this->table) || Tools::isSubmit('status') || Tools::isSubmit('status' . $this->table)) { /** @var ShopGroup $object */ $object = $this->loadObject(); if (ShopGroup::getTotalShopGroup() == 1) { $this->errors[] = $this->trans('You cannot delete or disable the last shop group.', array(), 'Admin.Notifications.Error'); } elseif ($object->haveShops()) { $this->errors[] = $this->trans('You cannot delete or disable a shop group in use.', array(), 'Admin.Notifications.Error'); } if (count($this->errors)) { return false; } } return parent::postProcess(); }