• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fn_get_product_features函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: index

 public function index($id = 0, $params = array())
 {
     $lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
     if ($this->getParentName() == 'products') {
         $parent_product = $this->getParentData();
         $params['product_id'] = $parent_product['product_id'];
         $params['existent_only'] = $this->safeGet($params, 'existent_only', true);
         $params['exclude_group'] = $this->safeGet($params, 'exclude_group', true);
         $params['variants'] = $this->safeGet($params, 'variants', true);
     }
     if (!empty($id)) {
         $params['variants'] = $this->safeGet($params, 'variants', true);
         $data = fn_get_product_feature_data($id, $params['variants'], false, $lang_code);
         if (empty($data)) {
             $status = Response::STATUS_NOT_FOUND;
         } else {
             $status = Response::STATUS_OK;
         }
     } else {
         $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page'));
         $params['exclude_group'] = $this->safeGet($params, 'exclude_group', false);
         $params['get_descriptions'] = $this->safeGet($params, 'get_descriptions', true);
         $params['plain'] = $this->safeGet($params, 'plain', true);
         $params['variants'] = $this->safeGet($params, 'variants', false);
         list($features, $params) = fn_get_product_features($params, $items_per_page, $lang_code);
         $data = array('features' => array_values($features), 'params' => $params);
         $status = Response::STATUS_OK;
     }
     return array('status' => $status, 'data' => $data);
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:30,代码来源:Features.php


示例2: fn_import_feature_variant

function fn_import_feature_variant($data, $options, &$processed_data, &$skip_record)
{
    static $features;
    $skip_record = true;
    $variant = reset($data);
    if (empty($variant['Feature name'])) {
        return false;
    }
    $langs = array_keys($data);
    $main_lang = reset($langs);
    array_walk($variant, 'fn_trim_helper');
    if (!empty($variant['Feature group'])) {
        $feature_group = fn_exim_get_feature_data_by_name($variant['Feature group'], '');
        $variant['parent_id'] = $feature_group['feature_id'];
    } else {
        $variant['Feature group'] = '';
        $variant['parent_id'] = 0;
    }
    $feature = fn_exim_get_feature_data_by_name($variant['Feature name'], $variant['Feature group']);
    if (empty($feature)) {
        $processed_data['S']++;
        return false;
    }
    $feature_id = $feature['feature_id'];
    $company_id = $feature['company_id'];
    if (Registry::get('runtime.company_id') && Registry::get('runtime.company_id') != $company_id) {
        $processed_data['S']++;
        return false;
    }
    if (!isset($features)) {
        list($features) = fn_get_product_features(array('plain' => true), 0, $main_lang);
    }
    if (!empty($feature_id)) {
        if (isset($variant['variant_id'])) {
            $variant_id = db_get_field('SELECT variant_id FROM ?:product_feature_variants WHERE variant_id = ?i', $variant['variant_id']);
        }
        if (empty($variant_id)) {
            $join = db_quote('INNER JOIN ?:product_feature_variants fv ON fv.variant_id = fvd.variant_id');
            $variant_id = db_get_field("SELECT fvd.variant_id FROM ?:product_feature_variant_descriptions AS fvd {$join} WHERE variant = ?s AND feature_id = ?i", $variant['variant'], $feature_id);
        }
        $new_variant_id = fn_update_product_feature_variant($feature_id, $features[$feature_id]['feature_type'], $variant, $main_lang);
        if ($variant_id == $new_variant_id) {
            $processed_data['E']++;
        } else {
            $processed_data['N']++;
            $variant_id = $new_variant_id;
        }
        foreach ($data as $lang_code => $variant) {
            fn_update_product_feature_variant($feature_id, $features[$feature_id]['feature_type'], $variant, $lang_code);
        }
        if (!empty($variant['image_id'])) {
            fn_import_images($options['images_path'], $variant['image_id'], '', 0, 'V', $variant_id, 'feature_variant');
        }
    }
    return $variant_id;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:56,代码来源:feature_variants.functions.php


示例3: fn_exim_mailru_get_product_features

function fn_exim_mailru_get_product_features($product_id, $lang_code = CART_LANGUAGE)
{
    static $features;
    if (!isset($features[$lang_code])) {
        list($features[$lang_code]) = fn_get_product_features(array('plain' => true), 0, $lang_code);
    }
    //params
    $main_category = db_get_field('SELECT category_id FROM ?:products_categories WHERE product_id = ?i AND link_type = ?s', $product_id, 'M');
    $product = array('product_id' => $product_id, 'main_category' => $main_category);
    $product_features = fn_get_product_features_list($product, 'A', $lang_code);
    $result = array();
    if (!empty($product_features)) {
        foreach ($product_features as $f) {
            $display_on_catalog = $features[$lang_code][$f['feature_id']]['display_on_catalog'];
            $display_on_product = $features[$lang_code][$f['feature_id']]['display_on_product'];
            if ($display_on_catalog == "Y" || $display_on_product == "Y") {
                if ($f['feature_type'] == "C") {
                    $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => $f['value'] == "Y" ? __("yes") : __("no"));
                } elseif ($f['feature_type'] == "S" && !empty($f['variant'])) {
                    $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => fn_exim_mailru_get_product_info($f['variant']));
                } elseif ($f['feature_type'] == "T" && !empty($f['value'])) {
                    $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => fn_exim_mailru_get_product_info($f['value']));
                } elseif ($f['feature_type'] == "M") {
                    if (!empty($f['variants'])) {
                        $_value = '';
                        $counter = count($f['variants']);
                        foreach ($f['variants'] as $_variant) {
                            if ($counter > 1) {
                                $_value .= $_variant['variant'] . ', ';
                            } else {
                                $_value = $_variant['variant'];
                            }
                        }
                        $_value = $counter > 1 ? substr($_value, 0, -2) : $_value;
                        $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => fn_exim_mailru_get_product_info($_value));
                    }
                } elseif ($f['feature_type'] == "N") {
                    $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => fn_exim_mailru_get_product_info($f['variant']));
                } elseif ($f['feature_type'] == "O") {
                    $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => fn_exim_mailru_get_product_info($f['value_int']));
                }
            } elseif ($f['feature_type'] == "E") {
                $result[] = array('description' => fn_exim_mailru_get_product_info($f['description']), 'value' => fn_exim_mailru_get_product_info($f['variant']));
            }
        }
    }
    return !empty($result) ? $result : '';
}
开发者ID:ambient-lounge,项目名称:site,代码行数:48,代码来源:tovary_mailru.functions.php


