本文整理汇总了PHP中tep_db_free_result函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_db_free_result函数的具体用法?PHP tep_db_free_result怎么用?PHP tep_db_free_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_db_free_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
$this->get_value = $this->parsePath($_GET['articles_id']);
$this->original_get = (int) $_GET['articles_id'];
$this->cache_name = $this->setCacheString(__FILE__, 'article_info', $this->original_get);
if (false !== $this->retrieve($this->cache_name)) {
KissMT::init()->setCanonical($this->checkCanonical('articles_id'));
return;
}
$query_replacements = array(':articles_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
$query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->article_query);
$result = KissMT::init()->query($query);
$article_details = tep_db_fetch_array($result);
tep_db_free_result($result);
$name = trim($article_details['name']);
$description = trim($article_details['description']);
$breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb'));
if (array_key_exists($name, $breadcrumb)) {
unset($breadcrumb[$name]);
}
$breadcrumb = array_flip($breadcrumb);
$leading_values = $name . (!empty($breadcrumb) ? '[-separator-]' . implode('[-separator-]', $breadcrumb) : '');
KissMT::init()->setCanonical($this->checkCanonical('articles_id'));
$this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities($description, $decode = true));
}
示例2: process
public function process()
{
$this->get_value = '';
$this->original_get = '';
$this->cache_name = $this->setCacheString(__FILE__, 'listing', 'general');
if (false !== $this->retrieve($this->cache_name)) {
KissMT::init()->setCanonical($this->checkCanonical());
return;
}
$query_replacements = array(':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
$query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->reviews_query);
$result = KissMT::init()->query($query);
$list_array = array();
while ($reviews_products_results = tep_db_fetch_array($result)) {
if (tep_not_null($reviews_products_results['products_name'])) {
$list_array[] = trim($reviews_products_results['products_name']);
}
}
$list_string = implode('[-separator-]', $this->removeArrayDuplicates($list_array));
tep_db_free_result($result);
$list_string = tep_not_null($list_string) ? $list_string : false;
$leading_values = implode('[-separator-]', KissMT::init()->retrieve('breadcrumb'));
KissMT::init()->setCanonical($this->checkCanonical());
$this->parse(KissMT::init()->entities(sprintf(KISSMT_REVIEWS_TEXT, $leading_values), $decode = true), KissMT::init()->entities($list_string, $decode = true));
}
示例3: retrieve
public function retrieve()
{
if (SEO_URLS_ENABLED != 'false') {
$query = str_replace(':cache_name', $this->cachename, $this->extract_query);
$result = usu::query($query);
$row = tep_db_fetch_array($result);
tep_db_free_result($result);
if (!empty($row)) {
$cache_seconds = usu::$cachedays * 24 * 60 * 60;
if (time() > strtotime($row['cache_date']) + $cache_seconds) {
$this->gc();
} else {
usu::$cachefile_size = number_format(strlen($row['cache_data']) / 1024, 2) . ' kb';
usu::$performance['time'] = microtime(true);
$this->md5check = md5($row['cache_data']);
$rawdata = gzinflate(base64_decode($row['cache_data']));
usu::$registry = unserialize($rawdata);
usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
$this->retrieved = true;
return true;
}
}
}
usu::$registry = Usu_Registry::getInstance();
}
示例4: acquire
protected function acquire($dependency, $fullpath)
{
$this->products_id = (int) $dependency;
// Bypass the query if already in the registry
if (false !== isset(usu::$registry->{$this->dependency}[$this->products_id])) {
usu::$performance['queries_saved']++;
return true;
}
$placeholders = array(':pid', ':languages_id');
// $values are already type cast
$values = array($this->products_id, usu::$languages_id);
$this->query = str_replace($placeholders, $values, $this->base_query);
$result = usu::query($this->query);
$this->query = null;
$row = tep_db_fetch_array($result);
tep_db_free_result($result);
if (false === $row) {
return false;
}
$this->link_text = $this->linkText($row['products_name']);
if (false === isset(usu::$registry->{$this->dependency})) {
usu::$registry->{$this->dependency} = array();
}
usu::$registry->attach($this->dependency, $this->products_id, $this->getProperties());
}
示例5: process
public function process()
{
$this->cache_name = false;
if (array_key_exists('tPath', $_GET)) {
$this->get_value = $this->parsePath($_GET['tPath']);
$this->original_get = is_numeric(str_replace('_', '', $_GET['tPath'])) ? $_GET['tPath'] : '1';
$this->cache_name = $this->setCacheString(__FILE__, 'articles_topic', $this->original_get);
$get_key = 'tPath';
$query = $this->topics_query;
} elseif (array_key_exists('authors_id', $_GET)) {
$this->get_value = $this->parsePath($_GET['authors_id']);
$this->original_get = (int) $_GET['authors_id'];
$this->cache_name = $this->setCacheString(__FILE__, 'articles_author', $this->original_get);
$get_key = 'authors_id';
$query = $this->authors_query;
} else {
$this->get_value = false;
$this->original_get = false;
$this->cache_name = $this->setCacheString(__FILE__, 'articles_all', 'general');
$get_key = false;
$query = $this->all_topics_query;
}
if (false !== ($this->cache_name && $this->retrieve($this->cache_name))) {
KissMT::init()->setCanonical($this->checkCanonical($get_key));
return;
}
if (false === $this->get_value) {
$query_replacements = array(':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
$query = str_replace(array_keys($query_replacements), array_values($query_replacements), $query);
$result = KissMT::init()->query($query);
$description = '';
while ($row = tep_db_fetch_array($result)) {
if (tep_not_null($row['name'])) {
$description .= trim($row['name']) . '[-separator-]';
}
}
$description = tep_not_null($description) ? $description : false;
$name = defined('HEADING_TITLE') ? HEADING_TITLE : ucfirst(str_replace('_', ' ', substr(KissMT::init()->retrieve('basename'), 0, strlen(KissMT::init()->retrieve('basename')) - 4)));
} else {
$query_replacements = array(':' . $get_key => $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
$query = str_replace(array_keys($query_replacements), array_values($query_replacements), $query);
$result = KissMT::init()->query($query);
$detail = tep_db_fetch_array($result);
$name = trim($detail['name']);
$description = tep_not_null($detail['description']) ? trim($detail['description']) : false;
}
tep_db_free_result($result);
$breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb'));
if (array_key_exists($name, $breadcrumb)) {
unset($breadcrumb[$name]);
}
if (array_key_exists($description, $breadcrumb)) {
unset($breadcrumb[$description]);
}
$breadcrumb = array_flip($breadcrumb);
$leading_values = $name . (!empty($breadcrumb) ? '[-separator-]' . implode('[-separator-]', $breadcrumb) : '');
KissMT::init()->setCanonical($this->checkCanonical($get_key));
$this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities($description, $decode = true));
}
示例6: process
public function process()
{
$this->get_value = $this->parsePath($_GET['products_id']);
$this->original_get = (int) $_GET['products_id'];
$this->cache_name = $this->setCacheString(__FILE__, 'reviews_id', $this->original_get);
if (false !== $this->retrieve($this->cache_name)) {
$reviews_string = isset($_GET['reviews_id']) && is_numeric($_GET['reviews_id']) ? '&reviews_id=' . $_GET['reviews_id'] : '';
KissMT::init()->setCanonical($this->checkCanonical('products_id', $reviews_string));
return;
}
$query_replacements = array(':products_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
$query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->products_query);
$result = KissMT::init()->query($query);
$reviews_text = '';
$products_model = '';
$products_name = '';
$manufacturers_name = '';
while ($product_results = tep_db_fetch_array($result)) {
if (tep_not_null($product_results['products_model'])) {
$products_model = trim($product_results['products_model']);
}
if (tep_not_null($product_results['products_name'])) {
$products_name = trim($product_results['products_name']);
}
if (tep_not_null($product_results['manufacturers_name'])) {
$manufacturers_name = trim($product_results['manufacturers_name']);
}
if (tep_not_null($product_results['reviews_text'])) {
$reviews_text .= trim(rtrim($product_results['reviews_text'], '.') . '.') . '[-separator-]';
}
}
tep_db_free_result($result);
$breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb'));
if (array_key_exists($products_model, $breadcrumb)) {
unset($breadcrumb[$products_model]);
}
if (array_key_exists($products_name, $breadcrumb)) {
unset($breadcrumb[$products_name]);
}
if (array_key_exists(NAVBAR_TITLE, $breadcrumb)) {
unset($breadcrumb[NAVBAR_TITLE]);
}
$breadcrumb = array_flip($breadcrumb);
$leading_values = $products_name;
if (tep_not_null($products_model)) {
$leading_values .= '[-separator-]' . $products_model;
}
$leading_values .= '[-separator-]' . implode('[-separator-]', $breadcrumb);
if (tep_not_null($manufacturers_name)) {
$leading_values .= '[-separator-]' . sprintf(KISSMT_BRAND_TEXT, $manufacturers_name);
}
$reviews_string = isset($_GET['reviews_id']) && is_numeric($_GET['reviews_id']) ? '&reviews_id=' . $_GET['reviews_id'] : '';
KissMT::init()->setCanonical($this->checkCanonical('products_id', $reviews_string));
$this->parse(KissMT::init()->entities(sprintf(KISSMT_PRODUCT_REVIEWS_TEXT, $leading_values), $decode = true), KissMT::init()->entities($reviews_text, $decode = true));
}
示例7: process
public function process()
{
// Do we have a reviews_id
if (array_key_exists('reviews_id', $_GET) && tep_not_null($_GET['reviews_id'])) {
$this->get_value = $this->parsePath($_GET['reviews_id']);
$this->original_get = (int) $_GET['reviews_id'];
$this->cache_name = $this->setCacheString(__FILE__, 'ndesk_rev_info', $this->original_get);
if (false !== $this->retrieve($this->cache_name)) {
KissMT::init()->setCanonical($this->checkCanonical('newsPath'));
return;
}
$query_replacements = array(':reviews_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
$query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->query);
$result = KissMT::init()->query($query);
$description = '';
$name = '';
$details = tep_db_fetch_array($result);
$name = trim($details['name']);
$description .= trim($details['description']);
$newsdesk_name = trim($details['newsdesk_name']);
tep_db_free_result($result);
$description = isset($description) && tep_not_null($description) ? $description : false;
$name = isset($name) && tep_not_null($name) ? $name : '';
$newsdesk_name = isset($newsdesk_name) && tep_not_null($newsdesk_name) ? $newsdesk_name : '';
$breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb'));
if (array_key_exists($name, $breadcrumb)) {
unset($breadcrumb[$name]);
}
if (tep_not_null($breadcrumb)) {
// Is there still something in the breadcrumb array?
$breadcrumb = array_flip($breadcrumb);
$leading_values = implode('[-separator-]', $breadcrumb) . (tep_not_null($newsdesk_name) ? '[-separator-]' . $newsdesk_name : '') . (tep_not_null($name) ? '[-separator-]' . $name : '');
} else {
// Nothing in the breadcrumb array
$leading_values = (tep_not_null($newsdesk_name) ? '[-separator-]' . $newsdesk_name : '') . (tep_not_null($name) ? $name : HEADING_TITLE);
}
} else {
// No reviews_id so we'll work with what we have
$leading_values = implode('[-separator-]', KissMT::init()->retrieve('breadcrumb'));
$description = false;
}
KissMT::init()->setCanonical($this->checkCanonical('reviews_id'));
$this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities(trim($description), $decode = true));
}
示例8: gc
public function gc()
{
if (KISSMT_CACHE_RESET !== 'reset') {
return false;
}
foreach (glob(KissMT::init()->retrieve('cache_path') . "*.cache") as $filename) {
@unlink($filename);
}
$query = "SELECT configuration_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'KISSMT_CACHE_RESET'";
$result = tep_db_query($query);
$db_installed = tep_db_fetch_array($result);
tep_db_free_result($result);
if (false !== $db_installed) {
$query = "UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = 'false' WHERE configuration_key = 'KISSMT_CACHE_RESET'";
tep_db_query($query);
}
}
示例9: acquireLinkText
/**
* Acquire an array of single or multiple link texts from the query
* this will be cached for later retrieval.
*
* @see Usu_Main::query()
* @uses trim()
*
* @access protected
* @return array array of link test
*/
protected function acquireLinkText()
{
$result = Usu_Main::i()->query($this->query);
$text_array = tep_db_fetch_array($result);
tep_db_free_result($result);
if (false === $text_array) {
return false;
}
$final_text_array = array();
foreach ($text_array as $key => $text) {
if (tep_not_null(trim($text))) {
$final_text_array[$key] = $text;
}
}
// We will cache this result
return $final_text_array;
}
示例10: tep_db_query
// # important to keep historical pricing / costs for inventory since this can fluctuate with time.
// # if no cost found in suppliers_products_groups, try the products table for old format
// # costing from suppliers_products_groups table
$cost_price_query = tep_db_query("SELECT suppliers_group_price FROM " . TABLE_SUPPLIERS_PRODUCTS_GROUPS . " WHERE products_id = '" . $orders_products['products_id'] . "' AND priority = '0' LIMIT 1");
$cost_price = tep_db_num_rows($cost_price_query) > 0 ? tep_db_result($cost_price_query, 0) : 0;
tep_db_free_result($cost_price_query);
// # costing from products table
$cost_old_query = tep_db_query("SELECT products_price_myself FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . $orders_products['products_id'] . "'");
$cost_old = tep_db_num_rows($cost_old_query) > 0 ? tep_db_result($cost_old_query, 0) : 0;
tep_db_free_result($cost_old_query);
// # if supplier cost is empty, use old format
$cost = !empty($cost_price) ? $cost_price : $cost_old;
// # Retrieve price from products_groups table.
$pricing_query = tep_db_query("SELECT pg.customers_group_price \n\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS_GROUPS . " pg \n\t\t\t\t\t\t\t\t\t\t LEFT JOIN " . TABLE_CUSTOMERS . " c ON c.customers_group_id = pg.customers_group_id\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN " . TABLE_ORDERS . " o ON o.customers_id = c.customers_id\n\t\t\t\t\t\t\t\t\t\t WHERE o.orders_id = '" . $oID . "'\n\t\t\t\t\t\t\t\t\t\t AND products_id = '" . $orders_products['products_id'] . "'\n\t\t\t\t\t\t\t\t\t\t ");
$price = tep_db_num_rows($pricing_query) > 0 ? tep_db_result($pricing_query, 0) : $orders_products['products_price'];
tep_db_free_result($pricing_query);
// # populate orders_products_data array
$order->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => str_replace("'", "'", $orders_products['products_name']), 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => (double) $price, 'cost' => (double) $cost, 'final_price' => $orders_products['final_price'], 'products_id' => $orders_products['products_id'], 'free_shipping' => $orders_products['free_shipping'], 'separate_shipping' => $orders_products['separate_shipping'], 'products_weight' => $orders_products['products_weight'], 'orders_products_id' => $orders_products['orders_products_id'], 'warehouse_id' => $orders_products['warehouse_id']);
$subindex = 0;
$attributes_query_string = "select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $oID . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'";
$attributes_query = tep_db_query($attributes_query_string);
if (tep_db_num_rows($attributes_query)) {
while ($attributes = tep_db_fetch_array($attributes_query)) {
$order->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
$subindex++;
}
}
$index++;
}
// # END while
?>
示例11: acquireLinkText
/**
* Acquire an array of single or multiple link texts from the query
* this will be cached for later retrieval.
*
* @see Usu_Main::query()
* @uses trim()
*
* @access protected
* @return array array of link test
*/
protected function acquireLinkText()
{
if (false !== ($final_text_array = Usu_Main::i()->getVar('registry')->retrieve($this->key, $this->keys_index[$this->key]))) {
if (Usu_Main::monitorPerformance()) {
Usu_Main::$performance['queries_saved']++;
}
return $final_text_array;
}
$result = Usu_Main::i()->query($this->query);
$text_array = tep_db_fetch_array($result);
tep_db_free_result($result);
if (false === $text_array) {
return false;
}
$final_text_array = array();
foreach ($text_array as $key => $text) {
if (tep_not_null(trim($text))) {
$final_text_array[$key] = $text;
}
}
// We will cache this result
Usu_Main::i()->getVar('registry')->attach($this->key, $this->keys_index[$this->key], $final_text_array);
return $final_text_array;
}
示例12: GenerateSpecialsSitemap
function GenerateSpecialsSitemap($languages_id)
{
global $languages_id;
$products_query = tep_db_query("SELECT p.products_id as pID, s.specials_date_added as date_added, s.specials_last_modified as last_mod, p.products_ordered\n FROM " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id left join " . TABLE_SPECIALS . " s on pd.products_id = s.products_id\n where p.products_status = '1' and s.status = '1' and pd.language_id = " . (int) $languages_id . " order by s.specials_date_added desc ");
if (tep_db_num_rows($products_query) > 0) {
$this->debug['QUERY']['SPECIALS']['STATUS'] = 'success';
$this->debug['QUERY']['SPECIALS']['NUM_ROWS'] = tep_db_num_rows($products_query);
$container = array();
$number = 0;
$top = 0;
while ($result = tep_db_fetch_array($products_query)) {
$top = max($top, $result['products_ordered']);
$location = $this->hrefLink(FILENAME_PRODUCT_INFO, 'products_id=' . $result['pID'], 'NONSSL');
$lastmod = $this->NotNull($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
$changefreq = GOOGLE_SITEMAP_SPECIALS_CHANGE_FREQ;
$ratio = $top > 0 ? $result['products_ordered'] / $top : 0;
$priority = $ratio < 0.1 ? 0.1 : number_format($ratio, 1, '.', '');
$container[] = array('loc' => htmlspecialchars(utf8_encode($location)), 'lastmod' => date("Y-m-d", strtotime($lastmod)), 'changefreq' => $changefreq, 'priority' => $priority);
if (sizeof($container) >= 50000) {
$type = $number == 0 ? 'specials' : 'specials' . $number;
$this->GenerateSitemap($container, $type);
$container = array();
$number++;
}
}
tep_db_free_result($products_query);
if (sizeof($container) > 0) {
$type = $number == 0 ? 'specials' : 'specials' . $number;
return $this->GenerateSitemap($container, $type);
}
} else {
$this->debug['QUERY']['SPECIALS']['STATUS'] = 'false';
$this->debug['QUERY']['SPECIALS']['NUM_ROWS'] = '0';
return $this->GenerateSitemap(array(), 'specials');
}
}
示例13: buildCategoriesCache
/**
* * Building the $categories array
*
* @param $filepath - Full path to cache
* @param $order_by sort setting chosed in oscommerce admin
* @param $languages_id
* @return Returns the fully built $categories array as well as javascript
* Copyright for SuckerTree Vertical Menu 1.1
* @copyright Dynamic Drive: http://www.dynamicdrive.com/style/
*/
function buildCategoriesCache($filepath, $order_by, $languages_id)
{
$result = categoriesFullScan($order_by, $languages_id);
$javamenustring = '';
/**
* Loop through each row
* creating the raw $categories array
*/
while ($row = tep_db_fetch_array($result)) {
$categories[$row['categories_id']] = array('id' => $row['categories_id'], 'parent' => $row['parent_id'], 'sort' => $row['sort_order'], 'path' => '', 'name' => htmlentities($row['categories_name']));
}
tep_db_free_result($result);
// Housekeeping
/**
* Loop through the raw $categories array
* This time we are adding the following:
* $categories[<cat_id>]['children'] which is a comma seperated list of this categories children
* $categories[<cat_id>]['path'] which is the cPath but only for parent categories
* @param $javamenustring a comma seperated string which is later passed to $categories['menuid_string']
*/
foreach ($categories as $cat_id => $key) {
if ($key['parent'] != '0') {
isset($categories[$key['parent']]['children']) && $categories[$key['parent']]['children'] !== NULL ? NULL : ($categories[$key['parent']]['children'] = '');
$categories[$key['parent']]['children'] .= $key['id'] . ',';
} else {
$javamenustring .= '"menu_' . $key['id'] . '",';
$categories[$key['id']]['path'] .= $key['id'];
}
}
// added version 1.1.2
/**
* Loop through the $categories array yet again
* $categories[<cat_id>]['path'] is created for all categories EXCEPT parent categories
* Calls on function setCpath to generate muli layer cPaths
*
*/
foreach ($categories as $cat_id => $key) {
$fullcatpath = '';
if ($key['parent'] != '0') {
$fullcatpath = setCpath($categories, $key['id']);
$categories[$key['id']]['path'] = $fullcatpath;
}
}
$javamenustring = rtrim($javamenustring, ',');
$categories['menuid_string'] = $javamenustring;
$categories['menuid_js'] = <<<JSSCRIPT
<script language="javascript" type="text/javascript">
function get_menu_ids() {
var menuids=[{$javamenustring}] //Enter id(s) of SuckerTree UL menus, separated by commas
return menuids;
}
</script>
<script src="includes/javascript/suckertree.js" type="text/javascript"></script>
JSSCRIPT;
// Serialize and save the $categories array
$serialized = serialize($categories);
if (defined('FWR_MENU_RESET') && FWR_MENU_RESET == 'true' || defined('FWR_SUCKERTREE_MENU_ON') && 'true' === FWR_SUCKERTREE_MENU_ON && !file_exists($filepath . $languages_id . "_categories.ser")) {
/**
* We are deleting the old cache files so we will delete all files
* on the relevant directory path with a .ser filename
*/
foreach (glob($filepath . "*.ser") as $filename) {
unlink($filename);
}
// Write the new cache
saveSerializedFile($filepath, $serialized, $languages_id, "_categories.ser");
// FWR DOM XML - uncomment the line below to activate
//if( class_exists('DOMDocument') ) sitemapXML($filepath, $categories);
$sql = "\r\nUPDATE " . TABLE_CONFIGURATION . "\r\nSET `configuration_value` = 'false'\r\nWHERE `configuration_key` = 'FWR_MENU_RESET'";
//Reset the FWR Menu reset back to false
tep_db_query($sql) or die('Update failed ' . mysql_error());
}
return $categories;
}
示例14: sk_set_language
function sk_set_language()
{
global $languages_id, $language_code;
$language_query = tep_db_query('select languages_id, code from ' . TABLE_LANGUAGES);
if (tep_db_num_rows($language_query) == 1 && ($language_row = tep_db_fetch_array($language_query))) {
// Wenn nur eine Sprache definiert ist, benutzen wir diese.
$languages_id = $language_row['languages_id'];
$language_code = $language_row['code'];
} else {
if (!defined('PROD_DEFAULT_LANGUAGE_ID')) {
trigger_error('Bitte setzen Sie in der Datei elmar_config.inc.php die Konstante PROD_DEFAULT_LANGUAGE_ID auf die in Ihrem Shop verwendete Sprach-ID.', E_USER_ERROR);
} else {
if (!defined('PROD_DEFAULT_LANGUAGE')) {
trigger_error('Bitte setzen Sie in der Datei elmar_config.inc.php die Konstante PROD_DEFAULT_LANGUAGE auf den in Ihrem Shop verwendeten Sprachcode.', E_USER_ERROR);
} else {
$languages_id = PROD_DEFAULT_LANGUAGE_ID;
$language_code = PROD_DEFAULT_LANGUAGE;
}
}
}
tep_db_free_result($language_query);
}
示例15: _get_attribute_values_list
function _get_attribute_values_list($products_id)
{
$res = tep_db_query("SELECT po.products_options_name, pov.products_options_values_name\n FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n INNER JOIN " . TABLE_PRODUCTS_OPTIONS . " po\n ON (pa.options_id = po.products_options_id\n AND po.language_id = {$GLOBALS['languages_id']})\n INNER JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov\n ON (pa.options_values_id = pov.products_options_values_id\n AND pov.language_id = {$GLOBALS['languages_id']})\n WHERE pa.products_id = {$products_id} ");
$values = array();
while ($row = tep_db_fetch_array($res)) {
$values[$row['products_options_name']][] = $row['products_options_values_name'];
}
reset($values);
while (list($id, $value) = each($values)) {
$result[$id] = implode(",", array_unique($value));
}
tep_db_free_result($res);
return $result;
}