{$panlist}

HTML; $sql = "select * from shouhin_tb where s_code=? and public='on'". " order by registerday desc"; $stmt = exec_sql($sql,array("s_code"=>$_GET["n"])); if ($stmt->rowCount()<=0) { $str.="お探しの商品はありません"; return $str; } mb_regex_encoding(B_CODE); //正規表現に必要 $before_array = array("■","≪","≫","□","""); $after_array = array("
","≪","≫","×","'"); $b_p_array = array("

","

"); $a_p_array = array("",""); while($row=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { //サブ画像 $subimg = sub_img($row); //変更が必要なもの $g_main1 = str_replace($before_array,$after_array,html_entity_decode($row["g_main1"],ENT_QUOTES,'UTF-8')); $g_sub10 = str_replace($before_array,$after_array,html_entity_decode($row["g_sub10"],ENT_QUOTES,'UTF-8')); $pc_com = str_replace($b_p_array,$a_p_array,html_entity_decode($row["pc_com"],ENT_QUOTES,'UTF-8')); $com_up = str_replace($b_p_array,$a_p_array,html_entity_decode($row["com_up"],ENT_QUOTES,'UTF-8')); $com_dw = str_replace($b_p_array,$a_p_array,html_entity_decode($row["com_dw"],ENT_QUOTES,'UTF-8')); $s_size = str_replace($before_array,$after_array,html_entity_decode($row["s_size"],ENT_QUOTES,'UTF-8')); $detail = str_replace($before_array,$after_array,html_entity_decode($row["detail"],ENT_QUOTES,'UTF-8')); $s_sozai = str_replace($before_array,$after_array,html_entity_decode($row["s_sozai"],ENT_QUOTES,'UTF-8')); $teika = ($row["teika"]>0) ? number_format($row["teika"])."円(税込み)
" : ""; //価格の表示 $price = search_price($row); //送料区分 if ($row["non_sale"]!="on") { //非販売s $send = "非販売"; } elseif ($row["send1"]=="" && $row["send2"]=="") { $send = "お問い合わせください"; } else { //送料詳細を求める $send = info_send($row); } //納期 $nouki = info_nouki($row["nouki"]); //オプション $s_option = search_option($row,""); $s_option2 = search_option($row,"2"); //属性とカゴ $zokusei = get_zokusei($row); //エラー if ($_GET["e"]==1) { $errmsg = "商品の属性を選んでください"; } //ループをぬけたときように、IDを保存 $id_array[] = $row["s_id"]; //関連 $kanren.= (!empty($row["kanren"])) ? $row["kanren"] : ''; //whileから抜け出したときの保存 $url = URL; $ssl = SSL; $str.=<< {$row["s_name"]}

{$com_up}

{$g_main1}

{$pc_com}

品名 {$row["s_name"]}
品番 {$row["s_code"]}{$row["c_code"]}
サイズ {$s_size}
素材 {$s_sozai}
詳細 {$detail}
納期 {$nouki}
送料 {$send}
定価 {$teika}
価格 {$price}
{$s_option} {$s_option2} {$zokusei} {$subimg}
{$com_dw}
HTML; } //関連商品 // $str.= introduction_kanren($kanren); return $str; } /*------------------------------------------------------------ 関連 ------------------------------------------------------------*/ function introduction_kanren($data) { if (empty($data)) { return; } $title = "関連商品"; $slider = "slider4"; $left = ""; $right = ""; $array = explode(" ",$data); $sql = "select * from shouhin_tb where public = 'on' and ("; foreach($array as $key=>$val) { if (!empty($val)) { $sql.= ($key>0) ? " or ": ""; $sql.="concat(s_code,c_code) like '".trim($val)."'"; //半角が連続した時の対応 } } $sql.=")"; //debug($sql); $str=<<{$title}
{$right}
HTML; } $str.="
   