示例4: fn_update_product

function fn_update_product($product_data, $product_id = 0, $lang_code = CART_LANGUAGE)
{
    $_data = $product_data;
    if (!empty($product_data['timestamp'])) {
        $_data['timestamp'] = fn_parse_date($product_data['timestamp']);
        // Minimal data for product record
    }
    if (!empty($product_data['avail_since'])) {
        $_data['avail_since'] = fn_parse_date($product_data['avail_since']);
    }
    if (isset($product_data['tax_ids'])) {
        $_data['tax_ids'] = empty($product_data['tax_ids']) ? '' : fn_create_set($product_data['tax_ids']);
    }
    if (isset($product_data['localization'])) {
        $_data['localization'] = empty($product_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
    }
    if (isset($product_data['usergroup_ids'])) {
        $_data['usergroup_ids'] = empty($product_data['usergroup_ids']) ? '' : implode(',', $_data['usergroup_ids']);
    }
    if (Registry::get('settings.General.allow_negative_amount') == 'N' && isset($_data['amount'])) {
        $_data['amount'] = abs($_data['amount']);
    }
    // add new product
    if (empty($product_id)) {
        $create = true;
        // product title can't be empty
        if (empty($product_data['product'])) {
            return false;
        }
        $product_id = db_query("INSERT INTO ?:products ?e", $_data);
        if (empty($product_id)) {
            return false;
        }
        //
        // Adding same product descriptions for all cart languages
        //
        $_data = $product_data;
        $_data['product_id'] = $product_id;
        $_data['product'] = trim($_data['product'], " -");
        foreach ((array) Registry::get('languages') as $_data['lang_code'] => $_v) {
            db_query("INSERT INTO ?:product_descriptions ?e", $_data);
        }
        // update product
    } else {
        if (isset($product_data['product']) && empty($product_data['product'])) {
            unset($product_data['product']);
        }
        db_query("UPDATE ?:products SET ?u WHERE product_id = ?i", $_data, $product_id);
        $_data = $product_data;
        if (!empty($_data['product'])) {
            $_data['product'] = trim($_data['product'], " -");
        }
        db_query("UPDATE ?:product_descriptions SET ?u WHERE product_id = ?i AND lang_code = ?s", $_data, $product_id, $lang_code);
    }
    // Log product add/update
    fn_log_event('products', !empty($create) ? 'create' : 'update', array('product_id' => $product_id));
    if (!empty($product_data['product_features'])) {
        $i_data = array('product_id' => $product_id, 'lang_code' => $lang_code);
        foreach ($product_data['product_features'] as $feature_id => $value) {
            // Check if feature is applicable for this product
            $id_paths = db_get_fields("SELECT ?:categories.id_path FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id WHERE product_id = ?i", $product_id);
            $_params = array('category_ids' => array_unique(explode('/', implode('/', $id_paths))), 'feature_id' => $feature_id);
            list($_feature) = fn_get_product_features($_params);
            if (empty($_feature)) {
                $_feature = db_get_field("SELECT description FROM ?:product_features_descriptions WHERE feature_id = ?i AND lang_code = ?s", $feature_id, CART_LANGUAGE);
                $_product = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $product_id, CART_LANGUAGE);
                fn_set_notification('E', fn_get_lang_var('error'), str_replace(array('[feature_name]', '[product_name]'), array($_feature, $_product), fn_get_lang_var('product_feature_cannot_assigned')));
                continue;
            }
            $i_data['feature_id'] = $feature_id;
            unset($i_data['value']);
            unset($i_data['variant_id']);
            unset($i_data['value_int']);
            $feature_type = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $feature_id);
            // Delete variants in current language
            if ($feature_type == 'T') {
                db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i AND product_id = ?i AND lang_code = ?s", $feature_id, $product_id, $lang_code);
            } else {
                db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i AND product_id = ?i", $feature_id, $product_id);
            }
            if ($feature_type == 'D') {
                $i_data['value_int'] = fn_parse_date($value);
            } elseif ($feature_type == 'M') {
                if (!empty($product_data['add_new_variant'][$feature_id]['variant'])) {
                    $value = empty($value) ? array() : $value;
                    $value[] = fn_add_feature_variant($feature_id, $product_data['add_new_variant'][$feature_id]);
                }
                if (!empty($value)) {
                    foreach ($value as $variant_id) {
                        foreach (Registry::get('languages') as $i_data['lang_code'] => $_d) {
                            // insert for all languages
                            $i_data['variant_id'] = $variant_id;
                            db_query("REPLACE INTO ?:product_features_values ?e", $i_data);
                        }
                    }
                }
                continue;
            } elseif (in_array($feature_type, array('S', 'N', 'E'))) {
                if (!empty($product_data['add_new_variant'][$feature_id]['variant'])) {
                    $i_data['variant_id'] = fn_add_feature_variant($feature_id, $product_data['add_new_variant'][$feature_id]);
//.........这里部分代码省略.........
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:fn.products.php


示例5: dataProductFeatures

 public static function dataProductFeatures($data_product, &$product, $import_params)
 {
     $property_for_promo_text = trim(self::$s_commerceml['exim_1c_property_product']);
     $cml = self::$cml;
     $features_commerceml = self::$features_commerceml;
     if (!empty($data_product->{$cml}['properties_values']->{$cml}['property_values'])) {
         foreach ($data_product->{$cml}['properties_values']->{$cml}['property_values'] as $_feature) {
             $variant_data = array();
             $feature_id = strval($_feature->{$cml}['id']);
             if (!isset($features_commerceml[$feature_id]) || empty($_feature->{$cml}['value'])) {
                 continue;
             }
             $p_feature_name = strval($_feature->{$cml}['value']);
             $feature_name = trim($features_commerceml[$feature_id]['name'], " ");
             if (!empty($features_commerceml[$feature_id])) {
                 $product_params = self::dataShippingParams($p_feature_name, $feature_name, $import_params);
                 if (!empty($product_params)) {
                     $product = array_merge($product, $product_params);
                 }
                 if (!empty($property_for_promo_text) && $property_for_promo_text == $feature_name) {
                     if (!empty($features_commerceml[$feature_id]['variants'])) {
                         $product['promo_text'] = $features_commerceml[$feature_id]['variants'][$p_feature_name]['value'];
                     } else {
                         $product['promo_text'] = $p_feature_name;
                     }
                 }
             }
             if (!empty($features_commerceml[$feature_id]['id'])) {
                 $variant_data['feature_id'] = $features_commerceml[$feature_id]['id'];
                 $variant_data['feature_types'] = $features_commerceml[$feature_id]['type'];
                 $variant_data['lang_code'] = $import_params['lang_code'];
                 list($d_variants, $variant_params, $has_ungroupped) = fn_get_product_features($variant_data, 0, $import_params['lang_code']);
                 $variant_data = $d_variants[$variant_data['feature_id']];
                 if ($variant_data['feature_type'] == ProductFeatures::NUMBER_SELECTBOX) {
                     $p_feature_name = str_replace(',', '.', $p_feature_name);
                     $variant_data['value_int'] = $p_feature_name;
                 }
                 $is_id = false;
                 $variant = '';
                 if (!empty($features_commerceml[$feature_id]['variants'])) {
                     foreach ($features_commerceml[$feature_id]['variants'] as $_variant) {
                         if ($p_feature_name == $_variant['id']) {
                             $variant = $_variant['value'];
                             $is_id = true;
                             break;
                         }
                     }
                     if (!$is_id) {
                         $variant = $p_feature_name;
                     }
                 } else {
                     $variant = $p_feature_name;
                 }
                 $variant_data['variant'] = $variant;
                 list($d_variants, $params_variant) = fn_get_product_feature_variants(array('feature_id' => array($variant_data['feature_id']), 'search_query' => $variant), 0, $import_params['lang_code']);
                 if (!empty($d_variants)) {
                     $d_variant = reset($d_variants);
                     $variant_data['variant_id'] = $d_variant['variant_id'];
                 } else {
                     $variant_data['variant_id'] = fn_add_feature_variant($variant_data['feature_id'], array('variant' => $variant));
                 }
                 $product['features'][$feature_id] = $variant_data;
             }
         }
     }
     $variant_data = array();
     if (self::$s_commerceml['exim_1c_used_brand'] == 'field_brand') {
         if (isset($data_product->{$cml}['manufacturer'])) {
             $variant_data['feature_id'] = $features_commerceml['brand1c']['id'];
             $variant_data['lang_code'] = $import_params['lang_code'];
             $variant_id = db_get_field("SELECT variant_id FROM ?:product_feature_variants WHERE feature_id = ?i AND external_id = ?s", $variant_data['feature_id'], strval($data_product->{$cml}['manufacturer']->{$cml}['id']));
             $variant = strval($data_product->{$cml}['manufacturer']->{$cml}['name']);
             if (empty($variant_id)) {
                 $variant_data['variant_id'] = fn_add_feature_variant($variant_data['feature_id'], array('variant' => $variant));
                 db_query("UPDATE ?:product_feature_variants SET external_id = ?s WHERE variant_id = ?i", strval($data_product->{$cml}['manufacturer']->{$cml}['id']), $variant_data['variant_id']);
             } else {
                 $variant_data['variant_id'] = $variant_id;
             }
             $product['features'][$variant_data['feature_id']] = $variant_data;
         }
     }
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:82,代码来源:RusEximCommerceml.php


示例6: array

         continue;
     }
     if (is_array($offer_feature_name)) {
         $offers_features['common'][$offer_feature_key] = array();
         if (!empty($category_data['yml2_' . fn_uncamelize($offer_feature_key) . '_select'])) {
             $offer_data = explode('.', $category_data['yml2_' . fn_uncamelize($offer_feature_key) . '_select']);
             $offers_features['common'][$offer_feature_key] = array('type' => isset($offer_data[0]) ? $offer_data[0] : '', 'value' => isset($offer_data[1]) ? $offer_data[1] : '');
         }
         $offers_features['common'][$offer_feature_key] = array_merge($offers_features['common'][$offer_feature_key], $offer_feature_name);
     }
 }
 Tygh::$app['view']->assign('yml2_offer_features', $offers_features);
 Tygh::$app['view']->assign('yml2_model_select', $offers_features['common']['model']);
 Tygh::$app['view']->assign('yml2_type_prefix_select', $offers_features['common']['typePrefix']);
 $params = array('category_ids' => $category_data['category_id'], 'plain' => true);
 list($features) = fn_get_product_features($params);
 Tygh::$app['view']->assign('features', $features);
 $parent = false;
 if (!empty($_REQUEST['category_id'])) {
     $category_id = $_REQUEST['category_id'];
 } elseif (!empty($_REQUEST['parent_id'])) {
     $category_id = $_REQUEST['parent_id'];
     $parent = true;
 }
 $offer_type_parent_category = array();
 if (!empty($category_id)) {
     $offer_type_parent_category = fn_yml_get_parent_categories_field('yml2_offer_type', $category_id, $parent);
     $yml2_model_category = fn_yml_get_parent_categories_field('yml2_model', $category_id, $parent);
     $yml2_type_prefix_category = fn_yml_get_parent_categories_field('yml2_type_prefix', $category_id, $parent);
     $yml2_market_category = fn_yml_get_parent_categories_field('yml2_market_category', $category_id, $parent);
     $yml2_parent_type_prefix_select = fn_yml_get_parent_categories_field('yml2_type_prefix_select', $category_id, $parent);
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:categories.post.php


示例7: array

    $params = array('feature_id' => $feature['feature_id'], 'feature_type' => $feature['feature_type'], 'get_images' => true, 'page' => !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1, 'items_per_page' => !empty($_REQUEST['items_per_page']) ? $_REQUEST['items_per_page'] : Registry::get('settings.Appearance.admin_elements_per_page'));
    list($variants, $search) = fn_get_product_feature_variants($params, Registry::get('settings.Appearance.admin_elements_per_page'), DESCR_SL);
    Registry::get('view')->assign('feature_variants', $variants);
    Registry::get('view')->assign('search', $search);
} elseif ($mode == 'manage') {
    $params = $_REQUEST;
    $params['get_descriptions'] = true;
    $params['search_in_subcats'] = true;
    list($features, $search, $has_ungroupped) = fn_get_product_features($params, Registry::get('settings.Appearance.admin_elements_per_page'), DESCR_SL);
    Registry::get('view')->assign('features', $features);
    Registry::get('view')->assign('search', $search);
    Registry::get('view')->assign('has_ungroupped', $has_ungroupped);
    if (empty($features) && defined('AJAX_REQUEST')) {
        Registry::get('ajax')->assign('force_redirection', fn_url('product_features.manage'));
    }
    list($group_features) = fn_get_product_features(array('feature_types' => ProductFeatures::GROUP), 0, DESCR_SL);
    Registry::get('view')->assign('group_features', $group_features);
} elseif ($mode == 'get_feature_variants_list') {
    if (empty($_REQUEST['feature_id'])) {
        exit;
    }
    $pattern = !empty($_REQUEST['pattern']) ? $_REQUEST['pattern'] : '';
    $start = !empty($_REQUEST['start']) ? $_REQUEST['start'] : 0;
    $limit = (!empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 10) + 1;
    $sorting = db_quote("?:product_feature_variants.position, ?:product_feature_variant_descriptions.variant");
    $join = db_quote(" LEFT JOIN ?:product_feature_variant_descriptions ON ?:product_feature_variant_descriptions.variant_id = ?:product_feature_variants.variant_id AND ?:product_feature_variant_descriptions.lang_code = ?s", DESCR_SL);
    $condition = db_quote(" AND ?:product_feature_variants.feature_id = ?i", $_REQUEST['feature_id']);
    fn_set_hook('get_feature_variants_list', $condition, $join, $pattern, $start, $limit);
    $objects = db_get_hash_array("SELECT SQL_CALC_FOUND_ROWS ?:product_feature_variants.variant_id AS value, ?:product_feature_variant_descriptions.variant AS name FROM ?:product_feature_variants {$join} WHERE 1 {$condition} AND ?:product_feature_variant_descriptions.variant LIKE ?l ORDER BY ?p LIMIT ?i, ?i", 'value', '%' . $pattern . '%', $sorting, $start, $limit);
    if (defined('AJAX_REQUEST') && sizeof($objects) < $limit) {
        Registry::get('ajax')->assign('completed', true);
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:product_features.php


示例8: fn_get_all_brands

/**
 * Gets all available brands.
 *
 * @param array $object Block manager object
 * @param array $block Current block settings
 * @param array $scheme Scheme of current block
 * @return array Found brands
 */
function fn_get_all_brands($object, $block, $scheme)
{
    $params = array('exclude_group' => true, 'get_descriptions' => true, 'feature_types' => array('E'), 'variants' => true, 'plain' => trues);
    list($features) = fn_get_product_features($params, 0);
    $variants = array();
    foreach ($features as $feature) {
        $variants = array_merge($variants, $feature['variants']);
    }
    return $variants;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:18,代码来源:fn.catalog.php


示例9: fn_get_paginated_product_features

function fn_get_paginated_product_features($request, $auth, $product_data = array(), $lang_code = DESCR_SL)
{
    $path = array();
    if (!empty($request['over'])) {
        // get features for categories of selected products only
        $categories = db_get_fields("SELECT ?:categories.id_path FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id WHERE product_id IN (?n)", $_SESSION['product_ids']);
        foreach ($categories as $category) {
            $path = array_merge($path, explode('/', $category));
        }
        $path = array_unique($path);
    }
    if (empty($product_data) && !empty($request['product_id'])) {
        $product_data = fn_get_product_data($request['product_id'], $auth, $lang_code, '', false, false, false, false, false, false, false, false);
    }
    if (!empty($product_data['product_id'])) {
        $path = !empty($product_data['main_category']) ? explode('/', db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $product_data['main_category'])) : '';
        if (fn_allowed_for('ULTIMATE')) {
            if ($product_data['shared_product'] == 'Y') {
                //we should get features for all categories, not only main
                $path = !empty($product_data['category_ids']) ? explode('/', implode('/', db_get_fields("SELECT id_path FROM ?:categories WHERE category_id IN (?a)", $product_data['category_ids']))) : '';
            }
        }
    }
    $_params = fn_array_merge($request, array('category_ids' => $path, 'product_company_id' => !empty($product_data['company_id']) ? $product_data['company_id'] : 0, 'statuses' => array('A', 'H'), 'variants' => true, 'plain' => false, 'display_on' => '', 'existent_only' => false, 'variants_selected_only' => false));
    return fn_get_product_features($_params, PRODUCT_FEATURES_THRESHOLD, $lang_code);
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:26,代码来源:products.php


示例10: fn_get_filters_products_count


//.........这里部分代码省略.........
            }
        }
        $merged = fn_array_merge($variants_counts, $ranges_counts, $field_ranges_counts);
        $view_all = array();
        foreach ($filters as $filter_id => $filter) {
            if (!empty($merged[$filter_id]) && empty($params['view_all']) || !empty($params['filter_id']) && $params['filter_id'] != $filter_id) {
                // Check if filter range was selected
                if (empty($filters[$filter_id]['feature_id'])) {
                    $intersect = array_intersect(array_keys($merged[$filter_id]), $field_ranges_ids);
                } else {
                    $intersect = array_intersect(array_keys($merged[$filter_id]), $variants_ids);
                }
                if (!empty($intersect)) {
                    foreach ($merged[$filter_id] as $k => $v) {
                        if (!in_array($v['range_id'], $intersect)) {
                            // Unset unselected ranges
                            unset($merged[$filter_id][$k]);
                        }
                    }
                }
                // Calculate number of ranges and compare with constant
                $count = count($merged[$filter_id]);
                if ($count > FILTERS_RANGES_MORE_COUNT && empty($params['get_all'])) {
                    $merged[$filter_id] = array_slice($merged[$filter_id], 0, FILTERS_RANGES_MORE_COUNT, true);
                    $filters[$filter_id]['more_cut'] = true;
                }
                $filters[$filter_id]['ranges'] =& $merged[$filter_id];
                // Add feature type to the filter
                $_first = reset($merged[$filter_id]);
                if (!empty($_first['feature_type'])) {
                    $filters[$filter_id]['feature_type'] = $_first['feature_type'];
                }
                if (!empty($params['simple_link']) && $filters[$filter_id]['feature_type'] == 'E') {
                    $filters[$filter_id]['simple_link'] = true;
                }
                if (empty($params['skip_other_variants'])) {
                    foreach ($filters[$filter_id]['ranges'] as $_k => $r) {
                        if (!fn_check_selected_filter($r['range_id'], !empty($r['feature_type']) ? $r['feature_type'] : '', $params, $filters[$filter_id]['field_type'])) {
                            // selected variant
                            $filters[$filter_id]['ranges'] = array($_k => $r);
                            $filters[$filter_id]['ranges'][$_k]['selected'] = true;
                            // mark selected variant
                            // Get other variants
                            $_params = $params;
                            $_params['filter_id'] = $filter_id;
                            $_params['req_range_id'] = $r['range_id'];
                            $_params['features_hash'] = fn_delete_range_from_url($params['features_hash'], $r, $filters[$filter_id]['field_type']);
                            $_params['skip_other_variants'] = true;
                            unset($_params['variant_id'], $_params['check_location']);
                            list($_f) = fn_get_filters_products_count($_params);
                            if (!empty($_f)) {
                                $_f = reset($_f);
                                // delete current range
                                foreach ($_f['ranges'] as $_rid => $_rv) {
                                    if ($_rv['range_id'] == $r['range_id']) {
                                        unset($_f['ranges'][$_rid]);
                                        break;
                                    }
                                }
                                $filters[$filter_id]['other_variants'] = $_f['ranges'];
                            }
                            break;
                        }
                    }
                } else {
                    if (!empty($params['variant_id']) && !empty($filters[$filter_id]['ranges'][$params['variant_id']])) {
                        $filters[$filter_id]['ranges'][$params['variant_id']]['selected'] = true;
                        // mark selected variant
                    }
                }
                continue;
                // If its "view all" page, return all ranges
            } elseif (!empty($params['filter_id']) && $params['filter_id'] == $filter_id && !empty($merged[$filter_id])) {
                foreach ($merged[$filter_id] as $range) {
                    if (!empty($range['index'])) {
                        // feature
                        $view_all[$range['index']][] = $range;
                    } else {
                        // custom range
                        $view_all[$filters[$range['filter_id']]['filter']][] = $range;
                    }
                }
                ksort($view_all);
            }
            // Unset filter if he is empty
            unset($filters[$filter_id]);
        }
        if (!empty($params['advanced_filter'])) {
            $_params = array('feature_types' => array('C', 'T'), 'plain' => true, 'category_ids' => array(empty($params['category_id']) ? 0 : $params['category_id']));
            list($features) = fn_get_product_features($_params);
            if (!empty($features)) {
                $filters = array_merge($filters, $features);
            }
        }
        Registry::set($key, array($filters, $view_all));
    } else {
        list($filters, $view_all) = Registry::get($key);
    }
    return array($filters, $view_all);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:fn.catalog.php


示例11: elseif

    }, $variants));
    Tygh::$app['ajax']->assign('objects', $objects);
    Tygh::$app['ajax']->assign('total_objects', $search['total_items']);
    exit;
} elseif ($mode == 'get_features_list') {
    $page_number = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
    $page_size = isset($_REQUEST['page_size']) ? (int) $_REQUEST['page_size'] : 10;
    $search_query = isset($_REQUEST['q']) ? $_REQUEST['q'] : null;
    $lang_code = isset($_REQUEST['lang_code']) ? $_REQUEST['lang_code'] : CART_LANGUAGE;
    $search = array('page' => $page_number, 'search_query' => $search_query, 'get_descriptions' => true);
    if (isset($_REQUEST['preselected'])) {
        $search['feature_id'] = $_REQUEST['preselected'];
        $search['plain'] = true;
        $search['exclude_group'] = true;
    }
    list($features, $search) = fn_get_product_features($search, $page_size, $lang_code);
    // This weird recursive functional code is efficient, but is not nicely readable.
    // It will be refactored along with implementing Select2 controller mode base class.
    $feature_converter = function ($feature_list) use(&$feature_converter, $lang_code) {
        return array_values(array_map(function ($feature) use(&$feature_converter, $lang_code) {
            $return = array('id' => (int) $feature['feature_id'], 'text' => $feature['description'], 'object' => array('feature_type' => $feature['feature_type']));
            if ($feature['feature_type'] == ProductFeatures::SINGLE_CHECKBOX) {
                $return['object']['variants'] = array(array('id' => 'Y', 'text' => __('yes')), array('id' => 'N', 'text' => __('no')));
            } elseif ($feature['feature_type'] == ProductFeatures::GROUP) {
                $return['children'] = array();
                if (!empty($feature['subfeatures'])) {
                    // Recursive call that fills subfeatures list
                    $return['children'] = $feature_converter($feature['subfeatures']);
                }
            } elseif (in_array($feature['feature_type'], array(ProductFeatures::TEXT_SELECTBOX, ProductFeatures::NUMBER_SELECTBOX, ProductFeatures::EXTENDED))) {
                $return['object']['variants'] = fn_url("product_features.get_variants_list?feature_id={$feature['feature_id']}&lang_code={$lang_code}");
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:product_features.php


示例12: fn_delete_feature

        fn_delete_feature($_REQUEST['feature_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "product_features.manage");
} elseif ($mode == 'manage') {
    $params = $_REQUEST;
    $params['exclude_group'] = true;
    $params['get_descriptions'] = true;
    $params['search_in_subcats'] = true;
    list($features, $search, $has_ungroupped) = fn_get_product_features($params, Registry::get('settings.Appearance.admin_elements_per_page'), DESCR_SL);
    Registry::get('view')->assign('features', $features);
    Registry::get('view')->assign('search', $search);
    Registry::get('view')->assign('has_ungroupped', $has_ungroupped);
    if (empty($features) && defined('AJAX_REQUEST')) {
        Registry::get('ajax')->assign('force_redirection', fn_url('product_features.manage'));
    }
    list($group_features) = fn_get_product_features(array('feature_types' => 'G'), 0, DESCR_SL);
    Registry::get('view')->assign('group_features', $group_features);
} elseif ($mode == 'get_feature_variants_list') {
    if (empty($_REQUEST['feature_id'])) {
        exit;
    }
    $pattern = !empty($_REQUEST['pattern']) ? $_REQUEST['pattern'] : '';
    $start = !empty($_REQUEST['start']) ? $_REQUEST['start'] : 0;
    $limit = (!empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 10) + 1;
    $sorting = db_quote("?:product_feature_variants.position, ?:product_feature_variant_descriptions.variant");
    $join = db_quote(" LEFT JOIN ?:product_feature_variant_descriptions ON ?:product_feature_variant_descriptions.variant_id = ?:product_feature_variants.variant_id AND ?:product_feature_variant_descriptions.lang_code = ?s", DESCR_SL);
    $condition = db_quote(" AND ?:product_feature_variants.feature_id = ?i", $_REQUEST['feature_id']);
    fn_set_hook('get_feature_variants_list', $condition, $join, $pattern, $start, $limit);
    $objects = db_get_hash_array("SELECT SQL_CALC_FOUND_ROWS ?:product_feature_variants.variant_id AS value, ?:product_feature_variant_descriptions.variant AS name FROM ?:product_feature_variants {$join} WHERE 1 {$condition} AND ?:product_feature_variant_descriptions.variant LIKE ?l ORDER BY ?p LIMIT ?i, ?i", 'value', '%' . $pattern . '%', $sorting, $start, $limit);
    if (defined('AJAX_REQUEST') && sizeof($objects) < $limit) {
        Registry::get('ajax')->assign('completed', true);
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:product_features.php


示例13: fn_promotions_get_features

/**
 * Get product features and convert the to common format
 *
 * @param string $lang_code language code
 * @return array formatted data
 */
function fn_promotions_get_features($lang_code = CART_LANGUAGE)
{
    $params = array('variants' => true, 'plain' => false);
    list($features) = fn_get_product_features($params);
    $res = array();
    foreach ($features as $k => $v) {
        if ($v['feature_type'] == ProductFeatures::GROUP) {
            $res[$k]['is_group'] = true;
            $res[$k]['group'] = $v['description'];
            $res[$k]['items'] = array();
            if (!empty($v['subfeatures'])) {
                foreach ($v['subfeatures'] as $_k => $_v) {
                    $res[$k]['items'][$_k]['value'] = $_v['description'];
                    if (!empty($_v['variants'])) {
                        foreach ($_v['variants'] as $__k => $__v) {
                            $res[$k]['items'][$_k]['variants'][$__k] = $__v['variant'];
                        }
                    } elseif ($_v['feature_type'] == ProductFeatures::SINGLE_CHECKBOX) {
                        $res[$k]['items'][$_k]['variants'] = array('Y' => __('yes'), 'N' => __('no'));
                    }
                }
            }
        } else {
            $res[$k]['value'] = $v['description'];
            if (!empty($v['variants'])) {
                foreach ($v['variants'] as $__k => $__v) {
                    $res[$k]['variants'][$__k] = $__v['variant'];
                }
            } elseif ($v['feature_type'] == ProductFeatures::SINGLE_CHECKBOX) {
                $res[$k]['variants'] = array('Y' => __('yes'), 'N' => __('no'));
            }
        }
    }
    return $res;
}
开发者ID:askzap,项目名称:ultimate,代码行数:41,代码来源:fn.promotions.php


示例14: fn_get_taxes

 }
 if (!empty($selected_fields['main_pair']) && $selected_fields['main_pair'] == 'Y') {
     $get_main_pair = true;
     $fields2update[] = 'main_pair';
 }
 if (!empty($selected_fields['data']['taxes']) && $selected_fields['data']['taxes'] == 'Y') {
     $view->assign('taxes', fn_get_taxes());
     $fields2update[] = 'taxes';
     $get_taxes = true;
 }
 if (!empty($selected_fields['data']['features']) && $selected_fields['data']['features'] == 'Y') {
     $fields2update[] = 'features';
     // get features for categories of selected products only
     $id_paths = db_get_fields("SELECT ?:categories.id_path FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id WHERE product_id IN (?n)", $product_ids);
     $_params = array('variants' => true, 'category_ids' => array_unique(explode('/', implode('/', $id_paths))));
     list($all_product_features) = fn_get_product_features($_params, 0, DESCR_SL);
     $view->assign('all_product_features', $all_product_features);
 }
 foreach ($product_ids as $value) {
     $products_data[$value] = fn_get_product_data($value, $auth, DESCR_SL, '?:products.*, ?:product_descriptions.*', false, $get_main_pair, $get_taxes);
 }
 $filled_groups = array();
 $field_names = array();
 foreach ($fields2update as $k => $field) {
     if ($field == 'main_pair') {
         $desc = 'image_pair';
     } elseif ($field == 'tracking') {
         $desc = 'inventory';
     } elseif ($field == 'edp_shipping') {
         $desc = 'downloadable_shipping';
     } elseif ($field == 'is_edp') {
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:products.php


示例15: fn_exim_get_product_features

 function fn_exim_get_product_features($product_id, $features_delimiter, $lang_code = CART_LANGUAGE)
 {
     $pair_delimiter = ':';
     $set_delimiter = '; ';
     $result = array();
     $_params = array('variants' => true, 'product_id' => $product_id, 'plain' => true);
     list($features) = fn_get_product_features($_params, 0, $lang_code);
     if (!empty($features)) {
         foreach ($features as $f) {
             $parent = '';
             if (!empty($f['parent_id'])) {
                 $parent = '(' . $features[$f['parent_id']]['description'] . ') ';
             }
             if (!empty($f['value']) || !empty($f['value_int'])) {
                 $result[] = fn_exim_post_item_id($f['feature_id']) . $parent . "{$f['description']}{$pair_delimiter} {$f['feature_type']}[" . (!empty($f['value']) ? $f['value'] : $f['value_int']) . ']';
             } elseif (!empty($f['variants'])) {
                 $values = array();
                 foreach ($f['variants'] as $v) {
                     if (!empty($v['selected'])) {
                         $values[] = $v['variant'];
                     }
                 }
                 if (!empty($values)) {
                     $result[] = fn_exim_post_item_id($f['feature_id']) . $parent . "{$f['description']}{$pair_delimiter} {$f['feature_type']}[" . implode($features_delimiter, $values) . ']';
                 }
             }
         }
     }
     return !empty($result) ? implode($set_delimiter, $result) : '';
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:30,代码来源:products.php


示例16: fn_stat_product_search_data

function fn_stat_product_search_data($search_params, $text_conditions = array())
{
    $text_conditions['find_results_with'] = (empty($search_params['q']) ? '- ' . fn_get_lang_var('empty') . ' -' : $search_params['q']) . ' [' . ($search_params['match'] == 'exact' ? fn_get_lang_var('exact_phrase') : ($search_params['match'] == 'all' ? fn_get_lang_var('all_words') : fn_get_lang_var('any_words'))) . ']';
    $_data = array();
    if (!empty($search_params['pname'])) {
        $_data[] = fn_get_lang_var('prod 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fn_get_product_name函数代码示例发布时间:2022-05-15
下一篇:
PHP fn_get_product_data函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap