function loadWeightClasses() { global $toC_Json, $osC_Language, $osC_Database; $data = osC_WeightClasses_Admin::getData($_REQUEST['weight_class_id']); if ($data['weight_class_id'] == SHIPPING_WEIGHT_UNIT) { $data['is_default'] = 1; } $Qwc = $osC_Database->query('select language_id, weight_class_key, weight_class_title from :table_weight_classes where weight_class_id = :weight_class_id'); $Qwc->bindTable(':table_weight_classes', TABLE_WEIGHT_CLASS); $Qwc->bindInt(':weight_class_id', $_REQUEST['weight_class_id']); $Qwc->execute(); while ($Qwc->next()) { $data['name[' . $Qwc->ValueInt('language_id') . ']'] = $Qwc->value('weight_class_title'); $data['key[' . $Qwc->ValueInt('language_id') . ']'] = $Qwc->value('weight_class_key'); } $Qwc->freeResult(); $Qrules = $osC_Database->query('select r.weight_class_to_id, r.weight_class_rule, c.weight_class_title, c.weight_class_key from :table_weight_classes_rules r, :table_weight_classes c where r.weight_class_from_id = :weight_class_from_id and r.weight_class_to_id != :weight_class_to_id and r.weight_class_to_id = c.weight_class_id and c.language_id = :language_id order by c.weight_class_title'); $Qrules->bindTable(':table_weight_classes_rules', TABLE_WEIGHT_CLASS_RULES); $Qrules->bindTable(':table_weight_classes', TABLE_WEIGHT_CLASS); $Qrules->bindInt(':weight_class_from_id', $_REQUEST['weight_class_id']); $Qrules->bindInt(':weight_class_to_id', $_REQUEST['weight_class_id']); $Qrules->bindInt(':language_id', $osC_Language->getID()); $Qrules->execute(); $rules = array(); while ($Qrules->next()) { $rules[] = array('weight_class_id' => $Qrules->value('weight_class_to_id'), 'weight_class_rule' => $Qrules->value('weight_class_rule'), 'weight_class_title' => $Qrules->value('weight_class_title')); } $Qrules->freeResult(); $data['rules'] = $rules; $response = array('success' => true, 'data' => $data); echo $toC_Json->encode($response); }
<?php /* $Id: $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2007 osCommerce This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation. */ $osC_ObjectInfo = new osC_ObjectInfo(osC_WeightClasses_Admin::getData($_GET['wcID'])); ?> <h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?> </h1> <?php if ($osC_MessageStack->size($osC_Template->getModule()) > 0) { echo $osC_MessageStack->get($osC_Template->getModule()); } ?> <div class="infoBoxHeading"><?php echo osc_icon('trash.png') . ' ' . $osC_ObjectInfo->get('weight_class_title'); ?>