$val){ if($key != "x" and $key != "y"){ $get[$key] = $val; } } //資料請求不可商品を含む:デフォルトOFF if(!$get["ac"]){ $get["ac"] = 2; //1がON 2がOFF } $assigns[] = array("FORM",$get); //ファイルフィールドリスト for($i=1; $i <= 1; $i++){ $photo_list[] = "product_picture".$i; } $assigns[] = array("photo_list",$photo_list); ////////カテゴリ取得(キャッシュデータ)/////////////////////////// require_once DATA_DIR."class/class_Product_Category_Array.php"; $PC_CLASS = new PC_CACHE_CLASS; $pc_class_array = $PC_CLASS->PC_Array_Make(); $assigns[] = array("pc_count",$pc_class_array["pc_count"]); $assigns[] = array("pc_array",$pc_class_array["pc_array"]); $assigns[] = array("pcl_array",$pc_class_array["pcl_array"]); $assigns[] = array("pc_comp_array",$pc_class_array["pc_comp_array"]); //////////////////////////////////////////////////////// ////////各種カテゴリデータ取得(キャッシュデータ)/////////////////////////// require_once DATA_DIR."class/class_Product_Data_Array.php"; $PD_CLASS = new PD_CACHE_CLASS; $pd_array = $PD_CLASS -> PD_Array_Make(); $assigns[] = array("product_status_result",$pd_array["product_status_result"]); $assigns[] = array("ps_array",$pd_array["ps_array"]); $assigns[] = array("product_color_result",$pd_array["product_color_result"]); $assigns[] = array("pcolor_array",$pd_array["pco_array"]); $assigns[] = array("product_style_result",$pd_array["product_style_result"]); $assigns[] = array("pstyle_array",$pd_array["pstyle_array"]); $assigns[] = array("product_use_result",$pd_array["product_use_result"]); $assigns[] = array("pu_array",$pd_array["pu_array"]); //////////////////////////////////////////////////////// /////////メーカーあいうえお順取得(キャッシュデータ)////////////// require_once DATA_DIR."class/class_MakerSort.php"; $MS = new MakerSort; $sorted_maker_array = $MS->GetMakerSortCache(); $assigns[] = array("sorted_maker_array",$sorted_maker_array); /////////////////////////////////////////////////////// //////////////検索////////////////// require_once DATA_DIR."/class/class_ProductSearch.php"; $PSG = new ProductSearchGet; $PSG->assigns = $assigns; $PSG->get = $get; $PSG->default_max = 30; $PSG->base_url = "/product/"; $PSG->pc_comp_array = $pc_class_array["pc_comp_array"]; $PSG->pcl_array = $pc_class_array["pcl_array"]; $PSG->pd_array = $pd_array; $PSG->draft_disp = 0; $PS_ARRAY = $PSG->ProductSearchGetAct(); //return array(target_pids,condition_count,sort,max,page,get) $URL_ARRAY = $PSG->ProductSearchURLAct(); //return array(s_url,side_form_base1,side_form_base2) $FORM_ARRAY = $PSG->ProductSearchForm(); //return array() $assigns[] = array("FORM_ARRAY",$FORM_ARRAY); $assigns[] = array("URL_ARRAY",$URL_ARRAY); $assigns[] = array("FORM",$PS_ARRAY["get"]); //////////////検索////////////////// $table_name = "`product`"; if($PS_ARRAY["target_pids"] !== ""){ $where = "product.product_id IN ({$PS_ARRAY["target_pids"]})"; }else{ $where = ""; } $lj = "maker"; $on = "maker_id = product_maker_id"; $sl = "product_id,product_status,product_draft,product_name,product_picture1,product_dl_url,maker_id,maker_plan,maker_name,maker_short_name"; if($PS_ARRAY["sort"]){ $order = $PS_ARRAY["sort"]; }else{ $order = "product.product_id DESC"; } $result=serach_all($table_name,$where,$order,$PS_ARRAY["max"],$PS_ARRAY["page"],$lj,$on,$sl); if($result["count"] > 0){ foreach($result["result"] as $temp){ //サムネイル画像URL foreach($photo_list as $photo){ preg_match("/^(.+)\.([^\.]+)$/",$temp[$photo],$match); $temp["thumbname"][$photo] = $match[1]; $temp["thumbtype"][$photo] = ".".$match[2]; } $fix_result[] = $temp; } } //////////////////////////////////////////////////////// $assigns[] = array("result",$fix_result); $assigns[] = array("count",$result["count"]); $assigns[] = array("all_page",$result["all_page"]); $assigns[] = array("page",$result["page"]); ///////////////URL処理(ページャー/URL正規化)///////////// $assigns[] = array("base_uri",$PSG->base_url); $s_url = $URL_ARRAY["s_url"]; $assigns[] = array("s_url",$s_url); $assigns[] = array("pager_param","1"); //メタタグ用前後ページ if($result["all_page"] > $result["page"]){ if(strpos($s_url,'?') !== false){ $next_num =$result["page"]+1; $next_page_url = $s_url."&page=".$next_num; }else{ $next_num =$result["page"]+1; $next_page_url = $s_url."?page=".$next_num; } $assigns[] = array("next_page_url",$next_page_url); } if($result["page"] > 2){ if(strpos($s_url,'?') !== false){ $prev_num =$result["page"]-1; $prev_page_url = $s_url."&page=".$prev_num; }else{ $prev_num =$result["page"]-1; $prev_page_url = $s_url."?page=".$prev_num; } $assigns[] = array("prev_page_url",$prev_page_url); }elseif($result["page"] == 2){ $prev_page_url = $s_url; $assigns[] = array("prev_page_url",$prev_page_url); } ////////SEO対策テキスト生成/////////////////////////// require_once DATA_DIR."class/class_ProductSearch_seo.php"; $PS_SEO = new ProductSearchSEO; $PS_SEO->PS_ARRAY = $PS_ARRAY; $PS_SEO->pc_class_array = $pc_class_array; $PS_SEO->pd_array = $pd_array; $seo_array = $PS_SEO -> ProductSearchSEOAct(); //////////////////////////////////////////////////////// $assigns[] = array("seo_keywords",$seo_array["keywords"]); $assigns[] = array("seo_title",$seo_array["title"]); $assigns[] = array("result_info",$seo_array["result_info"]); $assigns[] = array("seo_description",$seo_array["title"]."。建材トレンドでは人気の建材・設備商品について、お気軽に各メーカーへ問い合わせ・資料請求・見積もり依頼などをすることができます。"); //件数表示(start) if($result["count"] == 0){ $start_num = 0; }elseif($PS_ARRAY["page"] > 1){ $start_num = ($result["page"] - 1) * $PS_ARRAY["max"] + 1; }else{ $start_num = 1;} //件数表示(end) if($result["count"] == 0){ $end_num = 0; }elseif($PS_ARRAY["page"] == $result["all_page"]){ $end_num = $result["count"]; }else{ $end_num = $result["page"] * $PS_ARRAY["max"] ; } $assigns[] = array("start_num",$start_num); $assigns[] = array("end_num",$end_num); //検索結果用表示作成 $pager = search_sub_p($s_url,$result["all_page"],$result["page"]); $assigns[] = array("pager",$pager); ############################# # フッター用 # ############################# $footer_product_list = ""; $table_name = "`product`"; if($PS_ARRAY["target_pids"] !== ""){ $where = "product.product_id IN ({$PS_ARRAY["target_pids"]})"; }else{ $where = ""; } $lj = "maker"; $on = "maker_id = product_maker_id"; $sl = "product_id,product_status,product_draft,product_name,product_picture1,maker_id,maker_name,maker_short_name"; $index = ""; $mode = "NoCount"; if($get["sort"] == ""){ //新着順の時→人気の商品 $order = "product.product_id DESC"; }else{ //人気順の時→新着の商品 $order = "product.product_view DESC, product.product_id DESC"; } $footer_product_result=serach_all($table_name,$where,$order,10,1,$lj,$on,$sl,$index,$mode); if($footer_product_result["count"] > 0){ foreach($footer_product_result["result"] as $temp){ //サムネイル画像URL foreach($photo_list as $photo){ preg_match("/^(.+)\.([^\.]+)$/",$temp[$photo],$match); $temp["thumbname"][$photo] = $match[1]; $temp["thumbtype"][$photo] = ".".$match[2]; } $footer_product_list[] = $temp; } } $assigns[] = array("footer_product_count",$footer_product_result["count"]); $assigns[] = array("footer_product_list",$footer_product_list); $main_tpl="{$display_mode}/product/index.tpl"; /*画面出力*/ $disp = new DISP; $disp->assigns=$assigns; $disp->main_tpl=$main_tpl; $disp->display(); exit(); ?>