Execute("SELECT products_id FROM " . $oostable['products'] . " WHERE products_id = " . intval($_POST['slave_product_id']) . " LIMIT 1"); if ($check_product_result->RecordCount() == 1) { $product_check = TRUE; } //checks if the product is already present $check_product_result = $dbconn->Execute("SELECT slave_id, master_id FROM " . $oostable['products_to_master'] . " WHERE slave_id = " . intval($_POST['slave_product_id']) . " AND master_id = " . intval($_GET['pID']) . " LIMIT 1"); if ($check_product_result->RecordCount() == 1) { $product_check = FALSE; } } if ($product_check === TRUE) { $sql_data_array = array('slave_id' => $_POST['slave_product_id'], 'master_id' => $_GET['pID']); oos_db_perform($oostable['products_to_master'], $sql_data_array, 'INSERT'); $messageStack->add_session(TEXT_SUCCESSFULLY_SLAVE, 'success'); } else { $messageStack->add_session(TEXT_ERROR_SLAVE, 'error'); } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&pID=' . intval($_GET['pID']) . '&action=slave_products')); break; case 'slave_delete': $dbconn->Execute("DELETE FROM " . $oostable['products_to_master'] . " WHERE slave_id = " . intval($_GET['slave_id']) . " AND master_id = " . intval($_GET['master_id']) . " LIMIT 1"); $check_product_result = $dbconn->Execute("SELECT slave_id, master_id FROM " . $oostable['products_to_master'] . " WHERE slave_id = " . intval($_GET['slave_id'])); if ($check_product_result->RecordCount() == 0) { $dbconn->Execute("UPDATE " . $oostable['products'] . " SET products_slave_visible = '1' WHERE products_id = " . intval($_GET['slave_id'])); } $messageStack->add_session('Slave Deleted', 'success'); oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&pID=' . intval($_GET['master_id']) . '&action=slave_products')); break; case 'slave_visible': $dbconn->Execute("UPDATE " . $oostable['products'] . " SET products_slave_visible = " . intval($_GET['visible']) . " WHERE products_id = " . intval($_GET['slave_id'])); oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&pID=' . intval($_GET['master_id']) . '&action=slave_products')); break; case 'setflag': if ( isset($_GET['flag']) && ($_GET['flag'] == '1') || ($_GET['flag'] == '2') ) { if (isset($_GET['pID']) && is_numeric($_GET['pID'])) { oos_set_product_status($_GET['pID'], $_GET['flag']); } elseif (isset($_GET['cID']) && is_numeric($_GET['cID'])) { oos_set_categories_status($_GET['cID'], $_GET['flag']); } } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&pID=' . intval($_GET['pID']) . '&cID=' . intval($cID) . '&page=' . $nPage . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : ''))); break; case 'insert_category': case 'update_category': $nStatus = oos_db_prepare_input($_POST['categories_status']); $color = oos_db_prepare_input($_POST['color']); $menu_type = oos_db_prepare_input($_POST['menu_type']); $sort_order = oos_db_prepare_input($_POST['sort_order']); $nImageCounter = (!isset($_POST['image_counter']) || !is_numeric($_POST['image_counter'])) ? 0 : intval($_POST['image_counter']); if (isset($_FILES['files'])) { foreach ($_FILES['files']['name'] as $key => $name) { if (empty($name)) { // purge empty slots unset($_FILES['files']['name'][$key]); unset($_FILES['files']['type'][$key]); unset($_FILES['files']['tmp_name'][$key]); unset($_FILES['files']['error'][$key]); unset($_FILES['files']['size'][$key]); } } } if (isset($_POST['categories_id'])) $categories_id = oos_db_prepare_input($_POST['categories_id']); if ((isset($_GET['cID'])) && ($categories_id == '')) { $categories_id = intval($_GET['cID']); } $sql_data_array = array(); $sql_data_array = array('color' => oos_db_prepare_input($color), 'menu_type' => oos_db_prepare_input($menu_type), 'sort_order' => intval($sort_order)); if ($action == 'insert_category') { $insert_sql_data = array(); $insert_sql_data = array('parent_id' => intval($current_category_id), 'date_added' => 'now()', 'categories_status' => intval($nStatus)); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); oos_db_perform($oostable['categories'], $sql_data_array); $categories_id = $dbconn->Insert_ID(); } elseif ($action == 'update_category') { $update_sql_data = array('last_modified' => 'now()', 'categories_status' => intval($nStatus)); $sql_data_array = array_merge($sql_data_array, $update_sql_data); oos_db_perform($oostable['categories'], $sql_data_array, 'UPDATE', 'categories_id = \'' . $categories_id . '\''); } $aLanguages = oos_get_languages(); $nLanguages = count($aLanguages); for ($i = 0, $n = $nLanguages; $i < $n; $i++) { $language_id = $aLanguages[$i]['id']; $categories_description = oos_db_prepare_input($_POST['categories_description'][$language_id]); $categories_description_meta = oos_db_prepare_input($_POST['categories_description_meta'][$language_id]); if (empty($categories_description_meta)) { $categories_description_meta = substr(strip_tags(preg_replace('!(\r\n|\r|\n)!', '',$categories_description)),0 , 160); } $sql_data_array = array('categories_name' => oos_db_prepare_input($_POST['categories_name'][$language_id]), 'categories_page_title' => oos_db_prepare_input($_POST['categories_page_title'][$language_id]), 'categories_heading_title' => oos_db_prepare_input($_POST['categories_heading_title'][$language_id]), 'categories_description' => $categories_description, 'categories_description_meta' => $categories_description_meta); if ($action == 'insert_category') { $insert_sql_data = array('categories_id' => intval($categories_id), 'categories_languages_id' => intval($aLanguages[$i]['id'])); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); oos_db_perform($oostable['categories_description'], $sql_data_array); } elseif ($action == 'update_category') { oos_db_perform($oostable['categories_description'], $sql_data_array, 'UPDATE', 'categories_id = \'' . intval($categories_id) . '\' AND categories_languages_id = \'' . intval($language_id) . '\''); } } if ( ($_POST['remove_image'] == 'yes') && (isset($_POST['categories_previous_image'])) ) { $categories_previous_image = oos_db_prepare_input($_POST['categories_previous_image']); $categoriestable = $oostable['categories']; $dbconn->Execute("UPDATE $categoriestable SET categories_image = NULL WHERE categories_id = '" . intval($categories_id) . "'"); oos_remove_category_image($categories_previous_image); } if ( ($_POST['remove_banner'] == 'yes') && (isset($_POST['categories_previous_banner'])) ) { $categories_previous_banner = oos_db_prepare_input($_POST['categories_previous_banner']); $categoriestable = $oostable['categories']; $dbconn->Execute("UPDATE $categoriestable SET categories_banner = NULL WHERE categories_id = '" . intval($categories_id) . "'"); oos_remove_category_banner($categories_previous_banner); } for ($i = 1, $n = $nImageCounter+1; $i < $n; $i++) { if ( ($_POST['remove_category_image'][$i] == 'yes') && (isset($_POST['categories_previous_large_image'][$i])) ) { $categories_previous_large_image = oos_db_prepare_input($_POST['categories_previous_large_image'][$i]); $dbconn->Execute("DELETE FROM " . $oostable['categories_images'] . " WHERE categories_image = '" . oos_db_input($categories_previous_large_image) . "'"); oos_remove_category_image($categories_previous_large_image); } } // Banner $aBannerOptions = array( 'image_versions' => array( // The empty image version key defines options for the original image. // Keep in mind: these image manipulations are inherited by all other image versions from this point onwards. // Also note that the property 'no_cache' is not inherited, since it's not a manipulation. '' => array( // Automatically rotate images based on EXIF meta data: 'auto_orient' => TRUE ), 'large' => array( // 'auto_orient' => TRUE, // 'crop' => TRUE, // 'jpeg_quality' => 82, // 'no_cache' => TRUE, (there's a caching option, but this remembers thumbnail sizes from a previous action!) // 'strip' => TRUE, (this strips EXIF tags, such as geolocation) 'max_width' => 440, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height. 'max_height' => 500, // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width. ), 'medium' => array( // 'auto_orient' => TRUE, // 'crop' => TRUE, // 'jpeg_quality' => 82, // 'no_cache' => TRUE, (there's a caching option, but this remembers thumbnail sizes from a previous action!) // 'strip' => TRUE, (this strips EXIF tags, such as geolocation) 'max_width' => 300, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height. 'max_height' => 120 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width. ), ), ); $oCategoriesBanner = new upload('categories_banner', $aBannerOptions); $dir_fs_catalog_banner = OOS_ABSOLUTE_PATH . OOS_IMAGES . 'banners/'; $oCategoriesBanner->set_destination($dir_fs_catalog_banner); if ($oCategoriesBanner->parse() && oos_is_not_null($oCategoriesBanner->filename)) { $categoriestable = $oostable['categories']; $dbconn->Execute("UPDATE $categoriestable SET categories_banner = '" . oos_db_input($oCategoriesBanner->filename) . "' WHERE categories_id = '" . intval($categories_id) . "'"); } // Primary $options = array( 'image_versions' => array( // The empty image version key defines options for the original image. // Keep in mind: these image manipulations are inherited by all other image versions from this point onwards. // Also note that the property 'no_cache' is not inherited, since it's not a manipulation. '' => array( // Automatically rotate images based on EXIF meta data: 'auto_orient' => TRUE ), 'large' => array( // 'auto_orient' => TRUE, // 'crop' => TRUE, // 'jpeg_quality' => 82, // 'no_cache' => TRUE, (there's a caching option, but this remembers thumbnail sizes from a previous action!) // 'strip' => TRUE, (this strips EXIF tags, such as geolocation) 'max_width' => 1024, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height. 'max_height' => 1024, // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width. ), 'medium' => array( // 'auto_orient' => TRUE, // 'crop' => TRUE, // 'jpeg_quality' => 82, // 'no_cache' => TRUE, (there's a caching option, but this remembers thumbnail sizes from a previous action!) // 'strip' => TRUE, (this strips EXIF tags, such as geolocation) 'max_width' => 300, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height. 'max_height' => 300 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width. ), 'small' => array( // 'auto_orient' => TRUE, // 'crop' => TRUE, // 'jpeg_quality' => 82, // 'no_cache' => TRUE, (there's a caching option, but this remembers thumbnail sizes from a previous action!) // 'strip' => TRUE, (this strips EXIF tags, such as geolocation) 'max_width' => 150, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height. 'max_height' => 150 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width. ), ), ); $oCategoriesImage = new upload('categories_image', $options); $dir_fs_catalog_images = OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/'; $oCategoriesImage->set_destination($dir_fs_catalog_images); if ($oCategoriesImage->parse() && oos_is_not_null($oCategoriesImage->filename)) { $categoriestable = $oostable['categories']; $dbconn->Execute("UPDATE $categoriestable SET categories_image = '" . oos_db_input($oCategoriesImage->filename) . "' WHERE categories_id = '" . intval($categories_id) . "'"); } if (isset($_FILES['files'])) { $oImage = new upload('files', $options); $dir_fs_catalog_images = OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/'; $oImage->set_destination($dir_fs_catalog_images); $oImage->parse(); if (oos_is_not_null($oImage->response)) { $sort_order = 0 + $nImageCounter; foreach ($oImage->response as $index => $value) { $sort_order++; $sql_data_array = array('categories_id' => intval($categories_id), 'categories_image' => oos_db_prepare_input($value), 'sort_order' => intval($sort_order)); oos_db_perform($oostable['categories_images'], $sql_data_array); } } } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&cID=' . $categories_id)); break; case 'delete_category_confirm': if (isset($_POST['categories_id']) && is_numeric($_POST['categories_id'])) { $categories_id = oos_db_prepare_input($_POST['categories_id']); $categories = oos_get_category_tree($categories_id, '', '0', '', TRUE); $products = array(); $products_delete = array(); for ($i = 0, $n = count($categories); $i < $n; $i++) { $product_ids_result = $dbconn->Execute("SELECT products_id FROM " . $oostable['products_to_categories'] . " WHERE categories_id = '" . intval($categories[$i]['id']) . "'"); while ($product_ids = $product_ids_result->fields) { $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id']; // Move that ADOdb pointer! $product_ids_result->MoveNext(); } } reset($products); foreach ($products as $key => $value) { $category_ids = ''; for ($i = 0, $n = count($value['categories']); $i < $n; $i++) { $category_ids .= '\'' . $value['categories'][$i] . '\', '; } $category_ids = substr($category_ids, 0, -2); $check_result = $dbconn->Execute("SELECT COUNT(*) AS total FROM " . $oostable['products_to_categories'] . " WHERE products_id = '" . intval($key) . "' AND categories_id not in (" . $category_ids . ")"); $check = $check_result->fields; if ($check['total'] < '1') { $products_delete[$key] = $key; } } for ($i = 0, $n = count($categories); $i < $n; $i++) { category_move_to_trash($categories[$i]['id']); } foreach($products_delete as $key) { product_move_to_trash($key); } } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&page=' . $nPage)); break; case 'delete_product_confirm': if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) { $product_id = oos_db_prepare_input($_POST['products_id']); product_move_to_trash($product_id); } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $cPath . '&page=' . $nPage)); break; case 'move_category_confirm': if (isset($_POST['categories_id']) && ($_POST['categories_id'] != $_POST['move_to_category_id'])) { $categories_id = oos_db_prepare_input($_POST['categories_id']); $new_parent_id = oos_db_prepare_input($_POST['move_to_category_id']); $dbconn->Execute("UPDATE " . $oostable['categories'] . " SET parent_id = '" . intval($new_parent_id) . "', last_modified = now() WHERE categories_id = '" . intval($categories_id) . "'"); } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $new_parent_id . '&cID=' . $categories_id)); break; case 'move_product_confirm': $products_id = oos_db_prepare_input($_POST['products_id']); $new_parent_id = oos_db_prepare_input($_POST['move_to_category_id']); $duplicate_check_result = $dbconn->Execute("SELECT COUNT(*) AS total FROM " . $oostable['products_to_categories'] . " WHERE products_id = '" . intval($products_id) . "' and categories_id = '" . intval($new_parent_id) . "'"); $duplicate_check = $duplicate_check_result->fields; if ($duplicate_check['total'] < 1) $dbconn->Execute("UPDATE " . $oostable['products_to_categories'] . " SET categories_id = '" . intval($new_parent_id) . "' WHERE products_id = '" . intval($products_id) . "' and categories_id = '" . intval($current_category_id) . "'"); oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $new_parent_id . '&pID=' . $products_id)); break; case 'copy_to_confirm': if (isset($_POST['products_id']) && isset($_POST['categories_id'])) { $products_id = oos_db_prepare_input($_POST['products_id']); $categories_id = oos_db_prepare_input($_POST['categories_id']); if ($_POST['copy_as'] == 'link') { if ($_POST['categories_id'] != $current_category_id) { $check_result = $dbconn->Execute("SELECT COUNT(*) AS total FROM " . $oostable['products_to_categories'] . " WHERE products_id = '" . intval($products_id) . "' and categories_id = '" . intval($categories_id) . "'"); $check = $check_result->fields; if ($check['total'] < '1') { $dbconn->Execute("INSERT INTO " . $oostable['products_to_categories'] . " (products_id, categories_id) VALUES ('" . intval($products_id) . "', '" . intval($categories_id) . "')"); } } else { $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error'); } } elseif ($_POST['copy_as'] == 'duplicate') { $product_result = $dbconn->Execute("SELECT products_quantity, products_reorder_level, products_model, products_replacement_product_id, products_ean, products_image, products_price, products_base_price, products_base_unit, products_date_available, products_weight, products_status, products_setting, products_tax_class_id, products_units_id, manufacturers_id, products_price_list, products_quantity_order_min, products_quantity_order_max, products_quantity_order_units, products_discount1, products_discount2, products_discount3, products_discount4, products_discount1_qty, products_discount2_qty, products_discount3_qty, products_discount4_qty, products_discounts_id, products_slave_visible, products_sort_order FROM " . $oostable['products'] . " WHERE products_id = '" . oos_db_input($products_id) . "'"); $product = $product_result->fields; $dbconn->Execute("INSERT INTO " . $oostable['products'] . " (products_quantity, products_reorder_level, products_model, products_replacement_product_id, products_ean, products_image, products_price, products_base_price, products_base_unit, products_date_added, products_date_available, products_weight, products_status, products_setting, products_tax_class_id, products_units_id, manufacturers_id, products_price_list, products_quantity_order_min, products_quantity_order_max, products_quantity_order_units, products_discount1, products_discount2, products_discount3, products_discount4, products_discount1_qty, products_discount2_qty, products_discount3_qty, products_discount4_qty, products_discounts_id, products_slave_visible, products_sort_order) VALUES ('" . $product['products_quantity'] . "', '" . $product['products_reorder_level'] . "', '" . $product['products_model'] . "', '" . $product['products_replacement_product_id'] . "', '" . $product['products_ean'] . "', '" . $product['products_image'] . "', '" . $product['products_price'] . "', '" . $product['products_base_price'] . "', '" . $product['products_base_unit'] . "', now(), '" . (empty($product['products_date_available']) ? null : "'" . oos_db_input($product['products_date_available']) . "'") . "', '" . $product['products_weight'] . "', '" . $product['products_status'] . "', '3', '" . $product['products_tax_class_id'] . "', '" . $product['products_units_id'] . "', '" . $product['manufacturers_id'] . "', '" . $product['products_price_list'] . "', '" . $product['products_quantity_order_min'] . "', '" . $product['products_quantity_order_max'] . "', '" . $product['products_quantity_order_units'] . "', '" . $product['products_discount1'] . "', '" . $product['products_discount2'] . "', '" . $product['products_discount3'] . "', '" . $product['products_discount4'] . "', '" . $product['products_discount1_qty'] . "', '" . $product['products_discount2_qty'] . "', '" . $product['products_discount3_qty'] . "', '" . $product['products_discount4_qty'] . "', '" . $product['products_discounts_id'] . "', '" . $product['products_slave_visible'] . "', '" . $product['products_sort_order'] . "')"); $dup_products_id = $dbconn->Insert_ID(); $description_result = $dbconn->Execute("SELECT products_languages_id, products_name, products_title, products_description, products_short_description, products_essential_characteristics, products_url, products_description_meta FROM " . $oostable['products_description'] . " WHERE products_id = '" . oos_db_input($products_id) . "'"); while ($description = $description_result->fields) { $dbconn->Execute("INSERT INTO " . $oostable['products_description'] . " (products_id, products_languages_id, products_name, products_title, products_description, products_short_description, products_essential_characteristics, products_url, products_viewed, products_description_meta) VALUES ('" . $dup_products_id . "', '" . $description['products_languages_id'] . "', '" . oos_db_input($description['products_name']) . "', '" . oos_db_input($description['products_title']) . "', '" . oos_db_input($description['products_description']) . "', '" . oos_db_input($description['products_short_description']) . "', '" . oos_db_input($description['products_essential_characteristics']) . "', '" . oos_db_input($description['products_url']) . "', '0', '" . oos_db_input($description['products_description_meta']). "')"); // Move that ADOdb pointer! $description_result->MoveNext(); } $products_id_from = oos_db_input($products_id); $products_id_to = $dup_products_id; $products_id = $dup_products_id; $dbconn->Execute("INSERT INTO " . $oostable['products_to_categories'] . " (products_id, categories_id) VALUES ('" . intval($dup_products_id) . "', '" . intval($categories_id) . "')"); $products_images_copy_result= $dbconn->Execute("SELECT image_name, sort_order FROM " . $oostable['products_images'] . " WHERE products_id='" . intval($products_id_from) . "'"); while ( $products_images_copy = $products_images_copy_result->fields) { $sql = "INSERT INTO " . $oostable['products_images'] . " (products_id, image_name, sort_order) VALUES ('" . intval($products_id_to) . "', '" . $products_images_copy['image_name'] . "', '" . $products_images_copy['sort_order'] . "')"; $dbconn->Execute($sql); // Move that ADOdb pointer! $products_images_copy_result->MoveNext(); } if ( $_POST['copy_attributes']=='copy_attributes_yes' and $_POST['copy_as'] == 'duplicate' ) { $products_copy_from_result= $dbconn->Execute("SELECT options_id, options_values_id, options_values_price, price_prefix, options_sort_order FROM " . $oostable['products_attributes'] . " WHERE products_id='" . intval($products_id_from) . "'"); while ( $products_copy_from = $products_copy_from_result->fields) { $sql = "INSERT INTO " . $oostable['products_attributes'] . " (products_id, options_id, options_values_id, options_values_price, price_prefix, options_sort_order) VALUES ('" . intval($products_id_to) . "', '" . $products_copy_from['options_id'] . "', '" . $products_copy_from['options_values_id'] . "', '" . $products_copy_from['options_values_price'] . "', '" . $products_copy_from['price_prefix'] . "', '" . $products_copy_from['options_sort_order'] . "')"; $dbconn->Execute($sql); // Move that ADOdb pointer! $products_copy_from_result->MoveNext(); } } } } oos_redirect_admin(oos_href_link_admin($aContents['categories'], 'cPath=' . $categories_id . '&pID=' . $products_id)); break; } } $cPath_back = ''; if (is_array($aPath) && count($aPath) > 0) { for ($i = 0, $n = count($aPath) - 1; $i < $n; $i++) { if (empty($cPath_back)) { $cPath_back .= $aPath[$i]; } else { $cPath_back .= '_' . $aPath[$i]; } } } $cPath_back = (oos_is_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : ''; // check if the catalog image directory exists if (is_dir(OOS_ABSOLUTE_PATH . OOS_IMAGES)) { if (!is_writeable(OOS_ABSOLUTE_PATH . OOS_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); } require 'includes/header.php'; ?>
Execute($query); $categories_count = $categories_count_result->fields['total']; $categories_count++; $parameters = array('categories_id' => '', 'categories_name' => '', 'categories_page_title' => '', 'categories_heading_title' => '', 'categories_description' => '', 'categories_description_meta' => '', 'categories_image' => '', 'categories_banner' => '', 'categories_larger_images' => array(), 'parent_id' => '', 'color' => '', 'menu_type' => '', 'sort_order' => $categories_count, 'date_added' => '', 'categories_status' => 2, 'last_modified' => ''); $cInfo = new objectInfo($parameters); if (isset($_GET['cID']) && empty($_POST)) { $categoriestable = $oostable['categories']; $categories_descriptiontable = $oostable['categories_description']; $query = "SELECT c.categories_id, cd.categories_name, cd.categories_page_title, cd.categories_heading_title, cd.categories_description, cd.categories_description_meta, c.categories_image, c.categories_banner, c.parent_id, c.color, c.menu_type, c.sort_order, c.date_added, c.categories_status, c.last_modified FROM $categoriestable c, $categories_descriptiontable cd WHERE c.categories_id = '" . intval($cID) . "' AND c.categories_id = cd.categories_id AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY c.sort_order, cd.categories_name"; $categories_result = $dbconn->Execute($query); $category = $categories_result->fields; $cInfo = new objectInfo($category); $categories_imagestable = $oostable['categories_images']; $categories_images_result = $dbconn->Execute("SELECT categories_id, categories_image, sort_order FROM $categories_imagestable WHERE categories_id = '" . intval($category['categories_id']) . "' ORDER BY sort_order"); while ($categories_images = $categories_images_result->fields) { $cInfo->categories_larger_images[] = array('categories_id' => $categories_images['categories_id'], 'image' => $categories_images['categories_image'], 'sort_order' => $product_images['sort_order']); // Move that ADOdb pointer! $categories_images_result->MoveNext(); } } $aLanguages = oos_get_languages(); $nLanguages = count($aLanguages); $text_new_or_edit = ($action=='new_category') ? TEXT_INFO_HEADING_NEW_CATEGORY : TEXT_INFO_HEADING_EDIT_CATEGORY; $aSetting = array(); $settingstable = $oostable['setting']; $setting_result = $dbconn->Execute("SELECT setting_id, setting_name FROM $settingstable WHERE setting_languages_id = '" . intval($_SESSION['language_id']) . "'"); while ($setting = $setting_result->fields) { $aSetting[] = array('id' => $setting['setting_id'], 'text' => $setting['setting_name']); // Move that ADOdb pointer! $setting_result->MoveNext(); } $aColor = array(); $aColor = array('text-primary', 'text-success', 'text-danger', 'text-warning', 'text-dark', 'text-muted'); if (isset($_GET['origin'])) { $sOrigin = oos_db_prepare_input($_GET['origin']); $pos_params = strpos($sOrigin, '?', 0); if ($pos_params != false) { $back_url = substr($sOrigin, 0, $pos_params); $back_url_params = substr($sOrigin, $pos_params + 1); } else { $back_url = $sOrigin; $back_url_params = ''; } } else { $back_url = $aContents['categories']; $back_url_params = 'cPath=' . $cPath; if (oos_is_not_null($cInfo->categories_id)) { $back_url_params .= '&cID=' . $cInfo->categories_id; } } ?>

parent_id); echo oos_hide_session_id(); ?>
' . IMAGE_BACK . ''; ?>
1) echo '
' . oos_flag_icon($aLanguages[$i]) . '
'; ?>
categories_id, $aLanguages[$i]['id'])), '', FALSE, 'text', TRUE, FALSE, TEXT_EDIT_CATEGORIES_NAME); ?>
1) echo '
' . oos_flag_icon($aLanguages[$i]) . '
'; ?>
categories_id, $aLanguages[$i]['id']))); ?>
1) echo '
' . oos_flag_icon($aLanguages[$i]) . '
'; ?>
categories_id, $aLanguages[$i]['id'])), '', FALSE, 'text', TRUE, FALSE, ''); ?>
1) echo '
' . oos_flag_icon($aLanguages[$i]) . '
'; ?>
categories_id, $aLanguages[$i]['id']))); ?>
1) echo '
' . oos_flag_icon($aLanguages[$i]) . '
'; ?>
categories_id, $aLanguages[$i]['id']))); ?>
categories_id, '', FALSE, 'text', TRUE, TRUE, ''); ?>
categories_status); ?>
sort_order); ?>
categories_image)) { echo '
'; echo oos_info_image('category/medium/' . $cInfo->categories_image, $cInfo->categories_name); echo '
'; echo oos_draw_hidden_field('categories_previous_image', $cInfo->categories_image); echo '
'; echo oos_draw_checkbox_field('remove_image', 'yes') . ' ' . TEXT_IMAGE_REMOVE; } else { ?>
categories_banner)) { echo '
'; echo oos_info_image('banners/medium/' . $cInfo->categories_banner, $cInfo->categories_name); echo '
'; echo oos_draw_hidden_field('categories_previous_banner', $cInfo->categories_banner); echo '
'; echo oos_draw_checkbox_field('remove_banner', 'yes') . ' ' . TEXT_IMAGE_REMOVE; } else { ?>
categories_larger_images) || is_object($cInfo->categories_larger_images)) { $nCounter = 0; foreach ($cInfo->categories_larger_images as $image) { $nCounter++; ?>
'; echo oos_info_image('category/medium/' . $image['image'], $cInfo->categories_name); echo '
'; echo oos_draw_hidden_field('categories_previous_large_image['. $nCounter . ']', $image['image']); echo '
'; echo oos_draw_checkbox_field('remove_category_image['. $nCounter . ']', 'yes') . ' ' . TEXT_IMAGE_REMOVE; ?>

+

' . IMAGE_BACK . ''; ?>
'0', 'text' => TEXT_PRODUCT_NOT_AVAILABLE)); $image_icon_status_result = $dbconn->Execute("SELECT products_status_id, products_status_name FROM " . $oostable['products_status'] . " WHERE products_status_languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY products_status_id"); while ($image_icon_status = $image_icon_status_result->fields) { $image_icon_status_array[] = array('id' => $image_icon_status['products_status_id'], 'text' => $image_icon_status['products_status_name']); // Move that ADOdb pointer! $image_icon_status_result->MoveNext(); } ?>

'' . oos_get_products_name($pInfo->products_id, $_SESSION['language_id']) . ''); $contents = array('form' => oos_draw_form('id', 'new_slave_product', $aContents['categories'], 'action=new_slave_product&cPath=' . $cPath . '&pID=' . $pInfo->products_id, 'post', FALSE, 'enctype="multipart/form-data"')); $contents[] = array('text' => '
' . TEXT_ADD_SLAVE_PRODUCT . '
' . oos_draw_input_field('slave_product_id', '', 'size="10"')); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_SAVE) . ' ' . BUTTON_CANCEL . ''); $contents[] = array('text' => '
' . TEXT_CURRENT_SLAVE_PRODUCTS); $slave_table_result = $dbconn->Execute("SELECT p2m.master_id, p2m.slave_id FROM " . $oostable['products_to_master'] . " p2m WHERE master_id = '" . $pInfo->products_id . "'"); while ($slave_table = $slave_table_result->fields){ $slave_products_result = $dbconn->Execute("SELECT p.products_id, p.products_slave_visible, pd.products_name FROM " . $oostable['products'] . " p , " . $oostable['products_description'] . " pd WHERE p.products_id = pd.products_id AND p.products_id = '" . $slave_table['slave_id'] . "' AND pd.products_languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY pd.products_name LIMIT 1"); $slave_products = $slave_products_result->fields; if($slave_products['products_slave_visible'] == 1){ $contents[] = array('text' => ' ' . $slave_products['products_name'] . ' ' . '' . oos_image(OOS_IMAGES . 'delete_slave_off.gif', 'Delete Slave') . ''. ''. oos_image(OOS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_RED_LIGHT) . ''); } else { $contents[] = array('text' => ' ' . $slave_products['products_name'] . ' ' . '' . oos_image(OOS_IMAGES . 'delete_slave_off.gif', 'Delete Slave') . ''. ''. oos_image(OOS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_GREEN_LIGHT) . ''); } // Move that ADOdb pointer! $slave_table_result->MoveNext(); } break; case 'delete_category': $heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_CATEGORY . ''); $contents = array('form' => oos_draw_form('id', 'categories', $aContents['categories'], 'action=delete_category_confirm&cPath=' . $cPath, 'post', FALSE) . oos_draw_hidden_field('categories_id', $cInfo->categories_id)); $contents[] = array('text' => TEXT_DELETE_CATEGORY_INTRO); $contents[] = array('text' => '
' . $cInfo->categories_name . ''); if ($cInfo->childs_count > 0) $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_CHILDS, $cInfo->childs_count)); if ($cInfo->products_count > 0) $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $cInfo->products_count)); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE) . ' ' . BUTTON_CANCEL . ''); break; case 'move_category': $heading[] = array('text' => '' . TEXT_INFO_HEADING_MOVE_CATEGORY . ''); $contents = array('form' => oos_draw_form('id', 'categories', $aContents['categories'], 'action=move_category_confirm', 'post', FALSE) . oos_draw_hidden_field('categories_id', $cInfo->categories_id)); $contents[] = array('text' => sprintf(TEXT_MOVE_CATEGORIES_INTRO, $cInfo->categories_name)); $contents[] = array('text' => '
' . sprintf(TEXT_MOVE, $cInfo->categories_name) . '
' . oos_draw_pull_down_menu('move_to_category_id', oos_get_category_tree('0', '', $cInfo->categories_id), $current_category_id)); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_MOVE) . ' ' . BUTTON_CANCEL . ''); break; case 'delete_product': $heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_PRODUCT . ''); $contents = array('form' => oos_draw_form('id', 'products', $aContents['categories'], 'action=delete_product_confirm&cPath=' . $cPath, 'post', FALSE) . oos_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_DELETE_PRODUCT_INTRO); $contents[] = array('text' => '
' . $pInfo->products_name . ''); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_MOVE_TRASH) . ' ' . BUTTON_CANCEL . ''); break; case 'move_product': $heading[] = array('text' => '' . TEXT_INFO_HEADING_MOVE_PRODUCT . ''); $contents = array('form' => oos_draw_form('id', 'products', $aContents['categories'], 'action=move_product_confirm&cPath=' . $cPath, 'post', FALSE) . oos_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => sprintf(TEXT_MOVE_PRODUCTS_INTRO, $pInfo->products_name)); $contents[] = array('text' => '
' . TEXT_INFO_CURRENT_CATEGORIES . '
' . oos_output_generated_category_path($pInfo->products_id, 'product') . ''); $contents[] = array('text' => '
' . sprintf(TEXT_MOVE, $pInfo->products_name) . '
' . oos_draw_pull_down_menu('move_to_category_id', oos_get_category_tree(), $current_category_id)); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_MOVE) . ' ' . BUTTON_CANCEL . ''); break; case 'copy_to': $heading[] = array('text' => '' . TEXT_INFO_HEADING_COPY_TO . ''); $contents = array('form' => oos_draw_form('id', 'copy_to', $aContents['categories'], 'action=copy_to_confirm&cPath=' . $cPath, 'post', FALSE) . oos_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO); $contents[] = array('text' => '
' . TEXT_INFO_CURRENT_CATEGORIES . '
' . oos_output_generated_category_path($pInfo->products_id, 'product') . ''); $contents[] = array('text' => '
' . TEXT_CATEGORIES . '
' . oos_draw_pull_down_menu('categories_id', oos_get_category_tree(), $current_category_id)); $contents[] = array('text' => '
' . TEXT_HOW_TO_COPY . '
' . oos_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '
' . oos_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE); $contents[] = array('text' => '
' . oos_image(OOS_IMAGES . 'pixel_black.gif','','100%','3')); $contents[] = array('text' => '
' . TEXT_COPY_ATTRIBUTES_ONLY); $contents[] = array('text' => '
' . TEXT_COPY_ATTRIBUTES . '
' . oos_draw_radio_field('copy_attributes', 'copy_attributes_yes', true) . ' ' . TEXT_COPY_ATTRIBUTES_YES . '
' . oos_draw_radio_field('copy_attributes', 'copy_attributes_no') . ' ' . TEXT_COPY_ATTRIBUTES_NO); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_COPY) . ' ' . BUTTON_CANCEL . ''); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // category info box contents $heading[] = array('text' => '' . $cInfo->categories_name . ''); $contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . '' . oos_button(BUTTON_DELETE) . '' . oos_button(IMAGE_MOVE) . ''); $contents[] = array('text' => TEXT_CATEGORIES . ' ' . oos_get_categories_name($cPath) . ' ' . oos_get_categories_name($cID) . '
' . TEXT_DATE_ADDED . ' ' . oos_date_short($cInfo->date_added)); if (oos_is_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . oos_date_short($cInfo->last_modified)); $contents[] = array('text' => '
' . oos_info_image('category/medium/' . $cInfo->categories_image, $cInfo->categories_name) . '
' . $cInfo->categories_image); $contents[] = array('text' => '
' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '
' . TEXT_PRODUCTS . ' ' . $cInfo->products_count); } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents $heading[] = array('text' => '' . $pInfo->products_name . ''); $contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . '' . oos_button(BUTTON_DELETE) . '' . oos_button(IMAGE_MOVE) . '' . oos_button(IMAGE_COPY_TO) . ''); $contents[] = array('align' => 'center', 'text' => '' . oos_button(IMAGE_SLAVE) . ''); if (defined('MIN_DISPLAY_NEW_SPEZILAS')) { $productstable = $oostable['products']; $specialstable = $oostable['specials']; $query = "SELECT p.products_tax_class_id, p.products_id, s.specials_id, s.specials_new_products_price, s.expires_date, s.status FROM $productstable p, $specialstable s WHERE s.status = '1' AND p.products_id = s.products_id AND s.products_id = '" . $pInfo->products_id . "'"; $specials_result = $dbconn->Execute($query); if (!$specials_result->RecordCount()) { $contents[] = array('align' => 'center', 'text' => '' . oos_button(IMAGE_SPECIALS) . ''); } else { $specials = $specials_result->fields; $contents[] = array('align' => 'center', 'text' => '' . oos_button(IMAGE_SPECIALS) . ''); } } if (defined('MAX_DISPLAY_FEATURED_PRODUCTS')) { $featuredtable = $oostable['featured']; $query = "SELECT featured_id, products_id, status FROM $featuredtable p WHERE status = '1' AND products_id = '" . $pInfo->products_id . "'"; $featured_result = $dbconn->Execute($query); if (!$featured_result->RecordCount()) { $contents[] = array('align' => 'center', 'text' => '' . oos_button(IMAGE_FEATURED) . ''); } else { $featured = $featured_result->fields; $contents[] = array('align' => 'center', 'text' => '' . oos_button(IMAGE_FEATURED) . ''); } } $contents[] = array('text' => '#' . $pInfo->products_id . ' ' . TEXT_CATEGORIES . ' ' . oos_get_categories_name($current_category_id) . '
' . TEXT_DATE_ADDED . ' ' . oos_date_short($pInfo->products_date_added)); if (oos_is_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . oos_date_short($pInfo->products_last_modified)); if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . oos_date_short($pInfo->products_date_available)); $contents[] = array('text' => '
' . product_info_image($pInfo->products_image, $pInfo->products_name) . '
' . $pInfo->products_image); $sPrice = $pInfo->products_price; $sPriceList = $pInfo->products_price_list; if ($action != 'new_product_preview'){ $sPriceNetto = round($sPrice,TAX_DECIMAL_PLACES); $sPriceListNetto = round($sPriceList,TAX_DECIMAL_PLACES); $tax_result = $dbconn->Execute("SELECT tax_rate FROM " . $oostable['tax_rates'] . " WHERE tax_class_id = '" . $pInfo->products_tax_class_id . "' "); $tax = $tax_result->fields; $sPrice = ($sPrice*($tax['tax_rate']+100)/100); $sPriceList = ($sPriceList*($tax['tax_rate']+100)/100); if (isset($specials) && is_array($specials)) { $sSpecialsPriceNetto = round($specials['specials_new_products_price'],TAX_DECIMAL_PLACES); $sSpecialsPrice = round(($specials['specials_new_products_price']*($tax['tax_rate']+100)/100),TAX_DECIMAL_PLACES); } } $sPrice = round($sPrice,TAX_DECIMAL_PLACES); $sPriceList = round($sPriceList,TAX_DECIMAL_PLACES); if (isset($specials) && is_array($specials)) { $contents[] = array('text' => '
' . TEXT_PRODUCTS_PRICE_INFO . '' . $currencies->format($sPrice) . ' - ' . TEXT_TAX_INFO . '' . $currencies->format($sPriceNetto) . ''); $contents[] = array('text' => '' . TEXT_PRODUCTS_PRICE_INFO . '' . $currencies->format($sSpecialsPrice) . ' - ' . TEXT_TAX_INFO . '' . $currencies->format($sSpecialsPriceNetto) . ''); $contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . number_format(100 - (($sSpecialsPrice / $sPrice) * 100)) . '%'); if (date('Y-m-d') < $specials['expires_date']) { $contents[] = array('text' => '' . TEXT_INFO_EXPIRES_DATE . ' ' . oos_date_short($specials['expires_date']) . ''); } } else { $contents[] = array('text' => '
' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($sPrice) . ' - ' . TEXT_TAX_INFO . $currencies->format($sPriceNetto)); } if ($sPriceList > 0) { $contents[] = array('text' => '' . CAT_LIST_PRICE_TEXT . $currencies->format($sPriceList) . ' - ' . TEXT_TAX_INFO . $currencies->format($sPriceListNetto)); } $contents[] = array('text' => '

' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity); $contents[] = array('text' => '' . CAT_QUANTITY_MIN_TEXT . $pInfo->products_quantity_order_min); $contents[] = array('text' => '' . CAT_QUANTITY_MAX_TEXT . $pInfo->products_quantity_order_max); $contents[] = array('text' => '' . CAT_QUANTITY_UNITS_TEXT . $pInfo->products_quantity_order_units); if ( $pInfo->products_discount1_qty > 0 ) { $sDiscount1 = $pInfo->products_discount1; $sDiscount1 = round($sDiscount1,TAX_DECIMAL_PLACES); $contents[] = array('text' => '

' . TEXT_DISCOUNTS_TITLE . ':'); $contents[] = array('text' => '   ' . ($pInfo->products_discount1_qty < 10 ? ' ' : '') . $pInfo->products_discount1_qty . ' ' . $currencies->format($sDiscount1) . ' - ' . TEXT_TAX_INFO . $currencies->format($sDiscount1Netto)); } if ( $pInfo->products_discount2_qty > 0 ) { $sDiscount2 = $pInfo->products_discount2; $sDiscount2 = round($sDiscount2,TAX_DECIMAL_PLACES); $contents[] = array('text' => '   ' . ($pInfo->products_discount2_qty < 10 ? ' ' : '') . $pInfo->products_discount2_qty . ' ' . $currencies->format($sDiscount2) . ' - ' . TEXT_TAX_INFO . $currencies->format($sDiscount2Netto)); } if ( $pInfo->products_discount3_qty > 0 ) { $sDiscount3 = $pInfo->products_discount3; $sDiscount3 = round($sDiscount3,TAX_DECIMAL_PLACES); $contents[] = array('text' => '   ' . ($pInfo->products_discount3_qty < 10 ? ' ' : '') . $pInfo->products_discount3_qty . ' ' . $currencies->format($sDiscount3) . ' - ' . TEXT_TAX_INFO . $currencies->format($sDiscount3Netto)); } if ( $pInfo->products_discount4_qty > 0 ) { $sDiscount4 = $pInfo->products_discount4; $sDiscount4 = round($sDiscount4,TAX_DECIMAL_PLACES); $contents[] = array('text' => '   ' . ($pInfo->products_discount4_qty < 10 ? ' ' : '') . $pInfo->products_discount4_qty . ' ' . $currencies->format($sDiscount4) . ' - ' . TEXT_TAX_INFO . $currencies->format($sDiscount4Netto)); } $contents[] = array('text' => '
' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%'); } } else { // create category/product info $parent_categories_name = oos_output_generated_category_path($current_category_id); $heading[] = array('text' => '' . EMPTY_CATEGORY . ''); $contents[] = array('text' => sprintf(TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS, $parent_categories_name)); } break; } if ( (oos_is_not_null($heading)) && (oos_is_not_null($contents)) ) { ?>
Execute("SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status FROM " . $oostable['categories'] . " c, " . $oostable['categories_description'] . " cd WHERE c.categories_status != 0 AND c.categories_id = cd.categories_id AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "' AND cd.categories_name like '%" . oos_db_input($_GET['search']) . "%' ORDER BY c.sort_order, cd.categories_name"); } else { $categories_result = $dbconn->Execute("SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status FROM " . $oostable['categories'] . " c, " . $oostable['categories_description'] . " cd WHERE c.categories_status != 0 AND c.parent_id = '" . intval($current_category_id) . "' AND c.categories_id = cd.categories_id AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY c.sort_order, cd.categories_name"); } while ($categories = $categories_result->fields) { $categories_count++; $rows++; // Get parent_id for subcategories if search if (isset($_GET['search'])) $cPath = $categories['parent_id']; if ((!isset($_GET['cID']) && !isset($_GET['pID']) || (isset($_GET['cID']) && ($_GET['cID'] == $categories['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) { $category_childs = array('childs_count' => oos_childs_in_category_count($categories['categories_id'])); $category_products = array('products_count' => oos_products_in_category_count($categories['categories_id'])); $cInfo_array = array_merge($categories, $category_childs, $category_products); $cInfo = new objectInfo($cInfo_array); } if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> MoveNext(); } $products_count = 0; if (isset($_GET['search'])) { $products_result = $dbconn->Execute("SELECT p.products_id, pd.products_name, p.products_quantity, p.products_reorder_level, p.products_image, p.products_price, p.products_base_price, p.products_base_unit, p.products_tax_class_id, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_setting, p2c.categories_id, p.products_price_list, p.products_quantity_order_min, p.products_quantity_order_max, p.products_quantity_order_units, p.products_discount1, p.products_discount2, p.products_discount3, p.products_discount4, p.products_discount1_qty, p.products_discount2_qty, p.products_discount3_qty, p.products_discount4_qty, p.products_sort_order FROM " . $oostable['products'] . " p, " . $oostable['products_description'] . " pd, " . $oostable['products_to_categories'] . " p2c WHERE p.products_id = pd.products_id AND products_setting != 0 AND pd.products_languages_id = '" . intval($_SESSION['language_id']) . "' AND p.products_id = p2c.products_id AND pd.products_name like '%" . oos_db_input($_GET['search']) . "%' OR p.products_model like '%" . oos_db_input($_GET['search']) . "%' ORDER BY pd.products_name"); } else { $products_result = $dbconn->Execute("SELECT p.products_id, pd.products_name, p.products_quantity, p.products_reorder_level, p.products_image, p.products_price,p.products_base_price, p.products_base_unit, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_tax_class_id, p.products_setting, p.products_price_list, p.products_quantity_order_min, p.products_quantity_order_max, p.products_quantity_order_units, p.products_discount1, p.products_discount2, p.products_discount3, p.products_discount4, p.products_discount1_qty, p.products_discount2_qty, p.products_discount3_qty, p.products_discount4_qty, p.products_sort_order FROM " . $oostable['products'] . " p, " . $oostable['products_description'] . " pd, " . $oostable['products_to_categories'] . " p2c WHERE p.products_id = pd.products_id AND products_setting != 0 AND pd.products_languages_id = '" . intval($_SESSION['language_id']) . "' AND p.products_id = p2c.products_id and p2c.categories_id = '" . intval($current_category_id) . "' ORDER BY pd.products_name"); } while ($products = $products_result->fields) { $products_count++; $rows++; // Get categories_id for product if search if (isset($_GET['search'])) $cPath=$products['categories_id']; if ((!isset($_GET['pID']) && !isset($_GET['cID']) || (isset($_GET['pID']) && ($_GET['pID'] == $products['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) { // find out the rating average from customer reviews $reviews_result = $dbconn->Execute("SELECT (avg(reviews_rating) / 5 * 100) as average_rating FROM " . $oostable['reviews'] . " WHERE products_id = '" . $products['products_id'] . "'"); $reviews = $reviews_result->fields; $pInfo_array = array_merge($products, $reviews); $pInfo = new objectInfo($pInfo_array); } if (isset($pInfo) && is_object($pInfo) && ($products['products_id'] == $pInfo->products_id) ) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> MoveNext(); } ?>
 
  ' . ' #' . $categories['categories_id'] . ' ' . $categories['categories_name'] . ''; ?>    '; } else { echo ' '; } ?>    '; ?>  
 ' . '#' . $products['products_id'] . ' ' . $products['products_name']; ?>  '; } else { echo ' '; } ?> '; ?> 
' . TEXT_PRODUCTS . ' ' . $products_count; ?>
infoBox($heading, $contents); ?>