public static function updateTagOrdering() { $ids = $_POST['ids']; $response = new stdClass(); if ($ids) { $strIds = implode(', ', $ids); $minOrder = DB::getInstance()->getValue("Select Min(ordering) From " . _DB_PREFIX_ . "ovic_custom_tags_tags Where id IN ({$strIds})"); foreach ($ids as $i => $id) { DB::getInstance()->query("Update " . _DB_PREFIX_ . "ovic_custom_tags_tags Set ordering=" . ($minOrder + $i) . " Where id = " . $id); } $module = new OvicCustomTags(); $module->clearCache(); $response->status = 1; $response->msg = 'Update ordering success!'; } else { $response->status = 0; $response->msg = 'Update ordering not success!'; } die(Tools::jsonEncode($response)); }
<?php require_once dirname(__FILE__) . '../../../config/config.inc.php'; require_once dirname(__FILE__) . '../../../init.php'; require_once dirname(__FILE__) . '/oviccustomtags.php'; $module = new OvicCustomTags(); if (!Tools::isSubmit('secure_key') || Tools::getValue('secure_key') != $module->secure_key || !Tools::getValue('action')) { $response = new stdClass(); $response->status = 0; $response->msg = "you need to login with the admin account."; die(Tools::jsonEncode($response)); } $module->clearCache(); $action = Tools::getValue('action'); OvicCustomTagAjax::$action(); class OvicCustomTagAjax { static function saveGroup() { $db = DB::getInstance(); $module = new OvicCustomTags(); $shopId = Context::getContext()->shop->id; $languages = $module->getAllLanguages(); $itemId = Tools::getValue('groupId'); $names = Tools::getValue('names', array()); $position = intval($_POST['position']); $position_name = Hook::getNameById($position); $arrParams = array('background' => Tools::getValue('background', '#82A3CC'), 'color' => Tools::getValue('color', '#ffffff')); $params = json_encode($arrParams); //$module->clearCache(); $response = new stdClass();