From 7b558bb16113c0385d635fe0245b0329007e2ac8 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Tue, 21 Aug 2012 15:02:40 +0000 Subject: [PATCH] // fixed #PSCFV-2987 --- controllers/admin/AdminShopController.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php index 8a63002d7..f1a9b2c55 100755 --- a/controllers/admin/AdminShopController.php +++ b/controllers/admin/AdminShopController.php @@ -224,9 +224,22 @@ class AdminShopControllerCore extends AdminController else if (Shop::getTotalShops() == 1) $this->errors[] = Tools::displayError('You cannot disable the last shop.'); }*/ + + if (Tools::isSubmit('submitAddshopAndStay') || Tools::isSubmit('submitAddshop')) + { + $same_name = Db::getInstance()->getValue(' + SELECT id_shop + FROM '._DB_PREFIX_.'shop + WHERE name = "'.pSQL(Tools::getValue('name')).'" + AND id_shop_group = '.(int)Tools::getValue('id_shop_group').' + '.(Tools::getValue('id_shop') ? 'AND id_shop != '.(int)Tools::getValue('id_shop') : '')); + if ($same_name) + $this->errors[] = Tools::displayError('You cannot have 2 shops with the same name in the same group'); + } - if ($this->errors) + if (count($this->errors)) return false; + $result = parent::postProcess(); if ($this->redirect_after)