getStoresC($_GET['store']); } if($_GET['pg'] && is_numeric($_GET['pg']) ){ # ページ番号指定 $fpage = $_GET['pg']; $_SESSION['fpage'] = $fpage; if($fpage > $lpage && $fpage < $rpage){ }else if($fpage <= $lpage){ $lpage = $lpage - 5; $rpage = $rpage - 5; }else if($fpage >= $rpage){ $lpage = $lpage + 5; $rpage = $rpage + 5; } } # 送料無料表示 if($_GET['dc'] == 1 && is_numeric($_GET['dc']) ){ $dc = 1; } if($_POST){ $hilow = $_POST['hirow'] == 0 ? "DESC" : "ASC" ; $_SESSION['hilow'] = $hilow; $_SESSION['sort'] = "1"; }else{ $hilow = $_SESSION['hilow']; } ### メイン処理 if($stores_no){ $stores_no = htmlspecialchars($stores_no, ENT_QUOTES); $storeParam = "store={$stores_no}"; } if($fpage){ $fpage = htmlspecialchars($fpage, ENT_QUOTES); $pgParam = "&pg={$fpage}"; } if($dc){ $dc = htmlspecialchars($dc, ENT_QUOTES); $dcParam = "&dc={$dc}"; } $_SESSION['cartcont'] = "/shop/02.html?{$storeParam}{$pgParam}{$dcParam}"; $res = $Store->shop_item($stores_no,$fpage,$hilow,$dc); if($res){ $shopitem = $Store->items; $alpage = $Store->alpage; $j = Count($shopitem); if($j > 28){ $j = 28; } for($i=0; $i<$j; $i++){ $showitems[$i] = $shopitem[$i]; } $res = $Store->shop_info($stores_no); $shopdata = $Store->data; $concept_page = mb_ereg_replace(" ", "", $shopdata['concept_page']); if(file_exists("/var/www/html/shop/".$concept_page) == false){ $concept_page = ""; } ## 送料無料/送料有料商品有無チェック # 無料一覧を表示する場合($dc=0)、有料商品があるかチェック。 # 有料一覧を表示する場合($dc=1)、無料商品があるかチェック。 # 表示している商品のリストとは異なる送料区分の商品数を返す。 $dcFlg = $Store->checkDcostListStore($dc,$stores_no); # add 20130412 if( $dcFlg > 0 && $j == 0 && $dc == 1 ){ header("Location: {$_SERVER['SCRIPT_URI']}?{$storeParam}{$pgParam}&dc=0") ; } if( $dcFlg > 0 && $j == 0 && $dc == 0 ){ header("Location: {$_SERVER['SCRIPT_URI']}?{$storeParam}{$pgParam}&dc=1") ; } if($dc == 1){ $dcLink = "./02.html?{$storeParam}{$pgParam}"; }else{ $dcLink = "./02.html?{$storeParam}{$pgParam}&dc=1"; } } ### ヘッダ出力 $sVal = $shopdata['shop_name']; include("../header.html"); ### メイン出力 $smarty->assign("stores_no",htmlspecialchars($stores_no, ENT_QUOTES)); $smarty->assign("shopgif",$shopgif); $smarty->assign("items", $showitems); $smarty->assign("fpage", $fpage); # 表示ページ番号 $smarty->assign("alpage", $alpage); # 総ページ $smarty->assign("lpage", $lpage); $smarty->assign("rpage", $rpage); $smarty->assign("shopname", $shopdata['shop_name']); $smarty->assign("concept_page", $concept_page); $smarty->assign("dc", $dc); $smarty->assign("dcFlg", $dcFlg); $smarty->assign("dcLink", $dcLink); $pagenate_arr = array(); $pagenate_arr = pagenate($alpage,$fpage); $smarty->assign("left_limit_number", $pagenate_arr['left_limit_number']); $smarty->assign("right_limit_number", $pagenate_arr['right_limit_number']); $smarty->assign("left_limit_dec", $pagenate_arr['left_limit_dec']); $smarty->assign("right_limit_dec", $pagenate_arr['right_limit_dec']); $smarty->assign("left_arrow_target", $pagenate_arr['left_arrow_target']); $smarty->assign("right_arrow_target", $pagenate_arr['right_arrow_target']); if($disp_tmpl == 'foods.tpl'){ $smarty->display('shop/02.tpl'); }else{ $smarty->display('shop/02_goods.tpl'); } include("../footer02.html"); # Add by T.Miura 2005/11/15 function pagenate($max_pagenum,$focus_pagenum){ $return_arr = array(); $return_arr['left_limit_number'] = 1; $return_arr['right_limit_number'] = 1; $return_arr['left_limit_dec'] = FALSE; $return_arr['right_limit_dec'] = FALSE; $return_arr['left_arrow_target'] = 0; $return_arr['right_arrow_target'] = 0; # 1+RIGHT_PAGE_NUM+LEFT_PAGE_NUM と総ページ数の比較 # 総ページ数が多い場合はさらに分岐 # 総ページ数が少ない場合は問答無用に全件表示 if( $max_pagenum > (1+RIGHT_PAGE_NUM+LEFT_PAGE_NUM) ){ # 現ページ-左側規定数 が1以下はスタートが1になる if( ($focus_pagenum-LEFT_PAGE_NUM) <= 1 ){ $return_arr['left_limit_number'] = 1; $return_arr['right_limit_number'] = 1+RIGHT_PAGE_NUM+LEFT_PAGE_NUM; }else{ $return_arr['left_limit_number'] = $focus_pagenum-LEFT_PAGE_NUM; # 現ページ+右規定数 がMAXより大きい時はMAXに制限 if( ($focus_pagenum+RIGHT_PAGE_NUM) >= $max_pagenum ){ # 制限した場合はその制限個数だけ左(小さい側の数字)の数字が増える $shift = ($focus_pagenum+RIGHT_PAGE_NUM) - $max_pagenum; # シフト分だけ左の開始ページ番号を小さくする(数を増やす) $return_arr['left_limit_number'] = $return_arr['left_limit_number'] - $shift; $return_arr['right_limit_number'] = $max_pagenum; }else{ $return_arr['right_limit_number'] = $focus_pagenum+RIGHT_PAGE_NUM; } } # 点々を判定 if($return_arr['left_limit_number'] > 1){ $return_arr['left_limit_dec'] = TRUE; // 点々付 } if($return_arr['right_limit_number'] < $max_pagenum){ $return_arr['right_limit_dec'] = TRUE; // 点々付 } }else{ # 総ページ数が規定数以下なので全部表示 $return_arr['left_limit_number'] = 1; $return_arr['right_limit_number'] = $max_pagenum; } # 矢印表示判定 if($focus_pagenum > 1){ $return_arr['left_arrow_target'] = $focus_pagenum-1; } if($focus_pagenum < $max_pagenum){ $return_arr['right_arrow_target'] = $focus_pagenum+1; } return $return_arr; } ?>