This commit is contained in:
1 parent
9247fd7971
commit
692c1e9c8d
2 files changed
+8
-6
No files matched your search
@@ -1232,6 +1232,7 @@ class AdminProducts extends AdminTab
|
|||||||
$this->copyFromPost($object, $this->table);
|
$this->copyFromPost($object, $this->table);
|
||||||
if ($object->add())
|
if ($object->add())
|
||||||
{
|
{
|
||||||
|
$this->updateAssoShop((int)$object->id);
|
||||||
$this->updateAccessories($object);
|
$this->updateAccessories($object);
|
||||||
if (!$this->updatePackItems($object))
|
if (!$this->updatePackItems($object))
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
$this->_errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||||
|
|||||||
@@ -848,14 +848,15 @@ abstract class AdminTabCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function updateAssoGroupShop()
|
protected function updateAssoGroupShop($id_object = false)
|
||||||
{
|
{
|
||||||
$assos = array();
|
$assos = array();
|
||||||
foreach ($_POST AS $k => $row)
|
foreach ($_POST AS $k => $row)
|
||||||
{
|
{
|
||||||
if (!preg_match('/^checkBoxGroupShopAsso_'.$this->table.'_([0-9]+)_([0-9]+)$/Ui', $k, $res))
|
if (!preg_match('/^checkBoxGroupShopAsso_'.$this->table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
|
||||||
continue;
|
continue;
|
||||||
$assos[] = array('id_object' => $res[1], 'id_group_shop' => (int)$res[2]);
|
$id_asso_object = (!empty($res[1]) ? $res[1] : $id_object);
|
||||||
|
$assos[] = array('id_object' => (int)$id_asso_object, 'id_group_shop' => (int)$res[2]);
|
||||||
}
|
}
|
||||||
if (!sizeof($assos))
|
if (!sizeof($assos))
|
||||||
return;
|
return;
|
||||||
@@ -871,13 +872,13 @@ abstract class AdminTabCore
|
|||||||
|
|
||||||
foreach ($_POST AS $k => $row)
|
foreach ($_POST AS $k => $row)
|
||||||
{
|
{
|
||||||
if (!preg_match('/^checkBoxShopAsso_'.$this->table.'_([0-9]+)_([0-9]+)$/Ui', $k, $res))
|
if (!preg_match('/^checkBoxShopAsso_'.$this->table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
|
||||||
continue;
|
continue;
|
||||||
$assos[] = array('id_object' => $res[1], 'id_shop' => (int)$res[2]);
|
$id_asso_object = (!empty($res[1]) ? $res[1] : $id_object);
|
||||||
|
$assos[] = array('id_object' => (int)$id_asso_object, 'id_shop' => (int)$res[2]);
|
||||||
}
|
}
|
||||||
if (!sizeof($assos))
|
if (!sizeof($assos))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_shop'.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_shop'.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||||
foreach ($assos AS $asso)
|
foreach ($assos AS $asso)
|
||||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_shop(`'.pSQL($this->identifier).'`, id_shop)
|
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_shop(`'.pSQL($this->identifier).'`, id_shop)
|
||||||
|
|||||||
Reference in new issue
Block a user