本文整理汇总了PHP中xtDBquery函数的典型用法代码示例。如果您正苦于以下问题:PHP xtDBquery函数的具体用法?PHP xtDBquery怎么用?PHP xtDBquery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xtDBquery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xtc_get_products_image
function xtc_get_products_image($products_id = '')
{
$product_query = "select products_image from " . TABLE_PRODUCTS . " where products_id = '" . xtc_db_input((int) $products_id) . "'";
$product_query = xtDBquery($product_query);
$products_image = xtc_db_fetch_array($product_query, true);
return $products_image['products_image'];
}
示例2: get_category_tree
function get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false, $cPath = '')
{
if ($parent_id == 0) {
$cPath = '';
} else {
$cPath .= $parent_id . '_';
}
if (!is_array($category_tree_array)) {
$category_tree_array = array();
}
if (sizeof($category_tree_array) < 1 && $exclude != '0') {
$category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);
}
if ($include_itself) {
// $category_query = "select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $_SESSION['languages_id'] . "' and c.categories_status = '1' and cd.categories_id = '" . $parent_id . "'";
$category_query = xtDBquery($category_query);
$category_query = "select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $_SESSION['languages_id'] . "' and c.categories_status = '1' and cd.categories_id = '" . $parent_id . "' order by cd.categories_name ";
$category = xtc_db_fetch_array($category_query, true);
$category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
}
$categories_query = "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $_SESSION['languages_id'] . "' and c.parent_id = '" . $parent_id . "' and c.categories_status = '1' order by cd.categories_name";
$categories_query = xtDBquery($categories_query);
while ($categories = xtc_db_fetch_array($categories_query, true)) {
$SEF_link = xtc_href_link(FILENAME_DEFAULT, xtc_category_link($categories['categories_id'], $categories['categories_name']));
if ($exclude != $categories['categories_id']) {
$category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'link' => $SEF_link);
}
$category_tree_array = get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array, false, $cPath);
}
return $category_tree_array;
}
示例3: xtc_get_tax_rate
function xtc_get_tax_rate($class_id, $country_id = -1, $zone_id = -1)
{
if ($country_id == -1 && $zone_id == -1) {
if (!isset($_SESSION['customer_id'])) {
$country_id = STORE_COUNTRY;
$zone_id = STORE_ZONE;
} else {
$country_id = $_SESSION['customer_country_id'];
$zone_id = $_SESSION['customer_zone_id'];
}
} else {
$country_id = $country_id;
$zone_id = $zone_id;
}
$tax_query = xtDBquery("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . xtc_db_input((int) $country_id) . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . xtc_db_input((int) $zone_id) . "') and tr.tax_class_id = '" . xtc_db_input((int) $class_id) . "' group by tr.tax_priority");
if (xtc_db_num_rows($tax_query, true)) {
$tax_multiplier = 1.0;
while ($tax = xtc_db_fetch_array($tax_query, true)) {
$tax_multiplier *= 1.0 + $tax['tax_rate'] / 100;
}
return ($tax_multiplier - 1.0) * 100;
} else {
return 0;
}
}
示例4: xtc_get_vpe_name
function xtc_get_vpe_name($vpeID)
{
$vpe_query = "SELECT products_vpe_name FROM " . TABLE_PRODUCTS_VPE . " WHERE language_id='" . xtc_db_input((int) $_SESSION['languages_id']) . "' and products_vpe_id='" . xtc_db_input((int) $vpeID) . "'";
$vpe_query = xtDBquery($vpe_query);
$vpe = xtc_db_fetch_array($vpe_query, true);
return $vpe['products_vpe_name'];
}
示例5: xtc_get_path
function xtc_get_path($current_category_id = '')
{
global $cPath_array;
if (xtc_not_null($current_category_id)) {
$cp_size = sizeof($cPath_array);
if ($cp_size == 0) {
$cPath_new = $current_category_id;
} else {
$cPath_new = '';
$last_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . xtc_db_input((int) $cPath_array[$cp_size - 1]) . "'";
$last_category_query = xtDBquery($last_category_query);
$last_category = xtc_db_fetch_array($last_category_query, true);
$current_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . xtc_db_input((int) $current_category_id) . "'";
$current_category_query = xtDBquery($current_category_query);
$current_category = xtc_db_fetch_array($current_category_query, true);
if ($last_category['parent_id'] == $current_category['parent_id']) {
for ($i = 0; $i < $cp_size - 1; $i++) {
$cPath_new .= '_' . $cPath_array[$i];
}
} else {
for ($i = 0; $i < $cp_size; $i++) {
$cPath_new .= '_' . $cPath_array[$i];
}
}
$cPath_new .= '_' . $current_category_id;
if (substr($cPath_new, 0, 1) == '_') {
$cPath_new = substr($cPath_new, 1);
}
}
} else {
$cPath_new = xtc_not_null($cPath_array) ? implode('_', $cPath_array) : '';
}
return 'cPath=' . $cPath_new;
}
示例6: xtc_product_link
function xtc_product_link($pID, $name = '')
{
#Check for current category link
$c_path = $_SERVER['QUERY_STRING'];
if (strpos($c_path, 'cPath') !== false) {
$category_path = substr($c_path, strpos($c_path, '=') + 1);
$categorie_previous = end(explode('_', $category_path));
$cat_children = array();
$cat_children = xtc_get_categories_children($categorie_previous);
foreach ($cat_children as $linked_cat) {
$category_query_check = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $pID . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 and p2c.categories_id = '" . $linked_cat . "'";
$category_query_check = xtDBquery($category_query_check);
if (xtc_db_num_rows($category_query_check, true)) {
$cID = xtc_db_fetch_array($category_query_check)['categories_id'];
break;
}
}
}
#Take default categorie id
if (!isset($cID)) {
$category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $pID . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0";
$category_query = xtDBquery($category_query);
if (xtc_db_num_rows($category_query, true)) {
$cID = xtc_db_fetch_array($category_query)['categories_id'];
}
}
#Create category path from category ID
$categories = array();
xtc_get_parent_categories($categories, $cID);
$categories = array_reverse($categories);
$categories[] = $cID;
$cPath = implode('_', $categories);
return 'products_id=' . $pID . '&cPath=' . $cPath;
}
示例7: xtc_get_tax_description
function xtc_get_tax_description($class_id, $country_id = -1, $zone_id = -1)
{
if ($country_id == -1 && $zone_id == -1) {
if (!isset($_SESSION['customer_id'])) {
$country_id = STORE_COUNTRY;
$zone_id = STORE_ZONE;
} else {
$country_id = $_SESSION['customer_country_id'];
$zone_id = $_SESSION['customer_zone_id'];
}
} else {
$country_id = $country_id;
$zone_id = $zone_id;
}
$tax_query = xtDBquery("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . xtc_db_input((int) $country_id) . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . xtc_db_input((int) $zone_id) . "') and tr.tax_class_id = '" . xtc_db_input((int) $class_id) . "' order by tr.tax_priority");
if (xtc_db_num_rows($tax_query, true)) {
$tax_description = '';
while ($tax = xtc_db_fetch_array($tax_query, true)) {
$tax_description .= $tax['tax_description'] . ' + ';
}
$tax_description = substr($tax_description, 0, -3);
return $tax_description;
} else {
return TEXT_UNKNOWN_TAX_RATE;
}
}
示例8: main
function main()
{
$this->SHIPPING = array();
// prefetch shipping status
$status_query = xtDBquery("SELECT\n shipping_status_name,\n shipping_status_image,shipping_status_id\n FROM " . TABLE_SHIPPING_STATUS . "\n where language_id = '" . (int) $_SESSION['languages_id'] . "'");
while ($status_data = olc_db_fetch_array($status_query, true)) {
$this->SHIPPING[$status_data['shipping_status_id']] = array('name' => $status_data['shipping_status_name'], 'image' => $status_data['shipping_status_image']);
}
}
示例9: xtc_get_product_path
function xtc_get_product_path($products_id)
{
$cPath = '';
$category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0";
$category_query = xtDBquery($category_query);
if (xtc_db_num_rows($category_query, true)) {
#Default category( first picked from table)
$category = xtc_db_fetch_array($category_query);
$p_path_full = $_SERVER['REQUEST_URI'];
$p_path = $_SERVER['QUERY_STRING'];
#If we display product check linked categories
if (strpos($p_path, 'products_id') !== false) {
while ($categoryies = xtc_db_fetch_array($category_query)) {
$cat_name = xtc_get_categories_name($categoryies['categories_id']);
$cat_name_slug = shopstat_hrefSmallmask($cat_name);
$p_path_full_array = explode('/', $p_path_full);
if ($p_path_full_array[count($p_path_full_array) - 2] === $cat_name_slug) {
$category = $categoryies;
break;
}
}
}
# Check if current categorie or its children have linked product
$c_path = $_SERVER['QUERY_STRING'];
if (strpos($c_path, 'cPath') !== false) {
$category_path = substr($c_path, strpos($c_path, '=') + 1);
$categorie_previous = end(explode('_', $category_path));
$cat_children = array();
$cat_children = xtc_get_categories_children($categorie_previous);
foreach ($cat_children as $linked_cat) {
$category_query_check = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 and p2c.categories_id = '" . $linked_cat . "'";
$category_query_check = xtDBquery($category_query_check);
if (xtc_db_num_rows($category_query_check, true)) {
$category = xtc_db_fetch_array($category_query_check);
break;
}
}
}
$categories = array();
xtc_get_parent_categories($categories, $category['categories_id']);
$categories = array_reverse($categories);
$cPath = implode('_', $categories);
if (xtc_not_null($cPath)) {
$cPath .= '_';
}
$cPath .= $category['categories_id'];
}
//BOF - Dokuman - 2009-10-02 - removed feature, due to wrong links in category on "last viewed"
/*
if($_SESSION['lastpath']!=''){
$cPath = $_SESSION['lastpath'];
}
*/
//EOF - Dokuman - 2009-10-02 - removed feature, due to wrong links in category on "last viewed"
return $cPath;
}
示例10: xtc_get_order_description
function xtc_get_order_description($product_id, $language = '')
{
if (empty($language)) {
$language = $_SESSION['languages_id'];
}
$product_query = "select products_order_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . xtc_db_input((int) $product_id) . "' and language_id = '" . xtc_db_input((int) $language) . "'";
$product_query = xtDBquery($product_query);
$product = xtc_db_fetch_array($product_query, true);
return $product['products_order_description'];
}
示例11: xtc_get_categories_name
function xtc_get_categories_name($categories_id)
{
if (GROUP_CHECK == 'true') {
$group_check = "and c.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
}
$categories_name_query = "SELECT cd.categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c WHERE cd.categories_id = '" . $categories_id . "' AND c.categories_id=cd.categories_id " . $group_check . " AND cd.language_id='" . (int) $_SESSION['languages_id'] . "'";
$categories_name_query = xtDBquery($categories_name_query);
$categories_name = xtc_db_fetch_array($categories_name_query, true);
return $categories_name['categories_name'];
}
示例12: xtc_has_product_attributes
function xtc_has_product_attributes($products_id)
{
$attributes_query = "select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id . "'";
$attributes_query = xtDBquery($attributes_query);
$attributes = xtc_db_fetch_array($attributes_query, true);
if ($attributes['count'] > 0) {
return true;
} else {
return false;
}
}
示例13: xtc_get_subcategories
function xtc_get_subcategories(&$subcategories_array, $parent_id = 0)
{
$subcategories_query = "select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . xtc_db_input((int) $parent_id) . "'";
$subcategories_query = xtDBquery($subcategories_query);
while ($subcategories = xtc_db_fetch_array($subcategories_query, true)) {
$subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id'];
if ($subcategories['categories_id'] != $parent_id) {
xtc_get_subcategories($subcategories_array, $subcategories['categories_id']);
}
}
}
示例14: xtc_has_category_subcategories
function xtc_has_category_subcategories($category_id)
{
$child_category_query = "select count(*) as count from " . TABLE_CATEGORIES . " where parent_id = '" . xtc_db_input((int) $category_id) . "'";
$child_category_query = xtDBquery($child_category_query);
$child_category = xtc_db_fetch_array($child_category_query, true);
if ($child_category['count'] > 0) {
return true;
} else {
return false;
}
}
示例15: xtc_get_categories_children_calc
function xtc_get_categories_children_calc($cat_id, &$cat_children)
{
$categories_query = "select categories_id, parent_id from " . TABLE_CATEGORIES . " where parent_id = '" . $cat_id . "'";
$categories_query = xtDBquery($categories_query);
if (xtc_db_num_rows($categories_query, true)) {
while ($categoryies = xtc_db_fetch_array($categories_query)) {
$cat_children[] = $categoryies['categories_id'];
xtc_get_categories_children($categoryies['categories_id'], $cat_children);
}
}
}