Example #1
0
    protected function updateAssoShop($id_object = false)
    {
        if (!Shop::isFeatureActive()) {
            return;
        }
        if (!($assos = AdminTab::getAssoShop($this->table, $id_object))) {
            return;
        }
        Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . $this->table . '_' . $assos[1] . ($id_object ? ' WHERE `' . $this->identifier . '`=' . (int) $id_object : ''));
        foreach ($assos[0] as $asso) {
            Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . $this->table . '_' . $assos[1] . ' (`' . pSQL($this->identifier) . '`, id_' . $assos[1] . ')
											VALUES(' . (int) $asso['id_object'] . ', ' . (int) $asso['id_' . $assos[1]] . ')');
        }
    }