function xos_get_categories_string($parent_id = '', $entrance = false, $categories_string = '') { if ($entrance) { $categories_string = " p2c.categories_or_pages_id = '" . $parent_id . "'"; } $categories_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.parent_id from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.categories_or_pages_id = cpd.categories_or_pages_id and cpd.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cpd.categories_or_pages_name"); while ($categories = xos_db_fetch_array($categories_query)) { $categories_string .= " or p2c.categories_or_pages_id = '" . $categories['categories_or_pages_id'] . "'"; $categories_string = xos_get_categories_string($categories['categories_or_pages_id'], '', $categories_string); } return $categories_string; }
function xos_js_manufacturers_list($category, $form, $field) { global $categories_array; $num_category = 1; $output_string = ''; foreach ($categories_array as $category_value) { if ($num_category == 1) { $output_string .= ' if (' . $category . ' == "' . $category_value['id'] . '") {' . "\n"; } else { $output_string .= ' } else if (' . $category . ' == "' . $category_value['id'] . '") {' . "\n"; } $manufacturers_sql = xos_db_query("select distinct mi.manufacturers_id as id, mi.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS_INFO . " mi where p.products_status = '1' and p.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_id = p2c.products_id and (" . xos_get_categories_string((int) $category_value['id'], true) . ") order by mi.manufacturers_name"); $output_string .= ' document.' . $form . '.' . $field . '.options[0] = new Option("' . TEXT_ALL_MANUFACTURERS . '", "");' . "\n"; $num_manufacturer = 1; while ($manufacturers = xos_db_fetch_array($manufacturers_sql)) { $output_string .= ' document.' . $form . '.' . $field . '.options[' . $num_manufacturer . '] = new Option("' . $manufacturers['name'] . '", "' . $manufacturers['id'] . '");' . "\n"; $num_manufacturer++; } $num_category++; } $output_string .= ' }'; return $output_string; }
// this file is based on: // osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // filename: products_attributes.php // // Released under the GNU General Public License //////////////////////////////////////////////////////////////////////////////// if (!(@(include DIR_FS_SMARTY . 'admin/templates/' . ADMIN_TPL . '/php/includes/modules/attributes_products.php') == 'overwrite_all')) { if ($action == 'update_attribute') { $form_action = 'update_product_attribute'; } else { $form_action = 'add_product_attributes'; } if ($categories_or_pages_id) { $includes_categories = xos_get_categories_string($categories_or_pages_id, true); } $max_rows_per_page = $_GET['max_rows'] ? $_GET['max_rows'] : MAX_ROW_LISTS_OPTIONS; $attributes_next = $attributes_prev = $attributes = "select distinct pa.*, p.products_status, p.attributes_quantity, p.attributes_combinations, p.attributes_not_updated, pd.products_name, po.products_options_name, pov.products_options_values_name from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where" . ($pID ? " pa.products_id ='" . $pID . "' and" : "") . " pa.products_id = p.products_id and pa.products_id = pd.products_id and pa.products_id = p2c.products_id and pa.options_id = po.products_options_id and pa.options_values_id = pov.products_options_values_id and pd.language_id = po.language_id and pd.language_id = pov.language_id and pd.language_id = '" . (int) $_SESSION['used_lng_id'] . "'" . ($categories_or_pages_id ? " and (" . $includes_categories . ")" : "") . ($manufacturers_id ? " and p.manufacturers_id ='" . $manufacturers_id . "'" : "") . " order by pd.products_name, pa.options_sort_order, po.products_options_id, pa.options_values_sort_order, pov.products_options_values_name"; $attributes_split = new splitPageResults($attribute_page, $max_rows_per_page, $attributes, $attributes_query_numrows, 'pa.products_attributes_id'); $offset = $max_rows_per_page * ($attribute_page - 1); $attributes_prev .= " limit " . max($offset - 1, 0) . ", 1"; $attributes_next .= " limit " . max($offset + $max_rows_per_page, 0) . ", 1"; $offset > 0 ? $attributes_prev = xos_db_fetch_array(xos_db_query($attributes_prev)) : ($attributes_prev = array()); $attributes_next = xos_db_fetch_array(xos_db_query($attributes_next)); $attributes = xos_db_query($attributes); $attributes_value = array(); $rows = 0; while ($attributes_values = xos_db_fetch_array($attributes)) { if ($attributes_values['products_id'] == $attributes_prev['products_id']) { $previous_product_is_the_same = true;