本文整理汇总了PHP中tep_get_subcategories函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_get_subcategories函数的具体用法?PHP tep_get_subcategories怎么用?PHP tep_get_subcategories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_get_subcategories函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tep_get_subcategories
function tep_get_subcategories(&$subcategories_array, $parent_id = 0)
{
$subcategories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where categories_status = '1' and parent_id = '" . (int) $parent_id . "'");
while ($subcategories = tep_db_fetch_array($subcategories_query)) {
$subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id'];
if ($subcategories['categories_id'] != $parent_id) {
tep_get_subcategories($subcategories_array, $subcategories['categories_id']);
}
}
}
示例2: generate
function generate($HTTP_GET_VARS)
{
global $languages_id, $all_categories, $currency, $currencies, $categories_audio, $customer_discount, $cart, $breadcrumb;
$customer_discount = $cart->get_customer_discount();
if (!is_array($customer_discount)) {
$customer_discount = array();
}
$content = FILENAME_PRICELIST;
$page = tep_db_query_fetch_array("\n\t\t\tSELECT pages_id, \n\t\t\tpages_name, \n\t\t\tpages_additional_description, \n\t\t\tpages_description \n\t\t\tFROM " . TABLE_PAGES . " \n\t\t\tWHERE pages_filename = '" . tep_db_input(basename($content)) . "' \n\t\t\tAND language_id = '" . (int) $languages_id . "'");
define('ADDITIONAL_DESCRIPTION', $page['pages_additional_description']);
$translation_query = tep_db_query("\n\t\t\tSELECT pages_translation_key, \n\t\t\tpages_translation_value \n\t\t\tFROM " . TABLE_PAGES_TRANSLATION . " \n\t\t\tWHERE pages_filename = '" . tep_db_input(basename($content)) . "' \n\t\t\tAND language_id = '" . (int) $languages_id . "'");
while ($translation = tep_db_fetch_array($translation_query)) {
define($translation['pages_translation_key'], $translation['pages_translation_value']);
}
$breadcrumb->add($page['pages_name'], tep_href_link(FILENAME_PRICELIST));
$fields_array = array();
$fields_array['products_model'] = TEXT_CHOOSE_MODEL;
$fields_array['products_name'] = TEXT_CHOOSE_NAME;
$fields_array['categories_name'] = TEXT_CHOOSE_CATEGORY;
$fields_array['authors_name'] = TEXT_CHOOSE_AUTHOR;
$fields_array['manufacturers_name'] = TEXT_CHOOSE_MANUFACTURER;
$fields_array['series_name'] = TEXT_CHOOSE_SERIE;
$fields_array['products_description'] = TEXT_CHOOSE_DESCRIPTION;
$fields_array['products_price'] = TEXT_CHOOSE_PRICE;
$fields_array['products_year'] = TEXT_CHOOSE_YEAR;
$fields_array['products_pages_count'] = TEXT_CHOOSE_PAGES_COUNT;
$fields_array['products_copies'] = TEXT_CHOOSE_COPIES;
$fields_array['products_covers_name'] = TEXT_CHOOSE_COVER;
$fields_array['products_formats_name'] = TEXT_CHOOSE_FORMAT;
$fields_array['products_image'] = TEXT_CHOOSE_IMAGE;
$fields_array['products_url'] = TEXT_CHOOSE_URL;
$fileds_required = array('products_model', 'products_name', 'authors_name', 'products_price', 'manufacturers_name');
$specials_array = array();
$specials_types_query = tep_db_query("\n\t\t\tSELECT specials_types_id, \n\t\t\tspecials_types_name \n\t\t\tFROM " . TABLE_SPECIALS_TYPES . " \n\t\t\tWHERE specials_types_status = '1' \n\t\t\tAND specials_types_path <> '' \n\t\t\tAND language_id = '" . (int) DEFAULT_LANGUAGE_ID . "'");
while ($specials_types = tep_db_fetch_array($specials_types_query)) {
$specials_type_check = tep_db_query_fetch_array("\n\t\t\t\tSELECT count(*) as total \n\t\t\t\tFROM " . TABLE_SPECIALS . " \n\t\t\t\tWHERE specials_types_id = '" . (int) $specials_types['specials_types_id'] . "' \n\t\t\t\tAND status = '1'");
if ($specials_type_check['total'] > 0) {
$specials_array[$specials_types['specials_types_id']] = $specials_types['specials_types_name'];
}
}
$specials_periods_array = array(array('id' => 'w', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_WEEK), array('id' => '2w', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_2_WEEK), array('id' => 'm', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_MONTH), array('id' => 'h', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_HALF_YEAR));
$fields = array();
//здесь была проверка на выдачу определенных полей
$categories = array();
//здесь была проверка на выдачу определенных категорий
$manufacturers = array();
//здесь была проверка на выдачу определенных издательств
$specials = array();
$specials_periods = array();
////здесь была проверка на выдачу определенных типов
$ff = 'xml';
$status = 'active';
$compression_method = '';
//проверить наличие переменной далее
$type_info_query = tep_db_query("\n\t\t\tSELECT products_types_id, \n\t\t\tproducts_last_modified \n\t\t\tFROM " . TABLE_PRODUCTS_TYPES . " \n\t\t\tWHERE products_types_status = '1'" . (tep_not_null($HTTP_GET_VARS['type']) ? " AND products_types_path = '" . tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['type'])) . "'" : " AND products_types_default_status = '1'") . " limit 1");
if (tep_db_num_rows($type_info_query) < 1) {
tep_exit();
} else {
$type_info = tep_db_fetch_array($type_info_query);
$products_types_id = $type_info['products_types_id'];
$products_last_modified = strtotime($type_info['products_last_modified']);
}
$select_string_select = "SELECT distinct p.products_id";
$select_string_from = " FROM " . TABLE_PRODUCTS_INFO . " p";
$select_string_where = " WHERE p.products_types_id = '" . (int) $products_types_id . "' AND p.categories_id <> '4990' \n\tAND p.products_status = '1'" . ($status == 'active' ? " AND p.products_listing_status = '1'" : "") . " AND p.products_price > '0'";
//Формируем список категорий
$disabled_categories = array();
$type_categories_check = tep_db_query_fetch_array("\n\t\t\tSELECT categories_id \n\t\t\tFROM " . TABLE_CATEGORIES . " \n\t\t\tWHERE products_types_id = '" . (int) $products_types_id . "'");
if ($type_categories_check['categories_id'] > 0) {
$active_categories = array();
} else {
$active_categories = array('0');
}
$categories_query = tep_db_query("\n\t\t\tSELECT categories_id, \n\t\t\tcategories_xml_status \n\t\t\tFROM " . TABLE_CATEGORIES . " \n\t\t\tWHERE products_types_id = '" . (int) $products_types_id . "' \n\t\t\tAND categories_status = '1' \n\t\t\tORDER BY parent_id");
while ($categories = tep_db_fetch_array($categories_query)) {
if ($categories['categories_xml_status'] < 1 && !in_array($categories['categories_id'], $disabled_categories)) {
$disabled_categories[] = $categories['categories_id'];
tep_get_subcategories($disabled_categories, $categories['categories_id']);
} elseif (!in_array($categories['categories_id'], $disabled_categories)) {
if (!in_array($categories['categories_id'], $active_categories)) {
$active_categories[] = $categories['categories_id'];
}
}
}
$select_string_where .= " AND p.categories_id > '0'";
if (sizeof($disabled_categories) > 0) {
$select_string_where .= " AND p.categories_id NOT IN ('" . implode("', '", $disabled_categories) . "')";
}
//END Формируем список категорий
$all_categories = array();
//Здесь была выборка на разные сайты
$separator = ';';
$limit_string = "";
$select_string = $select_string_select . $select_string_from . $select_string_where;
$select_string .= " GROUP BY p.products_id";
if ($HTTP_GET_VARS['file'] !== '') {
$pricelist_filename = $HTTP_GET_VARS['file'];
}
//создаем массив символов которые будем менять
$from = array('<', '>', '&', '"', '"', '<', '>', '"', '<', '>', "\r\n");
//.........这里部分代码省略.........
示例3: tep_string_to_int
$specials[] = tep_string_to_int($HTTP_POST_VARS['special_' . $i]);
}
}
$status = $HTTP_POST_VARS['status'];
$products_to_load = array();
$subcategories_products = array();
$manufacturers_products = array();
$specials_products = array();
$products_selected = false;
$subcategories_array = array();
$eval_string = '';
if (sizeof($categories) > 0) {
reset($categories);
while (list(, $category_id) = each($categories)) {
$subcategories_array[] = $category_id;
tep_get_subcategories($subcategories_array, $category_id);
}
$eval_string .= '$subcategories_products, ';
}
$manufacturers_array = array();
if (sizeof($manufacturers) > 0) {
reset($manufacturers);
while (list(, $manufacturer_name) = each($manufacturers)) {
$manufacturer_name = trim(preg_replace('/\\s+/', ' ', $manufacturer_name));
if (tep_not_null($manufacturer_name)) {
$manufacturer_info_query = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS_INFO . " where (manufacturers_name like '%" . str_replace(' ', "%' and manufacturers_name like '%", $manufacturer_name) . "%') and languages_id = '" . (int) $languages_id . "'");
while ($manufacturer_info = tep_db_fetch_array($manufacturer_info_query)) {
$manufacturers_array[] = $manufacturer_info['manufacturers_id'];
}
}
}
示例4: tep_db_query
if (tep_not_null($prev_file['image']) && $prev_file['image'] != $upload->filename) {
@unlink(DIR_FS_CATALOG_IMAGES . $prev_file['image']);
}
tep_db_query("update " . TABLE_BOARDS_CATEGORIES . " set image = '" . $upload->filename . "' where boards_categories_id = '" . (int) $boards_categories_id . "'");
}
}
}
tep_update_blocks($boards_categories_id, 'boards_category');
tep_redirect(tep_href_link(FILENAME_BOARDS, 'tPath=' . $tPath . '&cPath=' . $cPath . '&cID=' . $boards_categories_id));
}
break;
case 'delete_category_confirm':
if (isset($HTTP_POST_VARS['boards_categories_id'])) {
$boards_categories_id = tep_db_prepare_input($HTTP_POST_VARS['boards_categories_id']);
$categories = array($boards_categories_id);
tep_get_subcategories($categories, $boards_categories_id, TABLE_BOARDS_CATEGORIES);
tep_remove_board_category($categories);
}
tep_redirect(tep_href_link(FILENAME_BOARDS, 'tPath=' . $tPath . '&cPath=' . $cPath));
break;
case 'update':
$boards_id = tep_db_prepare_input($HTTP_GET_VARS['bID']);
$boards_status = tep_db_prepare_input($HTTP_POST_VARS['boards_status']);
$customers_name = tep_db_prepare_input($HTTP_POST_VARS['customers_name']);
$customers_telephone = tep_db_prepare_input($HTTP_POST_VARS['customers_telephone']);
$customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);
$customers_other_contacts = tep_db_prepare_input($HTTP_POST_VARS['customers_other_contacts']);
$customers_country = tep_db_prepare_input($HTTP_POST_VARS['customers_country']);
$customers_state = tep_db_prepare_input($HTTP_POST_VARS['customers_state']);
$customers_city = tep_db_prepare_input($HTTP_POST_VARS['customers_city']);
$boards_price = str_replace(',', '.', (double) $HTTP_POST_VARS['boards_price']);
示例5: using
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";
}
// EOF Separate Pricing Per Customer
if (DISPLAY_PRICE_WITH_TAX == 'true' && (tep_not_null($pfrom) || tep_not_null($pto))) {
if (!tep_session_is_registered('customer_country_id')) {
$customer_country_id = STORE_COUNTRY;
$customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int) $customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int) $customer_zone_id . "')";
}
$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";
if (isset($_GET['categories_id']) && tep_not_null($_GET['categories_id'])) {
if (isset($_GET['inc_subcat']) && $_GET['inc_subcat'] == '1') {
$subcategories_array = array();
tep_get_subcategories($subcategories_array, $_GET['categories_id']);
$where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int) $_GET['categories_id'] . "'";
for ($i = 0, $n = sizeof($subcategories_array); $i < $n; $i++) {
$where_str .= " or p2c.categories_id = '" . (int) $subcategories_array[$i] . "'";
}
$where_str .= ")";
} else {
$where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p2c.categories_id = '" . (int) $_GET['categories_id'] . "'";
}
}
if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {
$where_str .= " and m.manufacturers_id = '" . (int) $_GET['manufacturers_id'] . "'";
}
if (isset($search_keywords) && sizeof($search_keywords) > 0) {
$where_str .= " and (";
for ($i = 0, $n = sizeof($search_keywords); $i < $n; $i++) {
示例6: generate
function generate($HTTP_GET_VARS)
{
global $languages_id, $all_categories, $currency, $currencies, $categories_audio, $customer_discount, $cart, $breadcrumb;
$customer_discount = $cart->get_customer_discount();
if (!is_array($customer_discount)) {
$customer_discount = array();
}
$content = FILENAME_PRICELIST;
$page = tep_db_query_fetch_array("\n\t\t\tSELECT pages_id, \n\t\t\tpages_name, \n\t\t\tpages_additional_description, \n\t\t\tpages_description \n\t\t\tFROM " . TABLE_PAGES . " \n\t\t\tWHERE pages_filename = '" . tep_db_input(basename($content)) . "' \n\t\t\tAND language_id = '" . (int) $languages_id . "'");
define('ADDITIONAL_DESCRIPTION', $page['pages_additional_description']);
$translation_query = tep_db_query("\n\t\t\tSELECT pages_translation_key, \n\t\t\tpages_translation_value \n\t\t\tFROM " . TABLE_PAGES_TRANSLATION . " \n\t\t\tWHERE pages_filename = '" . tep_db_input(basename($content)) . "' \n\t\t\tAND language_id = '" . (int) $languages_id . "'");
while ($translation = tep_db_fetch_array($translation_query)) {
define($translation['pages_translation_key'], $translation['pages_translation_value']);
}
$breadcrumb->add($page['pages_name'], tep_href_link(FILENAME_PRICELIST));
$fields_array = array();
$fields_array['products_model'] = TEXT_CHOOSE_MODEL;
$fields_array['products_name'] = TEXT_CHOOSE_NAME;
$fields_array['categories_name'] = TEXT_CHOOSE_CATEGORY;
$fields_array['authors_name'] = TEXT_CHOOSE_AUTHOR;
$fields_array['manufacturers_name'] = TEXT_CHOOSE_MANUFACTURER;
$fields_array['series_name'] = TEXT_CHOOSE_SERIE;
$fields_array['products_description'] = TEXT_CHOOSE_DESCRIPTION;
$fields_array['products_price'] = TEXT_CHOOSE_PRICE;
$fields_array['products_year'] = TEXT_CHOOSE_YEAR;
$fields_array['products_pages_count'] = TEXT_CHOOSE_PAGES_COUNT;
$fields_array['products_copies'] = TEXT_CHOOSE_COPIES;
$fields_array['products_covers_name'] = TEXT_CHOOSE_COVER;
$fields_array['products_formats_name'] = TEXT_CHOOSE_FORMAT;
$fields_array['products_image'] = TEXT_CHOOSE_IMAGE;
$fields_array['products_url'] = TEXT_CHOOSE_URL;
$fileds_required = array('products_model', 'products_name', 'authors_name', 'products_price', 'manufacturers_name');
$specials_array = array();
$specials_types_query = tep_db_query("\n\t\t\tSELECT specials_types_id, \n\t\t\tspecials_types_name \n\t\t\tFROM " . TABLE_SPECIALS_TYPES . " \n\t\t\tWHERE specials_types_status = '1' \n\t\t\tAND specials_types_path <> '' \n\t\t\tAND language_id = '" . (int) DEFAULT_LANGUAGE_ID . "'");
while ($specials_types = tep_db_fetch_array($specials_types_query)) {
$specials_type_check = tep_db_query_fetch_array("\n\t\t\t\tSELECT count(*) as total \n\t\t\t\tFROM " . TABLE_SPECIALS . " \n\t\t\t\tWHERE specials_types_id = '" . (int) $specials_types['specials_types_id'] . "' \n\t\t\t\tAND status = '1'");
if ($specials_type_check['total'] > 0) {
$specials_array[$specials_types['specials_types_id']] = $specials_types['specials_types_name'];
}
}
$specials_periods_array = array(array('id' => 'w', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_WEEK), array('id' => '2w', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_2_WEEK), array('id' => 'm', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_MONTH), array('id' => 'h', 'text' => ENTRY_PRICELIST_SPECIALS_LAST_HALF_YEAR));
$fields = array();
//здесь была проверка на выдачу определенных полей
$categories = array();
//здесь была проверка на выдачу определенных категорий
$manufacturers = array();
//здесь была проверка на выдачу определенных издательств
$specials = array();
$specials_periods = array();
////здесь была проверка на выдачу определенных типов
$ff = 'xml';
$status = 'active';
$compression_method = '';
//проверить наличие переменной далее
$type_info_query = tep_db_query("SELECT products_types_id, products_last_modified FROM " . TABLE_PRODUCTS_TYPES . " WHERE products_types_status = '1'" . (tep_not_null($HTTP_GET_VARS['type']) ? " and products_types_path = '" . tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['type'])) . "'" : " and products_types_default_status = '1'") . " limit 1");
if (tep_db_num_rows($type_info_query) < 1) {
tep_exit();
} else {
$type_info = tep_db_fetch_array($type_info_query);
$products_types_id = $type_info['products_types_id'];
$products_last_modified = strtotime($type_info['products_last_modified']);
}
$select_string_select = "SELECT distinct p.products_id";
$select_string_from = " FROM " . TABLE_PRODUCTS_INFO . " p";
$select_string_where = " WHERE p.products_types_id = '" . (int) $products_types_id . "' and p.categories_id <> '4990' and p.products_status = '1'" . ($status == 'active' ? " and p.products_listing_status = '1'" : "") . " and p.products_price > '0'";
if (sizeof($categories) > 0) {
$subcategories_array = array();
reset($categories);
while (list(, $category_id) = each($categories)) {
$subcategories_array[] = $category_id;
tep_get_subcategories($subcategories_array, $category_id);
}
$select_string_where .= " and p.categories_id in ('" . implode("', '", $subcategories_array) . "')";
} else {
$disabled_categories = array();
$type_categories_check_query = tep_db_query("SELECT categories_id FROM " . TABLE_CATEGORIES . " WHERE products_types_id = '" . (int) $products_types_id . "'");
$type_categories_check = tep_db_fetch_array($type_categories_check_query);
if ($type_categories_check['categories_id'] > 0) {
$active_categories = array();
} else {
$active_categories = array('0');
}
$categories_query = tep_db_query("SELECT categories_id, categories_xml_status FROM " . TABLE_CATEGORIES . " WHERE products_types_id = '" . (int) $products_types_id . "' and categories_status = '1' order by parent_id");
while ($categories = tep_db_fetch_array($categories_query)) {
if ($categories['categories_xml_status'] < 1 && !in_array($categories['categories_id'], $disabled_categories)) {
$disabled_categories[] = $categories['categories_id'];
tep_get_subcategories($disabled_categories, $categories['categories_id']);
} elseif (!in_array($categories['categories_id'], $disabled_categories)) {
if (!in_array($categories['categories_id'], $active_categories)) {
$active_categories[] = $categories['categories_id'];
}
}
}
$select_string_where .= " and p.categories_id > '0'";
if (sizeof($disabled_categories) > 0) {
$select_string_where .= " and p.categories_id not in ('" . implode("', '", $disabled_categories) . "')";
}
}
// if ($customer_id==2) { echo $select_string_where; die; }
$manufacturers_array = array();
//.........这里部分代码省略.........
示例7: fopen
$fp = fopen($products_cache_filename, 'r');
while (!feof($fp)) {
$subcategories_products[] = trim(fgets($fp, 16));
}
fclose($fp);
}
if (!is_array($subcategories_products)) {
$subcategories_products = array();
}
if (!isset($products_to_search)) {
$listing_number_of_rows = sizeof($subcategories_products);
}
} else {
$subcategories = array($show_category_id);
if (isset($show_subcategories_products) && $show_subcategories_products == true) {
tep_get_subcategories($subcategories, $show_category_id);
}
$subcategories_list_query = tep_db_query("select distinct products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id in ('" . implode("', '", $subcategories) . "')");
while ($subcategories_list = tep_db_fetch_array($subcategories_list_query)) {
$subcategories_products[] = $subcategories_list['products_id'];
}
}
if (isset($products_to_search) && is_array($products_to_search)) {
$products_to_search = array_intersect($products_to_search, $subcategories_products);
} else {
$products_to_search = $subcategories_products;
}
}
if (isset($products_to_search) && is_array($products_to_search)) {
$listing_sql_where .= " and p.products_id in ('" . implode("', '", $products_to_search) . "')";
}
示例8: tep_get_subcategories
function tep_get_subcategories(&$subcategories_array, $parent_id = 0)
{
global $osC_Database;
$Qsubcategories = $osC_Database->query('select categories_id from :table_categories where parent_id = :parent_id');
$Qsubcategories->bindTable(':table_categories', TABLE_CATEGORIES);
$Qsubcategories->bindInt(':parent_id', $parent_id);
$Qsubcategories->execute();
while ($Qsubcategories->next()) {
$subcategories_array[sizeof($subcategories_array)] = $Qsubcategories->valueInt('categories_id');
if ($Qsubcategories->valueInt('categories_id') != $parent_id) {
tep_get_subcategories($subcategories_array, $Qsubcategories->valueInt('categories_id'));
}
}
}
示例9: elseif
$update_products_params = true;
}
if ((int) $HTTP_POST_VARS['categories_id'] == 0 && (int) $HTTP_POST_VARS['manufacturers_id'] == 0 && (int) $HTTP_POST_VARS['series_id'] == 0 && (int) $HTTP_POST_VARS['products_types_id'] == 0) {
$messageStack->add(ERROR_NO_PARAMETERS_SELECTED, 'error');
} elseif ($update_products_prices == false && $update_products_params == false) {
$messageStack->add(ERROR_NO_VALUES_SELECTED, 'error');
} else {
$sql = "select distinct p.products_id" . ($update_products_prices ? ", p." . tep_db_input($HTTP_POST_VARS['price_from']) . " as products_price" : '') . " from " . TABLE_PRODUCTS . " p";
if (tep_not_null($HTTP_POST_VARS['categories_id'])) {
$sql .= ", " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ";
}
$sql .= " where";
if (tep_not_null($HTTP_POST_VARS['categories_id'])) {
$subcategories = array($HTTP_POST_VARS['categories_id']);
if ($HTTP_POST_VARS['inc_sub']) {
tep_get_subcategories($subcategories, $HTTP_POST_VARS['categories_id']);
}
$subcategories = array_map("tep_string_to_int", $subcategories);
$sql .= " p.products_id = p2c.products_id and p2c.categories_id in ('" . implode("', '", $subcategories) . "')";
}
if (tep_not_null($HTTP_POST_VARS['manufacturers_id'])) {
$sql .= " and p.manufacturers_id = '" . (int) $HTTP_POST_VARS['manufacturers_id'] . "'";
}
if (tep_not_null($HTTP_POST_VARS['series_id'])) {
$sql .= " and p.series_id = '" . (int) $HTTP_POST_VARS['series_id'] . "' ";
}
if (tep_not_null($HTTP_POST_VARS['products_types_id'])) {
$sql .= " and p.products_types_id = '" . (int) $HTTP_POST_VARS['products_types_id'] . "' ";
}
$updated = 0;
$products_query = tep_db_query($sql);
示例10: sleep
sleep(1);
tep_redirect(tep_href_link(FILENAME_PRODUCTS_UPLOAD));
}
} else {
$error = sprintf(ERROR_NO_FILE_UPLOAD, $filename_gz);
if (isset($argv)) {
$error = mb_convert_encoding($error, 'UTF-8', 'CP1251');
die($error);
} else {
$messageStack->add($error, 'error');
}
}
}
if ($action == 'upload_products' || $action == 'upload_products_new' || $action == 'upload_other_products' || $action == 'small_upload') {
$categories_audio = array();
tep_get_subcategories($categories_audio, $categories_audio_top_id);
$in_shops = array();
if ($action == 'upload_other_products') {
$filename_gz = UPLOAD_DIR . $upload_csv_dir . 'Tovar.csv.gz';
} elseif ($action == 'upload_products_new') {
$filename_gz = UPLOAD_DIR . $upload_csv_dir . 'Books1.csv.gz';
} else {
$filename_gz = UPLOAD_DIR . $upload_csv_dir . 'Books.csv.gz';
}
if ($action == 'upload_products_new') {
$file_to_include = DIR_WS_INCLUDES . 'upload/products_1.php';
} else {
$file_to_include = DIR_WS_INCLUDES . 'upload/products.php';
}
if (tep_db_table_exists(DB_DATABASE, TABLE_TEMP_PRODUCTS)) {
$messageStack->add(WARNING_UPDATE_IN_PROGRESS, 'warning');
示例11: tep_get_subcategories
function tep_get_subcategories(&$subcategories_array, $parent_id = 0)
{
$OSCOM_Db = Registry::get('Db');
$Qsub = $OSCOM_Db->prepare('select categories_id from :table_categories where parent_id = :parent_id');
$Qsub->bindInt(':parent_id', $parent_id);
$Qsub->execute();
while ($Qsub->fetch()) {
$subcategories_array[sizeof($subcategories_array)] = $Qsub->valueInt('categories_id');
if ($Qsub->valueInt('categories_id') != $parent_id) {
tep_get_subcategories($subcategories_array, $Qsub->valueInt('categories_id'));
}
}
}
示例12: tep_db_query
@unlink(DIR_FS_CATALOG_IMAGES . $prev_file['categories_image']);
}
tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $upload->filename . "' where categories_id = '" . (int) $categories_id . "'");
}
}
}
tep_update_blocks($categories_id, 'category');
tep_db_query("update " . TABLE_PRODUCTS_TYPES . " set products_last_modified = now() where products_types_id = '" . (int) $tPath . "'");
tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&cPath=' . $cPath . '&cID=' . $categories_id));
}
break;
case 'delete_category_confirm':
if (isset($HTTP_POST_VARS['categories_id'])) {
$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
$categories = array($categories_id);
tep_get_subcategories($categories, $categories_id);
$products = array();
$products_delete = array();
if ($HTTP_POST_VARS['delete_category_products'] == '1') {
for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
$product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int) $categories[$i]['id'] . "'");
while ($product_ids = tep_db_fetch_array($product_ids_query)) {
$products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];
}
}
reset($products);
while (list($key, $value) = each($products)) {
$category_ids = '';
for ($i = 0, $n = sizeof($value['categories']); $i < $n; $i++) {
$category_ids .= "'" . (int) $value['categories'][$i] . "', ";
}
示例13: rand
if (defined('FEATURED_PRODUCTS_SPECIALS_ONLY') and FEATURED_PRODUCTS_SPECIALS_ONLY == 'true') {
$query .= 'FROM ' . TABLE_SPECIALS . ' s LEFT JOIN ' . TABLE_PRODUCTS . ' p ON s.products_id = p.products_id ';
} else {
$query .= 'FROM ' . TABLE_PRODUCTS . ' p LEFT JOIN ' . TABLE_SPECIALS . ' s ON p.products_id = s.products_id ';
}
if ($current_page && $current_page == FILENAME_DEFAULT) {
$query .= 'LEFT JOIN ' . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id = pd.products_id AND pd.language_id = '" . $languages_id . "'\n\t\tLEFT JOIN " . TABLE_FEATURED . " f ON p.products_id = f.products_id\n\t\tWHERE p.products_status = '1' AND f.status = '1' order by rand({$mtm}) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS_HOME;
} else {
$query .= 'LEFT JOIN ' . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id = pd.products_id AND pd.language_id = '" . $languages_id . "'\n\t\tLEFT JOIN " . TABLE_FEATURED . " f ON p.products_id = f.products_id\n\t\tWHERE p.products_status = '1' AND f.status = '1' order by rand({$mtm}) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS;
}
$featured_products_query = tep_db_query($query);
$title = TABLE_HEADING_FEATURED_PRODUCTS;
} else {
$title = sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name);
$subcategories_array = array();
tep_get_subcategories($subcategories_array, $featured_products_category_id);
$featured_products_category_id_list = tep_array_values_to_string($subcategories_array);
if ($featured_products_category_id_list == '') {
$featured_products_category_id_list .= $featured_products_category_id;
} else {
$featured_products_category_id_list .= ',' . $featured_products_category_id;
}
if (defined('FEATURED_PRODUCTS_SUB_CATEGORIES') and FEATURED_PRODUCTS_SUB_CATEGORIES == 'true') {
// current catID as starting value
$cats[] = $new_products_category_id;
// put cat-IDs of all cats nested in current branch into $cats array,
// go through all subbranches
for ($i = 0; $i < count($cats); $i++) {
$categorie_query = tep_db_query('SELECT `categories_id` FROM ' . TABLE_CATEGORIES . " WHERE parent_id = '" . (int) $cats[$i] . "'");
while ($categorie = tep_db_fetch_array($categorie_query)) {
$cats[] = $categorie['categories_id'];
示例14: array
if ($product_check_status['products_status'] == '1') {
$linked_products_array[] = $linked['linked_id'];
}
}
$linked_categories = array();
$parent_categories = array();
$product_categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $products_id . "'");
while ($product_categories = tep_db_fetch_array($product_categories_query)) {
$parent_categories[] = $product_categories['categories_id'];
tep_get_parents($parent_categories, $product_categories['categories_id']);
}
$linked_query = tep_db_query("select cl.linked_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_LINKED . " cl where 1 and c.categories_status = '1' and c.categories_id = cl.linked_id and cl.categories_id in ('" . implode("', '", $parent_categories) . "')");
if (tep_db_num_rows($linked_query) > 0 || sizeof($linked_products_array) > 0) {
while ($linked = tep_db_fetch_array($linked_query)) {
$linked_categories[] = $linked['linked_id'];
tep_get_subcategories($linked_categories, $linked['linked_id']);
}
reset($linked_categories);
shuffle($linked_categories);
while (list(, $linked_categories_id) = each($linked_categories)) {
$linked_products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int) $linked_categories_id . "'");
while ($linked_products = tep_db_fetch_array($linked_products_query)) {
$product_check_status_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int) $linked_products['products_id'] . "'");
$product_check_status = tep_db_fetch_array($product_check_status_query);
if ($product_check_status['products_status'] == '1' && $linked_products['products_id'] != $products_id) {
$linked_products_array[] = $linked_products['products_id'];
if (sizeof($linked_products_array) >= $limit) {
break;
}
}
}
示例15: SUM
$select_str .= ", SUM(tr.tax_rate) as tax_rate ";
}
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";
if (DISPLAY_PRICE_WITH_TAX == 'true' && (tep_not_null($pfrom) || tep_not_null($pto))) {
if (!tep_session_is_registered('customer_country_id')) {
$customer_country_id = STORE_COUNTRY;
$customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int) $customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int) $customer_zone_id . "')";
}
$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";
if (isset($HTTP_GET_VARS['categories_id']) && tep_not_null($HTTP_GET_VARS['categories_id'])) {
if (isset($HTTP_GET_VARS['inc_subcat']) && $HTTP_GET_VARS['inc_subcat'] == '1') {
$subcategories_array = array();
tep_get_subcategories($subcategories_array, $HTTP_GET_VARS['categories_id']);
$where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int) $HTTP_GET_VARS['categories_id'] . "'";
for ($i = 0, $n = sizeof($subcategories_array); $i < $n; $i++) {
$where_str .= " or p2c.categories_id = '" . (int) $subcategories_array[$i] . "'";
}
$where_str .= ")";
} else {
$where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p2c.categories_id = '" . (int) $HTTP_GET_VARS['categories_id'] . "'";
}
}
if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
$where_str .= " and m.manufacturers_id = '" . (int) $HTTP_GET_VARS['manufacturers_id'] . "'";
}
if (isset($search_keywords) && sizeof($search_keywords) > 0) {
$where_str .= " and (";
for ($i = 0, $n = sizeof($search_keywords); $i < $n; $i++) {