"; return $str; } /*------------------------------------------------------------ 送料詳細 ------------------------------------------------------------*/ function info_send($array) { global $S_kbn1; global $S_kbn2; $sql = "select g_name from s_group_tb order by g_id"; $stmt = query_sql($sql); if ($stmt->rowCount()<=0) { return; } while($row=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { $tmp[] = $row["g_name"]; } if (!empty($array["send1"])) { $send = "". $tmp[0]." ".$S_kbn1[$array["send1"]]."区分
"; } if (!empty($array["send2"])) { $send.= "". $tmp[1]." ".$S_kbn2[$array["send2"]]."区分"; } return $send; } /*------------------------------------------------------------ 商品の価格表示 ------------------------------------------------------------*/ function search_price($row) { $price = number_format($row["price"]); if ($row["non_sale"]!='on') { $str=<<非売品 HTML; } if ($row["zaiko"]!=='' && $row["zaiko"]<1) { $str=<<SOLD HTML; } //セールかどうか if ($row["sale_flg"]=="on" && ($row["sale_start"]<=date("Y-m-d h:i:00")) && ($row["sale_end"]>=date("Y-m-d h:i:00"))) { $sale_flg = TRUE; $original = "".$price."円"; //セール $end = strtotime($row["sale_end"]); $sale = "
セール期間".date("Y",$end)."年".date("m月d日",$end)."まで"; $price = ($row["nebiki"]>0) ? number_format(floor($row["price"]*$row["nebiki"])) : number_format($row["sale"]); $str=<<{$price}円(税込み){$sale}  HTML; } else { $str=<<{$price}円(税込み) HTML; } return $str; } /*------------------------------------------------------------ 商品サブ画像 8個 2から8の画像 ------------------------------------------------------------*/ function sub_img($array) { mb_regex_encoding(B_CODE); //正規表現に必要 $before_array = array("■","≪","≫","/BR/"); $after_array = array("
","≪","≫",""); $str=<<
HTML; for ($i=2; $i

{$array["g_sub$i"]}

HTML; } } $str.=<<
HTML; for ($i=3; $i

{$array["g_sub$i"]}

HTML; } } $str.="
"; return $str; } /*------------------------------------------------------------ 同一カテゴリー ------------------------------------------------------------*/ function introduction_category($array) { $title = "カテゴリー商品"; //登録されているカテゴリーを探す foreach($array as $val) { $sql = "select sc_id from s_category_tb where ss_id = '".$val."'"; $stmt = query_sql($sql); if ($stmt->rowCount() <= 0) { return; } while($rowc=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { $tmp[] = $rowc["sc_id"]; } } $c_array = array_unique($tmp); $str=<<{$title}
    HTML; foreach($c_array as $val) { $sql = "select * from s_category_tb,shouhin_tb ". "where sc_id = '".$val."' and s_id = ss_id and public='on' order by rand()"; $stmt = query_sql($sql); if (($total+=$stmt->rowCount()) <= 0) { return; } while($row=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { $price = info_price($row); $str.=<<

    {$row["s_name"]}
    {$price}
    HTML; } } $str.=<<
HTML; if ($total>4) { $str.=<<
HTML; } $str.="
   
"; return $str; } /*------------------------------------------------------------ ブランド(シリーズ),新着 ------------------------------------------------------------*/ function introduction_product($type,$id) { if ($type=="new") { $title = "オススメ商品"; $slider = "slider3"; $left = ""; $right = ""; $sql = "select * from category_tb where category like '%". mb_convert_encoding("新着アイテム","UTF-8","SJIS")."%'"; $stmt = query_sql($sql); if ($stmt->rowCount() > 0) { $rowc=db_to_html($stmt->fetch(PDO::FETCH_ASSOC)); $sql = "select * from shouhin_tb,s_category_tb where sc_id = '".$rowc["s_id"]."'". " and public='on' and s_id = ss_id order by registerday desc"; } } else { if ($id=="") { return; } $left = ""; $right = ""; $slider = "slider1"; $sql = "select * from shouhin_tb where public = 'on' and ".$type." = '".$id."' order by rand()"; $title = "シリーズ商品"; } $str=<<{$title}
{$right}
HTML; } $str.="
   
