当前位置: 首页>>代码示例>>PHP>>正文


PHP db_get_hash_multi_array函数代码示例

本文整理汇总了PHP中db_get_hash_multi_array函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_hash_multi_array函数的具体用法?PHP db_get_hash_multi_array怎么用?PHP db_get_hash_multi_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_get_hash_multi_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fn_get_ebay_shippings

function fn_get_ebay_shippings($site_id, $service_type, $international = false)
{
    $condition = db_quote('site_id = ?i AND FIND_IN_SET(?s, service_type)', $site_id, $service_type);
    $condition .= db_quote(' AND is_international = ?s', $international == true ? 'Y' : 'N');
    $shippings = db_get_hash_multi_array("SELECT * FROM ?:ebay_shippings WHERE {$condition} ORDER BY name ASC", array('category', 'service_id'));
    return $shippings;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:7,代码来源:func.php

示例2: fn_get_all_states

function fn_get_all_states($lang_code = CART_LANGUAGE, $extended = false, $avail_only = true)
{
    $avail_cond = $avail_only == true ? " WHERE a.status = 'A' " : '';
    if ($extended == true) {
        return db_get_array("SELECT a.state_id, a.code, b.state, c.country FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s LEFT JOIN ?:country_descriptions as c ON c.code = a.country_code AND c.lang_code = ?s {$avail_cond} ORDER BY a.country_code, b.state", $lang_code, $lang_code);
    } else {
        return db_get_hash_multi_array("SELECT a.country_code, a.code, b.state FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s {$avail_cond} ORDER BY a.country_code, b.state", array('country_code'), $lang_code);
    }
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:9,代码来源:fn.locations.php

示例3: fn_get_all_cities

function fn_get_all_cities($avail_only = true, $lang_code = CART_LANGUAGE)
{
    $avail_cond = $avail_only == true ? " WHERE a.status = 'A' AND b.status = 'A'" : '';
    //return db_get_hash_multi_array("SELECT a.country_code, a.code, b.state FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s $avail_cond ORDER BY a.country_code, b.state", array('country_code'), $lang_code);
    $countries = db_get_hash_multi_array("SELECT a.country_code, a.code as state_id, b.code, c.city, b.city_id FROM ?:states as a " . "LEFT JOIN ?:rus_cities as b ON b.state_id = a.state_id " . "LEFT JOIN ?:rus_city_descriptions as c ON c.city_id = b.city_id AND c.lang_code = ?s " . "{$avail_cond} ORDER BY a.country_code, b.code, c.city", array('country_code'), $lang_code);
    $rus_countries = db_get_hash_array("SELECT city_id, city FROM ?:rus_city_descriptions WHERE lang_code = ?s", 'city_id', 'ru');
    $cities = array();
    foreach ($countries as $c_code => $states) {
        foreach ($states as $city) {
            if (!empty($city['city_id'])) {
                $cities[$c_code][$city['state_id']][] = array('code' => $city['code'], 'city' => empty($city['city']) ? $rus_countries[$city['city_id']]['city'] : $city['city']);
            }
        }
    }
    return $cities;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:16,代码来源:func.php

示例4: getList

 /**
  * Gets list of grids
  * @static
  * @param  array $params input params
  * @return array Array of grids as container_id => array(grid_id => block data)
  */
 public static function getList($params = array())
 {
     /**
      * Prepares params for SQL query before getting grids
      * @param array $params input params
      * @param string $lang_code 2 letter language code
      */
     fn_set_hook('get_grids_pre', $params);
     $condition = $join = '';
     $fields = array('*');
     if (!empty($params['container_ids'])) {
         $condition .= db_quote(" AND g.container_id IN (?n)", $params['container_ids']);
     }
     if (!empty($params['simple'])) {
         $fields = array('g.grid_id', 'g.container_id');
     }
     $grids = db_get_hash_multi_array("SELECT " . implode(', ', $fields) . " FROM ?:bm_containers as c " . "LEFT JOIN ?:bm_grids as g ON g.container_id = c.container_id ?p" . "WHERE 1 ?p ORDER BY g.order, g.parent_id, g.grid_id ASC", array('container_id', 'grid_id'), $join, $condition);
     /**
      * Processes grids list after getting it
      * @param array $grids Array of grids data
      */
     fn_set_hook('get_grids_post', $grids);
     return $grids;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:30,代码来源:Grid.php

示例5: copyById

 /**
  * Copies all layout data from one layout to another by their IDs.
  *
  * @param integer $source_layout_id Source layout ID
  * @param integer $target_layout_id Target layout ID
  *
  * @return boolean True on success, false - otherwise
  */
 public function copyById($source_layout_id, $target_layout_id)
 {
     $source_layout = $this->get($source_layout_id);
     if (empty($source_layout)) {
         return false;
     }
     // Copy locations, their containers, grids and blocks to the target layout
     Location::instance($source_layout_id)->copy($target_layout_id);
     $source_layout_company_id = 0;
     $target_layout_company_id = 0;
     if (fn_allowed_for('ULTIMATE')) {
         $source_layout_company_id = $source_layout['company_id'];
         $target_layout_company_id = db_get_field("SELECT company_id FROM ?:bm_layouts WHERE layout_id = ?i", $target_layout_id);
     }
     // Copy logos
     /**
      * Get the list of logos, bounded to source layout and given company.
      * List has the following format:
      *
      * [
      *   logo_type => [
      *      style_id => logo_id,
      *      ...
      *   ],
      *   ...
      * ]
      */
     $source_layout_logos = db_get_hash_multi_array('SELECT `type`, `style_id`, `logo_id` FROM ?:logos WHERE `layout_id` = ?i AND `company_id` = ?i', array('type', 'style_id', 'logo_id'), $source_layout_id, $source_layout_company_id);
     $logo_types = fn_get_logo_types();
     foreach ($logo_types as $logo_type => $logo_type_metadata) {
         if (empty($logo_type_metadata['for_layout']) || empty($source_layout_logos[$logo_type])) {
             continue;
         }
         foreach ($source_layout_logos[$logo_type] as $source_layout_style_id => $source_layout_logo_id) {
             $created_target_layout_logo_id = fn_update_logo(array('type' => $logo_type, 'layout_id' => $target_layout_id, 'style_id' => $source_layout_style_id), $target_layout_company_id);
             fn_clone_image_pairs($created_target_layout_logo_id, $source_layout_logo_id, 'logos');
         }
     }
     return true;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:48,代码来源:Layout.php

示例6: array

        }
        $_suffix = ".manage";
    }
    if ($mode == 'run') {
        return array(CONTROLLER_STATUS_REDIRECT, "exim.sync_vendors");
    }
    return array(CONTROLLER_STATUS_OK, "settings{$_suffix}?section_id={$section_id}");
}
//
// OUPUT routines
//
if ($mode == 'manage') {
    $descr = fn_settings_descr_query('subsection_id', 'U', CART_LANGUAGE, 'settings_subsections', 'object_string_id');
    $subsections = db_get_hash_array("SELECT ?:settings_subsections.*, ?:settings_descriptions.description, ?:settings_descriptions.object_string_id, ?:settings_descriptions.object_type FROM ?:settings_subsections ?p WHERE ?:settings_subsections.section_id = ?s ORDER BY  ?:settings_descriptions.description", 'subsection_id', $descr, $section_id);
    $descr = fn_settings_descr_query('option_id', 'O', CART_LANGUAGE, 'settings');
    $options = db_get_hash_multi_array("SELECT ?:settings.*, IF(?:settings.subsection_id = '', 'main', ?:settings.subsection_id) as subsection_id, ?:settings_descriptions.description, ?:settings_descriptions.tooltip, ?:settings_descriptions.object_type FROM ?:settings ?p WHERE ?:settings.section_id = ?s ORDER BY ?:settings_descriptions.description", array('subsection_id'), $descr, $section_id);
    $descr = fn_settings_descr_query('variant_id', 'V', CART_LANGUAGE, 'settings_variants');
    fn_get_schema('settings', 'variants', 'php', false, true);
    foreach ($options as $sid => $sct) {
        $ssid = $sid == 'main' ? '' : $sid;
        $elements = db_get_array("SELECT ?:settings_elements.*, ?:settings_descriptions.description FROM ?:settings_elements LEFT JOIN ?:settings_descriptions ON ?:settings_elements.element_id = ?:settings_descriptions.object_id AND ?:settings_descriptions.object_type = 'H' AND ?:settings_descriptions.lang_code = ?s WHERE ?:settings_elements.section_id = ?s AND ?:settings_elements.subsection_id = ?s ORDER BY ?:settings_elements.position", CART_LANGUAGE, $section_id, $ssid);
        foreach ($elements as $k => $v) {
            if (!empty($v['handler']) && $v['element_type'] == 'I') {
                $args = explode(',', $v['handler']);
                $func = array_shift($args);
                if (function_exists($func)) {
                    $elements[$k]['info'] = call_user_func_array($func, $args);
                } else {
                    $elements[$k]['info'] = "No function: {$func}";
                }
            }
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:settings.php

示例7: fn_get_product_prices

/**
 * Gets product prices.
 *
 * @param int $product_id Product identifier
 * @param array $product_data Array of product data. Result data will be saved in this variable.
 * @param array $auth Array of user authentication data (e.g. uid, usergroup_ids, etc.)
 * @param int $company_id Company identifier.
 */
function fn_get_product_prices($product_id, &$product_data, $auth, $company_id = 0)
{
    if (fn_allowed_for('ULTIMATE') && $company_id) {
        $table_name = '?:ult_product_prices';
        $condition = db_quote(' AND prices.company_id = ?i', $company_id);
    } else {
        $table_name = '?:product_prices';
        $condition = '';
    }
    // For customer
    if (AREA == 'C') {
        $_prices = db_get_hash_multi_array("SELECT prices.product_id, prices.lower_limit, usergroup_id, prices.percentage_discount, IF(prices.percentage_discount = 0, prices.price, prices.price - (prices.price * prices.percentage_discount)/100) as price FROM {$table_name} prices WHERE prices.product_id = ?i {$condition} AND lower_limit > 1 AND prices.usergroup_id IN (?n) ORDER BY lower_limit", array('usergroup_id'), $product_id, array_merge(array(USERGROUP_ALL), $auth['usergroup_ids']));
        if (!fn_allowed_for('ULTIMATE:FREE')) {
            // If customer has usergroup and prices defined for this usergroup, get them
            if (!empty($auth['usergroup_ids'])) {
                foreach ($auth['usergroup_ids'] as $ug_id) {
                    if (!empty($_prices[$ug_id]) && sizeof($_prices[$ug_id]) > 0) {
                        if (empty($product_data['prices'])) {
                            $product_data['prices'] = $_prices[$ug_id];
                        } else {
                            foreach ($_prices[$ug_id] as $comp_data) {
                                $add_elm = true;
                                foreach ($product_data['prices'] as $price_id => $price_data) {
                                    if ($price_data['lower_limit'] == $comp_data['lower_limit']) {
                                        $add_elm = false;
                                        if ($price_data['price'] > $comp_data['price']) {
                                            $product_data['prices'][$price_id] = $comp_data;
                                        }
                                        break;
                                    }
                                }
                                if ($add_elm) {
                                    $product_data['prices'][] = $comp_data;
                                }
                            }
                        }
                    }
                }
                if (!empty($product_data['prices'])) {
                    $tmp = array();
                    foreach ($product_data['prices'] as $price_id => $price_data) {
                        $tmp[$price_id] = $price_data['lower_limit'];
                    }
                    array_multisort($tmp, SORT_ASC, $product_data['prices']);
                }
            }
        }
        // else, get prices for not members
        if (empty($product_data['prices']) && !empty($_prices[0]) && sizeof($_prices[0]) > 0) {
            $product_data['prices'] = $_prices[0];
        }
        // Other - get all
    } else {
        $product_data['prices'] = db_get_array("SELECT prices.product_id, prices.lower_limit, usergroup_id, prices.percentage_discount, IF(prices.percentage_discount = 0, prices.price, prices.price - (prices.price * prices.percentage_discount)/100) as price FROM {$table_name} prices WHERE product_id = ?i {$condition} ORDER BY usergroup_id, lower_limit", $product_id);
    }
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:64,代码来源:fn.catalog.php

示例8: fn_promotions_check_features

/**
 * Check if product has certain features
 *
 * @param array $promotion promotion data
 * @param array $product product data
 * @return mixed feature value if found, boolean false otherwise
 */
function fn_promotions_check_features($promotion, $product)
{
    $features = db_get_hash_multi_array("SELECT feature_id, variant_id, value, value_int FROM ?:product_features_values WHERE product_id = ?i AND lang_code = ?s", array('feature_id'), $product['product_id'], CART_LANGUAGE);
    if (!empty($features) && !empty($promotion['condition_element']) && !empty($features[$promotion['condition_element']])) {
        $f = $features[$promotion['condition_element']];
        $result = array();
        foreach ($f as $v) {
            $result[] = !empty($v['variant_id']) ? $v['variant_id'] : ($v['value_int'] != '' ? $v['value_int'] : $v['value']);
        }
        return $result;
    }
    return false;
}
开发者ID:askzap,项目名称:ultimate,代码行数:20,代码来源:fn.promotions.php

示例9: fn_get_image_pairs

/**
 * Gets image pairs (icon, detailed)
 *
 * @param array/int $object_ids List of Object IDs or Object ID
 * @param string $object_type Type: product, category, banner, etc.
 * @param string $pair_type (M)ain or (A)dditional
 * @param bool $get_icon
 * @param bool $get_detailed
 * @param string $lang_code 2-letters code
 * @return array Pair data
 */
function fn_get_image_pairs($object_ids, $object_type, $pair_type, $get_icon = true, $get_detailed = true, $lang_code = CART_LANGUAGE)
{
    /**
     * Changes input params for fn_get_image_pairs function
     *
     * @param  array/int $object_ids   List of Object IDs or Object ID
     * @param  string    $object_type  Type: product, category, banner, etc.
     * @param  string    $pair_type    (M)ain or (A)dditional
     * @param  bool      $get_icon
     * @param  bool      $get_detailed
     * @param  string    $lang_code    2-letters code
     * @return array     Pair data
     */
    fn_set_hook('get_image_pairs_pre', $object_ids, $object_type, $pair_type, $get_icon, $get_detailed, $lang_code);
    $icon_pairs = $detailed_pairs = $pairs_data = array();
    $cond = is_array($object_ids) ? db_quote("AND ?:images_links.object_id IN (?n)", $object_ids) : db_quote("AND ?:images_links.object_id = ?i", $object_ids);
    if ($get_icon == true || $get_detailed == true) {
        if ($get_icon == true) {
            $join_cond = "?:images_links.image_id = ?:images.image_id";
            $icon_pairs = db_get_array("SELECT ?:images_links.*, ?:images.image_path, ?:common_descriptions.description AS alt, ?:images.image_x, ?:images.image_y, ?:images.image_id as images_image_id" . " FROM ?:images_links" . " LEFT JOIN ?:images ON {$join_cond}" . " LEFT JOIN ?:common_descriptions ON ?:common_descriptions.object_id = ?:images.image_id AND ?:common_descriptions.object_holder = 'images' AND ?:common_descriptions.lang_code = ?s" . " WHERE ?:images_links.object_type = ?s AND ?:images_links.type = ?s {$cond}" . " ORDER BY ?:images_links.position, ?:images_links.pair_id", $lang_code, $object_type, $pair_type);
        }
        if ($get_detailed == true) {
            $join_cond = db_quote("?:images_links.detailed_id = ?:images.image_id");
            $detailed_pairs = db_get_array("SELECT ?:images_links.*, ?:images.image_path, ?:common_descriptions.description AS alt, ?:images.image_x, ?:images.image_y, ?:images.image_id as images_image_id" . " FROM ?:images_links" . " LEFT JOIN ?:images ON {$join_cond}" . " LEFT JOIN ?:common_descriptions ON ?:common_descriptions.object_id = ?:images.image_id AND ?:common_descriptions.object_holder = 'images' AND ?:common_descriptions.lang_code = ?s" . " WHERE ?:images_links.object_type = ?s AND ?:images_links.type = ?s {$cond}" . " ORDER BY ?:images_links.position, ?:images_links.pair_id", $lang_code, $object_type, $pair_type);
        }
        foreach ((array) $object_ids as $object_id) {
            $pairs_data[$object_id] = array();
        }
        // Convert the received data to the standard format in order to keep the backward compatibility
        foreach ($icon_pairs as $pair) {
            $_pair = array('pair_id' => $pair['pair_id'], 'image_id' => $pair['image_id'], 'detailed_id' => $pair['detailed_id'], 'position' => $pair['position']);
            if (!empty($pair['images_image_id'])) {
                //get icon data if exist
                $icon = fn_attach_absolute_image_paths($pair, $object_type);
                $_pair['icon'] = array('image_path' => $icon['image_path'], 'alt' => $icon['alt'], 'image_x' => $icon['image_x'], 'image_y' => $icon['image_y'], 'http_image_path' => $icon['http_image_path'], 'https_image_path' => $icon['https_image_path'], 'absolute_path' => $icon['absolute_path'], 'relative_path' => $icon['relative_path']);
            }
            $pairs_data[$pair['object_id']][$pair['pair_id']] = $_pair;
        }
        // -foreach icon_pairs
        foreach ($detailed_pairs as $pair) {
            $pair_id = $pair['pair_id'];
            $object_id = $pair['object_id'];
            if (!empty($pairs_data[$object_id][$pair_id]['detailed_id'])) {
                $detailed = fn_attach_absolute_image_paths($pair, 'detailed');
                $pairs_data[$object_id][$pair_id]['detailed'] = array('image_path' => $detailed['image_path'], 'alt' => $detailed['alt'], 'image_x' => $detailed['image_x'], 'image_y' => $detailed['image_y'], 'http_image_path' => $detailed['http_image_path'], 'https_image_path' => $detailed['https_image_path'], 'absolute_path' => $detailed['absolute_path'], 'relative_path' => $detailed['relative_path']);
            } elseif (empty($pairs_data[$object_id][$pair_id]['pair_id'])) {
                $pairs_data[$object_id][$pair_id] = array('pair_id' => $pair['pair_id'], 'image_id' => $pair['image_id'], 'detailed_id' => $pair['detailed_id'], 'position' => $pair['position']);
                if (!empty($pair['images_image_id'])) {
                    //get detailed data if exist
                    $detailed = fn_attach_absolute_image_paths($pair, 'detailed');
                    $pairs_data[$object_id][$pair_id]['detailed'] = array('image_path' => $detailed['image_path'], 'alt' => $detailed['alt'], 'image_x' => $detailed['image_x'], 'image_y' => $detailed['image_y'], 'http_image_path' => $detailed['http_image_path'], 'https_image_path' => $detailed['https_image_path'], 'absolute_path' => $detailed['absolute_path'], 'relative_path' => $detailed['relative_path']);
                }
            }
        }
        // -foreach detailed_pairs
    } else {
        $pairs_data = db_get_hash_multi_array("SELECT pair_id, image_id, detailed_id, object_id FROM ?:images_links WHERE object_type = ?s AND type = ?s {$cond}", array('object_id', 'pair_id'), $object_type, $pair_type);
    }
    /**
     * Changes pair data informatin
     *
     * @param array/int $object_ids   List of Object IDs or Object ID
     * @param string    $object_type  Type: product, category, banner, etc.
     * @param string    $pair_type    (M)ain or (A)dditional
     * @param bool      $get_icon
     * @param bool      $get_detailed
     * @param string    $lang_code    2-letters code
     * @param array     $pairs_data   Pairs data
     */
    fn_set_hook('get_image_pairs_post', $object_ids, $object_type, $pair_type, $get_icon, $get_detailed, $lang_code, $pairs_data);
    if (is_array($object_ids)) {
        return $pairs_data;
    } else {
        if ($pair_type == 'A') {
            return $pairs_data[$object_ids];
        } else {
            return !empty($pairs_data[$object_ids]) ? reset($pairs_data[$object_ids]) : array();
        }
    }
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:91,代码来源:fn.images.php

示例10: fn_get_statuses

/**
 * Gets full information about particular statuses
 * @param string $type One letter status type
 * @param array $status_to_select Array of statuses that should be retrieved. If empty, all statuses will be retrieved
 * @param boolean $additional_statuses Flag that determines whether additional (hidden) statuses should be retrieved
 * @param boolean $exclude_parent Flag that determines whether parent statuses should be excluded
 * @param string $lang_code Language code
 * @param int $company_id Company identifier
 * @return Statuses
 */
function fn_get_statuses($type = STATUSES_ORDER, $status_to_select = array(), $additional_statuses = false, $exclude_parent = false, $lang_code = DESCR_SL, $company_id = 0)
{
    fn_set_hook('get_statuses_pre', $type, $status_to_select, $additional_statuses, $exclude_parent, $lang_code, $company_id);
    $join = db_quote(" LEFT JOIN ?:status_descriptions ON ?:status_descriptions.status = ?:statuses.status AND ?:status_descriptions.type = ?:statuses.type AND ?:status_descriptions.lang_code = ?s", $lang_code);
    $condition = db_quote(" AND ?:statuses.type = ?s", $type);
    $condition .= !empty($status_to_select) ? db_quote(" AND ?:statuses.status IN (?a)", $status_to_select) : '';
    fn_set_hook('get_statuses', $join, $condition, $type, $status_to_select, $additional_statuses, $exclude_parent, $lang_code, $company_id);
    $statuses = db_get_hash_array("SELECT ?:statuses.*, ?:status_descriptions.*" . " FROM ?:statuses" . $join . " WHERE 1 {$condition}", 'status');
    $statuses_params = db_get_hash_multi_array("SELECT param, value, status FROM ?:status_data WHERE type = ?s", array('status', 'param'), $type);
    foreach ($statuses as $status => $status_data) {
        $statuses[$status]['params'] = array();
        if (isset($statuses_params[$status])) {
            foreach ($statuses_params[$status] as $param_name => $param_data) {
                $statuses[$status]['params'][$param_name] = $param_data['value'];
            }
        }
    }
    if ($type == STATUSES_ORDER && $additional_statuses && empty($status_to_select)) {
        $statuses[STATUS_INCOMPLETED_ORDER] = array('status' => STATUS_INCOMPLETED_ORDER, 'description' => __('incompleted', '', $lang_code), 'type' => STATUSES_ORDER, 'params' => array('inventory' => 'I'));
        if (empty($exclude_parent)) {
            $statuses[STATUS_PARENT_ORDER] = array('status' => STATUS_PARENT_ORDER, 'description' => __('parent_order', '', $lang_code), 'type' => STATUSES_ORDER, 'params' => array('inventory' => 'I'));
        }
    }
    fn_set_hook('get_statuses_post', $statuses, $join, $condition, $type, $status_to_select, $additional_statuses, $exclude_parent, $lang_code, $company_id);
    return $statuses;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:36,代码来源:fn.common.php

示例11: fn_twg_api_get_product_options

function fn_twg_api_get_product_options($product, $lang_code = CART_LANGUAGE)
{
    $condition = $_status = $join = '';
    $extra_variant_fields = '';
    $option_ids = $variants_ids = $options = array();
    $_status .= " AND status = 'A'";
    $product_ids = $product['product_id'];
    $join = db_quote(" LEFT JOIN ?:product_options_descriptions as b\n         ON a.option_id = b.option_id AND b.lang_code = ?s ", $lang_code);
    $fields = "a.*, b.option_name, b.option_text, b.description, b.inner_hint, b.incorrect_message, b.comment";
    if (!empty($product_ids)) {
        $_options = db_get_hash_multi_array("SELECT " . $fields . " FROM ?:product_options as a " . $join . " WHERE a.product_id IN (?n)" . $condition . $_status . " ORDER BY a.position", array('product_id', 'option_id'), $product_ids);
        $fields = "c.product_id AS cur_product_id, a.*, " . "b.option_name, b.option_text, b.description, b.inner_hint, " . "b.incorrect_message, b.comment";
        $global_options = db_get_hash_multi_array("SELECT {$fields}" . " FROM ?:product_options as a" . " LEFT JOIN ?:product_options_descriptions as b ON a.option_id = b.option_id AND b.lang_code = ?s" . " LEFT JOIN ?:product_global_option_links as c ON c.option_id = a.option_id" . " WHERE c.product_id IN (?n) AND a.product_id = 0" . $condition . $_status . " ORDER BY a.position", array('cur_product_id', 'option_id'), $lang_code, $product_ids);
        foreach ((array) $product_ids as $product_id) {
            $_opts = (empty($_options[$product_id]) ? array() : $_options[$product_id]) + (empty($global_options[$product_id]) ? array() : $global_options[$product_id]);
            $options[$product_id] = fn_sort_array_by_key($_opts, 'position');
        }
    } else {
        //we need a separate query for global options
        $options = db_get_hash_multi_array("SELECT a.*, b.option_name, b.option_text, b.description, b.inner_hint, b.incorrect_message, b.comment" . " FROM ?:product_options as a" . $join . " WHERE a.product_id = 0" . $condition . $_status . " ORDER BY a.position", array('product_id', 'option_id'));
    }
    foreach ($options as $product_id => $_options) {
        $option_ids = array_merge($option_ids, array_keys($_options));
    }
    if (empty($option_ids)) {
        if (is_array($product_ids)) {
            return $options;
        } else {
            return !empty($options[$product_ids]) ? $options[$product_ids] : array();
        }
    }
    $_status = " AND a.status='A'";
    $v_fields = "a.variant_id, a.option_id, a.position, a.modifier, " . "a.modifier_type, a.weight_modifier, a.weight_modifier_type, " . "{$extra_variant_fields} b.variant_name";
    $v_join = db_quote("LEFT JOIN ?:product_option_variants_descriptions as b\n         ON a.variant_id = b.variant_id\n         AND b.lang_code = ?s", $lang_code);
    $v_condition = db_quote("a.option_id IN (?n) {$_status}", array_unique($option_ids));
    $v_sorting = "a.position, a.variant_id";
    $variants = db_get_hash_multi_array("SELECT {$v_fields} FROM ?:product_option_variants as a {$v_join} WHERE {$v_condition} ORDER BY {$v_sorting}", array('option_id', 'variant_id'));
    foreach ($variants as $option_id => $_variants) {
        $variants_ids = array_merge($variants_ids, array_keys($_variants));
    }
    if (isset($variants_ids) && empty($variants_ids)) {
        return is_array($product_ids) ? $options : $options[$product_ids];
    }
    $image_pairs = fn_get_image_pairs(array_unique($variants_ids), 'variant_image', 'V', true, true, $lang_code);
    foreach ($variants as $option_id => &$_variants) {
        foreach ($_variants as $variant_id => &$_variant) {
            $_variant['image_pair'] = !empty($image_pairs[$variant_id]) ? reset($image_pairs[$variant_id]) : array();
        }
    }
    foreach ($options as $product_id => &$_options) {
        foreach ($_options as $option_id => &$_option) {
            // Add variant names manually, if this option is "checkbox"
            if ($_option['option_type'] == 'C' && !empty($variants[$option_id])) {
                foreach ($variants[$option_id] as $variant_id => $variant) {
                    $variants[$option_id][$variant_id]['variant_name'] = $variant['position'] == 0 ? __('no') : __('yes');
                }
            }
            $_option['variants'] = !empty($variants[$option_id]) ? $variants[$option_id] : array();
        }
    }
    return is_array($product_ids) ? $options : $options[$product_ids];
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:62,代码来源:func.php

示例12: fn_exim_get_extra_fields

function fn_exim_get_extra_fields($user_id, $lang_code = CART_LANGUAGE)
{
    $fields = array();
    $_user = db_get_hash_single_array("SELECT d.description, f.value FROM ?:profile_fields_data as f LEFT JOIN ?:profile_field_descriptions as d ON d.object_id = f.field_id AND d.object_type = 'F' AND d.lang_code = ?s WHERE f.object_id = ?i AND f.object_type = 'U'", array('description', 'value'), $lang_code, $user_id);
    $_profile = db_get_hash_multi_array("SELECT p.profile_id, d.description, f.value, c.section, c.field_id FROM ?:profile_fields_data as f LEFT JOIN ?:profile_field_descriptions as d ON d.object_id = f.field_id AND d.object_type = 'F' AND d.lang_code = ?s LEFT JOIN ?:user_profiles as p ON f.object_id = p.profile_id AND f.object_type = 'P' LEFT JOIN ?:profile_fields as c ON f.field_id = c.field_id WHERE p.user_id = ?i", array('field_id', 'section'), $lang_code, $user_id);
    if (!empty($_user)) {
        $fields['user'] = $_user;
    }
    if (!empty($_profile)) {
        $fields['profile'] = $_profile;
    }
    if (!empty($fields)) {
        return fn_exim_json_encode($fields);
    }
    return '';
}
开发者ID:askzap,项目名称:ultimate,代码行数:16,代码来源:users.functions.php

示例13: fn_banners_install

function fn_banners_install()
{
    $banners = db_get_hash_multi_array("SELECT ?:banners.banner_id, ?:banner_images.banner_image_id, ?:banner_images.lang_code FROM ?:banners LEFT JOIN ?:banner_images ON ?:banner_images.banner_id = ?:banners.banner_id", array('lang_code', 'banner_id'));
    $langs = array_keys(Languages::getAll());
    $need_clone_langs = array_diff($langs, array_keys($banners));
    if (!empty($need_clone_langs)) {
        $clone_lang = DEFAULT_LANGUAGE;
        if (in_array(DEFAULT_LANGUAGE, $need_clone_langs)) {
            $clone_lang = 'en';
        }
        foreach ($banners[$clone_lang] as $banner_id => &$banner) {
            $banner['main_pair'] = fn_get_image_pairs($banner['banner_image_id'], 'promo', 'M', true, false, $clone_lang);
        }
        foreach ($need_clone_langs as $need_clone_lang) {
            fn_banners_clone($banners[$clone_lang], $need_clone_lang);
        }
    }
    foreach ($banners['en'] as $banner_id => &$banner) {
        $banner['main_pair'] = fn_get_image_pairs($banner['banner_image_id'], 'promo', 'M', true, false, 'en');
    }
    if (!in_array('en', $langs)) {
        $banner_images_ids = db_get_fields("SELECT banner_image_id FROM ?:banner_images WHERE lang_code = ?s", 'en');
        foreach ($banner_images_ids as $banner_image_id) {
            fn_delete_image_pairs($banner_image_id, 'promo');
        }
        if (!empty($banner_images_ids)) {
            db_query("DELETE FROM ?:banner_images WHERE banner_image_id IN (?n)", $banner_images_ids);
        }
    }
    return true;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:func.php

示例14: fn_get_ebay_shippings

function fn_get_ebay_shippings($service_type, $international = false)
{
    $site_id = Ebay::instance()->site_id;
    $condition = db_quote('site_id = ?i AND FIND_IN_SET(?s, service_type)', $site_id, $service_type);
    $condition .= db_quote(' AND is_international = ?s', $international == true ? 'Y' : 'N');
    $shippings = db_get_hash_multi_array("SELECT * FROM ?:ebay_shippings WHERE {$condition} ORDER BY name ASC", array('category', 'service_id'));
    if (empty($shippings)) {
        fn_set_notification('W', __('warning'), __('wait_for_shippings_cached'));
        register_shutdown_function('fn_register_ebay_shippings', $site_id);
    }
    return $shippings;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:12,代码来源:func.php

示例15: fn_delete_usergroups

 //
 // Delete selected usergroups
 //
 if ($mode == 'm_delete') {
     if (!empty($_REQUEST['usergroup_ids'])) {
         fn_delete_usergroups($_REQUEST['usergroup_ids']);
     }
     $suffix .= '.manage';
 }
 if ($mode == 'bulk_update_status') {
     if (!empty($_REQUEST['link_ids'])) {
         $new_status = $action == 'approve' ? 'A' : 'D';
         db_query("UPDATE ?:usergroup_links SET status = ?s WHERE link_id IN(?n)", $new_status, $_REQUEST['link_ids']);
         $force_notification = fn_get_notification_rules($_REQUEST);
         if (!empty($force_notification['C'])) {
             $usergroup_links = db_get_hash_multi_array("SELECT * FROM ?:usergroup_links WHERE link_id IN(?n)", array('user_id', 'usergroup_id'), $_REQUEST['link_ids']);
             foreach ($usergroup_links as $u_id => $val) {
                 fn_send_usergroup_status_notification($u_id, array_keys($val), $new_status);
             }
         }
     }
     $suffix = ".requests";
 }
 if ($mode == 'delete') {
     if (!empty($_REQUEST['usergroup_id'])) {
         fn_delete_usergroups((array) $_REQUEST['usergroup_id']);
     }
     return array(CONTROLLER_STATUS_REDIRECT, 'usergroups.manage');
 }
 if ($mode == 'update_status') {
     $user_data = fn_get_user_info($_REQUEST['user_id']);
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:usergroups.php


注:本文中的db_get_hash_multi_array函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。