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


PHP products_minierp::getMainElement方法代码示例

本文整理汇总了PHP中products_minierp::getMainElement方法的典型用法代码示例。如果您正苦于以下问题:PHP products_minierp::getMainElement方法的具体用法?PHP products_minierp::getMainElement怎么用?PHP products_minierp::getMainElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在products_minierp的用法示例。


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

示例1: getProductsCrossSelling

 /**
  * get products based on filter (family, main element, symbol, color, and brand)
  * @param Int $product_id Products ID
  * @return Array Array of products ID
  */
 function getProductsCrossSelling($product_id)
 {
     use_class('products_brand');
     use_class('styles_php4');
     use_class('products_minierp');
     use_class('products_family_php4');
     $class_s = new styles();
     $class_pb = new products_brand();
     $class_pm = new products_minierp();
     $max_products = 50;
     $max_products_by_family = 20;
     $max_products_by_main_element = 10;
     $max_products_by_symbol = 30;
     //            $max_products_by_color = 5;
     //            $max_products_by_brand = 5;
     $max_products_by_category = 40;
     $pids = array();
     $p_data = $class_pm->retrieveDetail($product_id, 'p,cat');
     //FAMILY
     $family_id = $p_data['p']['family_id'];
     $obj_family = new products_family(null, $product_id);
     $pid_family = $obj_family->retrieveMembers();
     $pid_family_exclude_kill_prod = $class_pm->filterExcludeKilledProducts($pid_family);
     $pid_similar = $obj_family->getSimilarProducts($product_id, false, false);
     $pids = array_merge($pid_family_exclude_kill_prod, $pid_similar);
     $key = array_search($product_id, $pids);
     unset($pids[$key]);
     $pids = array_slice($pids, 0, 20);
     //MAIN ELEMENT
     $pid_family_filter = implode(",", $pids);
     if ($pid_family_filter == '') {
         if ($p_data['p']['products_brand_id'] == 14) {
             $pid_family_filters = "AND pue.products_id NOT IN ({$product_id}) AND p.products_brand_id = 14 ";
         } else {
             $pid_family_filters = "AND pue.products_id NOT IN ({$product_id})";
         }
     } else {
         if ($p_data['p']['products_brand_id'] == 14) {
             $pid_family_filters = "AND pue.products_id NOT IN ({$pid_family_filter}, {$product_id}) AND p.products_brand_id = 14 ";
         } else {
             $pid_family_filters = "AND pue.products_id NOT IN ({$pid_family_filter}, {$product_id})";
         }
     }
     $main_element_id = $class_pm->getMainElement($product_id);
     if ($main_element_id != NULL) {
         $pid_main_element = $class_pm->getProductsByMainElement($main_element_id, false, $pid_family_filters, "ORDER BY pl.sold_monthly_3 DESC LIMIT {$max_products_by_main_element}");
         $pids = array_merge($pids, $pid_main_element);
     }
     //SYMBOL
     $symbol_id = $class_s->getProductStyle($product_id);
     $pid_main_element_filter = implode(",", $pids);
     if ($pid_main_element_filter == '') {
         if ($p_data['p']['products_brand_id'] == 14) {
             $pid_main_element_filters = "AND shp.products_id NOT IN ({$product_id}) AND p.products_brand_id = 14 ";
         } else {
             $pid_main_element_filters = "AND shp.products_id NOT IN ({$product_id})";
         }
     } else {
         if ($p_data['p']['products_brand_id'] == 14) {
             $pid_main_element_filters = "AND shp.products_id NOT IN ({$pid_main_element_filter}, {$product_id}) AND p.products_brand_id = 14 ";
         } else {
             $pid_main_element_filters = "AND shp.products_id NOT IN ({$pid_main_element_filter}, {$product_id})";
         }
     }
     if ($symbol_id['Symbol'] != '') {
         $pid_symbol = array_keys($class_s->retrieveProducts($symbol_id['Symbol'], false, $pid_main_element_filters, "ORDER BY pl.sold_monthly_3 DESC LIMIT {$max_products_by_symbol}"));
         $pids = array_merge($pids, $pid_symbol);
     }
     //COLOR
     //            $color_id = $class_pm->loadColorPattern($product_id);
     //            if ($color_id) {
     //                $pids_symbol_filter = implode(",", $pids);
     //                if ($pids_symbol_filter == '') {
     //                    $pid_symbol_filters = "AND ptcp.products_id NOT IN ($product_id)";
     //                } else {
     //                    $pid_symbol_filters = "AND ptcp.products_id NOT IN ($pids_symbol_filter, $product_id)";
     //                }
     //                $pid_color = $class_pm->getProductsByColor(
     //                        $color_id[0],
     //                        false,
     //                        $pid_symbol_filters,
     //                        "ORDER BY pl.sold_monthly_3 DESC LIMIT $max_products_by_color");
     //                $pids = array_merge($pids, $pid_color);
     //            }
     //BRAND
     //            $brand_id = $p_data['p']['products_brand_id'];
     //            if ($brand_id) {
     //                $pids_color_filter = implode(",", $pids);
     //                if ($pids_color_filter == '') {
     //                    $pid_color_filters = "AND p.products_id NOT IN ($product_id)";
     //                } else {
     //                    $pid_color_filters = "AND p.products_id NOT IN ($pids_color_filter, $product_id)";
     //                }
     //                $pid_brand = $class_pb->getProducts(
     //                        $brand_id,
//.........这里部分代码省略.........
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:101,代码来源:products_linking_php4.php


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