"; return $str; } /*------------------------------------------------------------ 商品オプション ------------------------------------------------------------*/ function search_option($row,$flg) { if ($row["option_name".$flg]=="") { return; } $array = explode("//",$row["s_option".$flg]); $list=<< HTML; return $list; } /*------------------------------------------------------------ パンくずリスト ------------------------------------------------------------*/ function pankuzu() { $sql = "select * from shouhin_tb where s_code=? group by s_code"; $stmt = exec_sql($sql,array("s_code"=>$_GET["n"])); if ($stmt->rowCount()<=0) { return; } $rows=db_to_html($stmt->fetch(PDO::FETCH_ASSOC)); $sname = $rows["s_name"]; $sql = "select category,s_id,hierarchy,o_id from s_category_tb,category_tb ". "where sc_id = s_id and ss_id = '".$rows["s_id"]."'"; $stmt = query_sql($sql); if ($stmt->rowCount()<=0) { return; } //複数カテゴリに対応 while($row=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { $rowc = $row; $tmp = array(); $tmp[] = "".$row["category"]." > "; //親をサーチ while ($rowc["hierarchy"]>1) { $rowc = get_pdo("category_tb","*",array("s_id"=>$rowc["o_id"])); $tmp[] = "".$rowc["category"]." > "; } //配列を逆にする $pan = array_reverse($tmp); $list[] = implode("",$pan).$sname; } $str = implode("
",$list); return "トップ > ".$str; } /*------------------------------------------------------------ 属性 ------------------------------------------------------------*/ function get_zokusei($row) { $ssl = SSL; $zaiko_flg = FALSE; //属性なし if ($row["tate"]==="" && $row["yoko"]==="") { return only_zaiko($row); } //属性がある $stmt = query_sql("select * from zokusei_tb where o_id='".$row["s_id"]."' order by z_id"); while($rowz=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { $code[$rowz["z_type"]][$rowz["z_id"]] = $rowz["z_code"]; $name[$rowz["z_type"]][$rowz["z_id"]] = $rowz["z_name"]; } //在庫の確認 $stmt = query_sql("select * from zaiko_tb where oz_id='".$row["s_id"]."' order by z_id"); while($rowa=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) { $zaiko[$rowa["t_id"]][$rowa["y_id"]] = $rowa["zaiko"]; if ($rowa["zaiko"]==="" || $rowa["zaiko"]>0) { $zaiko_flg = TRUE; } } if ($row["yoko"]==="") { //1次元 $str=<< HTML; } else { //テーブル表 $str=<< HTML; } else { //2次元テーブル $str=<<"; } if ($zaiko_flg) { //在庫あり $str.=<<
  • HTML; } else { $str.=<<
{$row["option_name".$flg]}
{$row["tate"]} HTML; if ($row["z_disp"]=="select") { //select表示 $str.="
HTML; foreach($code["tate"] as $key=>$val) { $su = ($zaiko[$key][0]>0 || $zaiko[$key][0]=="") ? "" : "×"; $str.=<< HTML; } $str.=<< HTML; } if ($zaiko_flg) { //在庫あり $str.=<<
  • HTML; } else { //在庫なし $str.=<<
属性購入
{$name["tate"][$key]} ({$val}) {$su}
あいにく在庫を切らしております
    HTML; } $str.=<< メンバー登録
  • 商品の問い合わせ
HTML; return $str; } //2次元 $str=<<
{$row["tate"]}/{$row["yoko"]} HTML; if ($row["z_disp"]=="select") { $str.="
HTML; foreach($code["yoko"] as $key2=>$val2) { $str.=<<{$name["yoko"][$key2]}({$val2}) HTML; } $str.=""; foreach($code["tate"] as $key=>$val) { $str.=""; foreach($code["yoko"] as $key2=>$val2) { if ($zaiko[$key][$key2]<1) { $str.=""; } else { $str.=<< HTML; } } $str.=""; } $str.="
属性
".$name["tate"][$key]."(".$val.")×
あいにく在庫を切らしております
    HTML; } $str.=<< メンバー登録
  • 商品の問い合わせ
HTML; return $str; } /*------------------------------------------------------------ 属性なし 単品在庫の場合 ------------------------------------------------------------*/ function only_zaiko($row) { $ssl = SSL; //単品在庫がない if ($row["zaiko"]!=='' && $row["zaiko"]<1) { $str=<< あいにく在庫を切らしております
    HTML; } //非販売 elseif ($row["non_sale"]!=='on') { $str=<< 非販売商品です。お問合せください。
    HTML; } //在庫あれば else { $str.=<< 数量
  • HTML; } $str.=<< メンバー登録
  • 商品の問い合わせ
HTML; return $str; } /*------------------------------------------------------------ 納期に関する説明文章 ------------------------------------------------------------*/ function info_nouki($n_id) { if ($n_id=="") { return; } $row = get_pdo("nouki_tb","com",array("n_id"=>$n_id)); $result = ($row["com"]!="") ? $row["com"] : ""; return $result; } ?>