バージョン選択

フォーラム

メニュー

オンライン状況

87 人のユーザが現在オンラインです。 (80 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 87
もっと...

サイト内検索

機能要望 > フロント機能 > 規格で分けられた商品の価格表示

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
ゲスト
投稿日時: 2007/3/3 10:38
対応状況: −−−
規格で分けられた商品の価格表示
ECCUBEさんにはいつもお世話になっています。

ちょっとした要望なのですが、現在規格で分けられた詳細ページの商品の価格表示が少々みづらいのです。

例えば、
餅100g 500円、餅200g 1,000円、餅300g 1,500円
を規格別に登録すると、詳細ページでは、
価格(税込): 500~1,500 円
と表示され、餅200gの価格は表示すらされなく、カゴに入れるまで値段が分からないのです。

一覧表示ページなら気にならないのですが、詳細ページの商品価格表示は、
餅100g 500円
餅200g 1,000円
餅300g 1,500円
のように規格別にそれぞれ価格表示が出来ないものでしょうか?
habu
投稿日時: 2007/3/6 9:42
対応状況: −−−
長老
登録日: 2006/9/15
居住地:
投稿: 282
Re: 規格で分けられた商品の価格表示
ゲストさん

はじめまして。羽生と申します。

私の携わっていたプロジェクトでも同様の要望が出た事があり、
詳細ページの規格選択部分にそれぞれの価格を表示するようにしました。

http://www.kanagaki.co.jp/products/detail.php?product_id=872
(「商品を注文する:」の右側にある選択ボックスです)

一つの例として参考になれば幸いです。

持ち時間の関係上、取り急ぎ投稿しますが、
必要であれば該当部分のソースを提示致します。
ゲスト
投稿日時: 2007/3/6 11:13
対応状況: −−−
Re: 規格で分けられた商品の価格表示
羽生様、返信ありがとうございました。

カナガキさまの価格表示だと各規格ごとに表示されており、
とても分かりやすいですね。

もしお手数でなければ、該当部分のソースを教えていただけませんでしょうか。
habu
投稿日時: 2007/3/12 13:43
対応状況: −−−
長老
登録日: 2006/9/15
居住地:
投稿: 282
Re: 規格で分けられた商品の価格表示
羽生です。

遅くなってすみません。
以下の2ファイルに変更を加えています。
(eccube-1.0.1betaをベースにしています)

・html/user_data/templates/mypae/detail.tpl
・html/products/detail.php

参考になれば幸いです。

■html/user_data/templates/mypae/detail.tpl
コンボボックスを配置したい場所に、以下のコードを記述しています。
引用:

<!--{if $tpl_stock_find}-->
<select name="classcategory_id_mixed">
<!--{html_options options=$arrClassCat1_2}-->
</select>
<!--{/if }-->


■html/products/detail.php
引用:

<?php
/*
* Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*/

require_once("../require.php");
require_once(DATA_PATH . "include/page_layout.inc");

class LC_Page {
function LC_Page() {
/** 必ず指定する **/
global $arrSTATUS;
$this->arrSTATUS = $arrSTATUS;
global $arrSTATUS_IMAGE;
$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
global $arrDELIVERYDATE;
$this->arrDELIVERYDATE = $arrDELIVERYDATE;
global $arrRECOMMEND;
$this->arrRECOMMEND = $arrRECOMMEND;

//$this->tpl_mainpage="products/detail.tpl";

/*
session_start時のno-cacheヘッダーを抑制することで
「戻る」ボタン使用時の有効期限切れ表示を抑制する。
private-no-expire:クライアントのキャッシュを許可する。
*/
session_cache_limiter('private-no-expire');
}
}

$objPage = new LC_Page();
$objView = new SC_SiteView();
$objCustomer = new SC_Customer();
$objQuery = new SC_Query();

// ▽ADD SF)羽生
$objSiteInfo = new SC_SiteInfo;
// △ADD SF)羽生

// レイアウトデザインを取得
$objPage = sfGetPageLayout($objPage, false, "products/detail.php");

// パラメータ管理クラス
$objFormParam = new SC_FormParam();
// パラメータ情報の初期化
lfInitParam();
// POST値の取得
$objFormParam->setParam($_POST);

// ファイル管理クラス
$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
// ファイル情報の初期化
lfInitFile();

// 管理ページからの確認の場合は、非公開の商品も表示する。
if($_GET['admin'] == 'on') {
$where = "del_flg = 0";
} else {
$where = "del_flg = 0 AND status = 1";
}

if($_POST['mode'] != "") {
$tmp_id = $_POST['product_id'];
} else {
$tmp_id = $_GET['product_id'];
}

// 値の正当性チェック
if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {
sfDispSiteError(PRODUCT_NOT_FOUND);
}
// ログイン判定


if($objCustomer->isLoginSuccess()) {
//お気に入りボタン表示
$objPage->tpl_login = true;

$table = "dtb_customer_reading";
$where = "customer_id = ? ";
$arrval[] = $objCustomer->getValue('customer_id');
//顧客の閲覧商品数


$rpcnt = $objQuery->count($table, $where, $arrval);

//閲覧数が設定数以下
if ($rpcnt < CUSTOMER_READING_MAX){
//閲覧履歴に新規追加
lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
} else {
//閲覧履歴の中で一番古いものを削除して新規追加
$where = "customer_id = ? AND update_date = (SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ? ) ";
$arrval = array($objCustomer->getValue("customer_id"), $objCustomer->getValue("customer_id"));
//削除


$objQuery->delete($table, $where, $arrval);
//追加
lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
}
}


// 規格選択セレクトボックスの作成
$objPage = lfMakeSelect($objPage, $tmp_id);

// 商品IDをFORM内に保持する。
$objPage->tpl_product_id = $tmp_id;

// ▽ADD SF)羽生
// 商品の属するカテゴリIDを取得する


$objPage->category_id = sfGetCategoryId($tmp_id, "");
// 商品の属するカテゴリ名を取得する


//$objPage->category_name = GetFirstCat($objPage->category_id);
$conn = new SC_DBConn();
$objPage->category_name = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($objPage->category_id));
// △ADD SF)羽生

switch($_POST['mode']) {
case 'cart':
// 入力値の変換
$objFormParam->convParam();
$objPage->arrErr = lfCheckError();
if(count($objPage->arrErr) == 0) {
$objCartSess = new SC_CartSession();
// ▽CHG SF)羽生 統合版のセレクトボックスから規格を取得する


//$classcategory_id1 = $_POST['classcategory_id1'];
//$classcategory_id2 = $_POST['classcategory_id2'];
list($classcategory_id1, $classcategory_id2) = explode("-", $_POST['classcategory_id_mixed']);
gfPrintLog("[D]統合版セレクトボックスのパース:規格1 = " . $classcategory_id1);
gfPrintLog("[D]統合版セレクトボックスのパース:規格2 = " . $classcategory_id2);
// △CHG SF)羽生 統合版のセレクトボックスから規格を取得する



// 規格1が設定されていない場合


if(!$objPage->tpl_classcat_find1) {
$classcategory_id1 = '0';
}

// 規格2が設定されていない場合


if(!$objPage->tpl_classcat_find2) {
$classcategory_id2 = '0';
}

$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity'));

header("Location: " . URL_CART_TOP);

exit;
}
break;

default:
break;
}

$objQuery = new SC_Query();
// DBから商品情報を取得する。
$arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
$objPage->arrProduct = $arrRet[0];

// 商品情報を取得(メーカーと商品名)
$name = $objPage->arrProduct['name'];
$name = mb_ereg_replace(" ", " ", $name);

if(preg_match("/^(.+?)(\(.+?\)[ ]*)(.*$)/", $name, $matchs)){
$objPage->arrProducts['makername'] = $matchs[1];
$objPage->arrProducts['makername_jp'] = $matchs[2];
$objPage->arrProducts['productname'] = $matchs[3];
}else{
$objPage->arrProducts['makername'] = "";
$objPage->arrProducts['makername_jp'] = "";
$objPage->arrProducts['productname'] = $name;
}

// 購入制限数を取得
if($objPage->arrProduct['sale_unlimited'] == 1 || $objPage->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
$objPage->tpl_sale_limit = SALE_LIMIT_MAX;
} else {
$objPage->tpl_sale_limit = $objPage->arrProduct['sale_limit'];
}

// サブタイトルを取得
$arrFirstCat = GetFirstCat($arrRet[0]['category_id']);
$tpl_subtitle = $arrFirstCat['name'];
$objPage->tpl_subtitle = $tpl_subtitle;

// DBからのデータを引き継ぐ
$objUpFile->setDBFileList($objPage->arrProduct);
// ファイル表示用配列を渡す
$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
// 支払方法の取得
$objPage->arrPayment = lfGetPayment();
// 入力情報を渡す
$objPage->arrForm = $objFormParam->getFormParamList();
//レビュー情報の取得
$objPage->arrReview = lfGetReviewData($tmp_id);
// タイトルに商品名を入れる


$objPage->tpl_title = "商品詳細 ". $objPage->arrProduct["name"];
//オススメ商品情報表示
$objPage->arrRecommend = lfPreGetRecommendProducts($tmp_id);
//この商品を買った人はこんな商品も買っています
$objPage->arrRelateProducts = lfGetRelateProducts($tmp_id);

$objView->assignobj($objPage);
$objView->display(SITE_FRAME);
//-----------------------------------------------------------------------------------------------------------------------------------
/* ファイル情報の初期化 */
function lfInitFile() {
global $objUpFile;
$objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
$objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
$objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);
$objUpFile->addFile("詳細-サブ拡大画像$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
}
$objUpFile->addFile("商品比較画像", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT);
$objUpFile->addFile("商品詳細ファイル", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false);
}

/* 規格選択セレクトボックスの作成 */
function lfMakeSelect($objPage, $product_id) {
global $objPage;
$classcat_find1 = false;
$classcat_find2 = false;
// 在庫ありの商品の有無
$stock_find = false;

// 規格名一覧


$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
// 規格分類名一覧


$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
// 商品規格情報の取得
$arrProductsClass = lfGetProductsClass($product_id);

// 規格1クラス名の取得
$objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
// 規格2クラス名の取得
$objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];

// すべての組み合わせ数
$count = count($arrProductsClass);

$classcat_id1 = "";

$arrSele = array();
$arrList = array();

$list_id = 0;
$arrList[0] = "\tlist0 = new Array('選択してください'";
$arrVal[0] = "\tval0 = new Array(''";

for ($i = 0; $i < $count; $i++) {
// 在庫のチェック
if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
continue;
}

$stock_find = true;

// ▽ADD SF)羽生
// 統合版 規格セレクトボックス用配列


$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
$classcat_id1_2 = $classcat_id1 . "-" . $classcat_id2;

global $objSiteInfo;
$arrInfo = $objSiteInfo->data;
$taxin_price = sfPreTax($arrProductsClass[$i]['price02'], $arrInfo['tax'], $arrInfo['tax_rule']);

$arrSele1_2[$classcat_id1_2] = $arrClassCatName[$classcat_id1] . " " . $arrClassCatName[$classcat_id2] . " \\" . number_format($taxin_price) . "(税込) "; //←右端に全角スペースを付加したのは、コンボボックスを見易くするため
// △ADD SF)羽生

// 規格1のセレクトボックス用
if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
$arrList[$list_id].=");\n";
$arrVal[$list_id].=");\n";
$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
$arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
$list_id++;
}

// 規格2のセレクトボックス用
$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];

// セレクトボックス表示値
if($arrList[$list_id] == "") {
$arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'";
} else {
$arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
}

// セレクトボックスPOST値
if($arrVal[$list_id] == "") {
$arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'";
} else {
$arrVal[$list_id].= ", '".$classcat_id2."'";
}
}

$arrList[$list_id].=");\n";
$arrVal[$list_id].=");\n";

// 規格1
$objPage->arrClassCat1 = $arrSele;

// ▽ADD SF)羽生
// 規格1&2
$objPage->arrClassCat1_2 = $arrSele1_2;
// △ADD SF)羽生

$lists = "\tlists = new Array(";
$no = 0;

foreach($arrList as $val) {
$objPage->tpl_javascript.= $val;
if ($no != 0) {
$lists.= ",list".$no;
} else {
$lists.= "list".$no;
}
$no++;
}
$objPage->tpl_javascript.=$lists.");\n";

$vals = "\tvals = new Array(";
$no = 0;

foreach($arrVal as $val) {
$objPage->tpl_javascript.= $val;
if ($no != 0) {
$vals.= ",val".$no;
} else {
$vals.= "val".$no;
}
$no++;
}
$objPage->tpl_javascript.=$vals.");\n";

// 選択されている規格2ID
$objPage->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . $_POST['classcategory_id2'] . "');";

// 規格1が設定されている


if($arrProductsClass[0]['classcategory_id1'] != '0') {
$classcat_find1 = true;
}

// 規格2が設定されている


if($arrProductsClass[0]['classcategory_id2'] != '0') {
$classcat_find2 = true;
}

$objPage->tpl_classcat_find1 = $classcat_find1;
$objPage->tpl_classcat_find2 = $classcat_find2;
$objPage->tpl_stock_find = $stock_find;

return $objPage;
}

/* パラメータ情報の初期化 */
function lfInitParam() {
global $objFormParam;

$objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("個数", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
}

/* 商品規格情報の取得 */
function lfGetProductsClass($product_id) {
$arrRet = array();
if(sfIsInt($product_id)) {
// 商品規格取得
$objQuery = new SC_Query();
// ▽CHG SF)羽生 価格も取得するようにした
$col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, price02";
// △CHG SF)羽生
$table = "vw_product_class AS prdcls";
$where = "product_id = ?";
$objQuery->setorder("rank1 DESC, rank2 DESC");
$arrRet = $objQuery->select($col, $table, $where, array($product_id));
}
return $arrRet;
}

/* 登録済みオススメ商品の読み込み */
function lfPreGetRecommendProducts($product_id) {
$objQuery = new SC_Query();
$objQuery->setorder("rank DESC");
$arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
$max = count($arrRet);
$no = 0;
for($i = 0; $i < $max; $i++) {
$where = "del_flg = 0 AND product_id = ? AND status = 1";
$arrProductInfo = $objQuery->select("main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate", "vw_products_allclass AS allcls", $where, array($arrRet[$i]['recommend_product_id']));

if(count($arrProductInfo) > 0) {
$arrRecommend[$no] = $arrProductInfo[0];
$arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
$arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
$no++;
}
}
return $arrRecommend;
}

/* 入力内容のチェック */
function lfCheckError() {
global $objFormParam;
global $objPage;
// 入力データを渡す。
$arrRet = $objFormParam->getHashArray();
$objErr = new SC_CheckError($arrRet);
$objErr->arrErr = $objFormParam->checkError();

// 複数項目チェック
// ▽DEL SF)羽生 統合版のセレクトボックスから規格を取得する


// if ($objPage->tpl_classcat_find1) {
// $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK"));
// }
// if ($objPage->tpl_classcat_find2) {
// $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK"));
// }
// △DEL SF)羽生 統合版のセレクトボックスから規格を取得する



return $objErr->arrErr;
}

//閲覧履歴新規登録
function lfRegistReadingData($tmp_id, $customer_id){
$objQuery = new SC_Query;
$sqlval['customer_id'] = $customer_id;
$sqlval['reading_product_id'] = $tmp_id;
$sqlval['create_date'] = 'NOW()';
$sqlval['update_date'] = 'NOW()';
$objQuery->insert("dtb_customer_reading", $sqlval);
}

//この商品を買った人はこんな商品も買っています
function lfGetRelateProducts($tmp_id) {
$objQuery = new SC_Query;
//自動抽出
$objQuery->setorder("random()");
//表示件数の制限
$objQuery->setlimit(RELATED_PRODUCTS_MAX);
//検索条件


$col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate";
$from = "vw_products_allclass AS allcls ";
$where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
$arrval[] = $tmp_id;
//結果の取得
$arrProducts = $objQuery->select($col, $from, $where, $arrval);

return $arrProducts;
}

//商品ごとのレビュー情報を取得する


function lfGetReviewData($id) {
$objQuery = new SC_Query;
//商品ごとのレビュー情報を取得する


$col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment";
$from = "dtb_review";
$where = "del_flg = 0 AND status = 1 AND product_id = ? ";
$arrval[] = $id;
$arrReview = $objQuery->select($col, $from, $where, $arrval);
return $arrReview;
}

//支払方法の取得
//payment_id 1:クレジット 2:ショッピングローン
function lfGetPayment() {
$objQuery = new SC_Query;
$col = "payment_id, rule, payment_method";
$from = "dtb_payment";
$where = "del_flg = 0";
$order = "payment_id";
$objQuery->setorder($order);
$arrRet = $objQuery->select($col, $from, $where);
return $arrRet;
}

?>

pineray
投稿日時: 2007/3/16 18:10
対応状況: −−−
長老
登録日: 2006/9/9
居住地: 伊賀
投稿: 292
Re: 規格で分けられた商品の価格表示
羽生様

とても有用な情報を提供いただきありがとうございます。
僕のところでも使わせていただきます。

詳細ページのソースを参考にして、
一覧ページでも同様に統合版のセレクトボックスを
表示できるようにしてみました。

自分用のメモをかねて以下に変更箇所を記します。
といっても、詳細ページ用とほぼ同じなので、
異なっているところだけ。

統合版のセレクトボックスから規格を取得する部分
list($classcategory_id1, $classcategory_id2) = explode("-", $_POST[$classcategory_id. '_mixed']);


規格セレクトボックスの作成部分
// 規格1&2
$objPage->arrClassCat1_2[$product_id] = $arrSele1_2;


そして、list.tplの該当部分
<select name="classcategory_id<!--{$id}-->_mixed">
<!--{html_options options=$arrClassCat1_2[$id]}-->
</select>
ゲスト
投稿日時: 2008/3/25 18:03
対応状況: −−−
Re: 規格で分けられた商品の価格表示
私も利用させていただきました。ありがとうございます。
私の場合は、Ver.2.0で利用させていただいたので、少し読み替えました。
私以外にもVer.2.0で利用したいという方がいらっしゃると思いますので詳細ページ用のコードを提示します(間違い等がありましたらご指摘ください)。

■/user_data/templates/mypae/detail.tplの変更は、上記と同じです。

■/data/class/pages/products/LC_Page_Products_Detail.php


<?php
/*
 * This file is part of EC-CUBE
 *
 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
 *
 * http://www.lockon.co.jp/
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

// {{{ requires
require_once(CLASS_PATH . "pages/LC_Page.php");

/**
 * 商品詳細 のページクラス.
 *
 * @package Page
 * @author LOCKON CO.,LTD.
 * @version $Id:LC_Page_Products_Detail.php 15532 2007-08-31 14:39:46Z nanasess $
 */
class LC_Page_Products_Detail extends LC_Page {

    /** ステータス */
    var $arrSTATUS;

    /** ステータス画像 */
    var $arrSTATUS_IMAGE;

    /** 発送予定日 */
    var $arrDELIVERYDATE;

    /** おすすめレベル */
    var $arrRECOMMEND;

    /** フォームパラメータ */
    var $objFormParam;

    /** アップロードファイル */
    var $objUpFile;

    // }}}
    // {{{ functions

    /**
     * Page を初期化する.
     *
     * @return void
     */
    function init() {
        parent::init();
        $masterData = new SC_DB_MasterData_Ex();
        $this->arrSTATUS = $masterData->getMasterData("mtb_status");
        $this->arrSTATUS_IMAGE = $masterData->getMasterData("mtb_status_image");
        $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date");
        $this->arrRECOMMEND = $masterData->getMasterData("mtb_recommend");
    }

    /**
     * Page のプロセス.
     *
     * @return void
     */
    function process() {
        $objView = new SC_SiteView();
        $objCustomer = new SC_Customer();
        $objQuery = new SC_Query();
        $objDb = new SC_Helper_DB_Ex();
       

        // レイアウトデザインを取得
        $helper = new SC_Helper_PageLayout_Ex();
        $helper->sfGetPageLayout($this, false, "products/detail.php");

        // パラメータ管理クラス
        $this->objFormParam = new SC_FormParam();
        // パラメータ情報の初期化
        $this->lfInitParam();
        // POST値の取得
        $this->objFormParam->setParam($_POST);

        // ファイル管理クラス
        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
        // ファイル情報の初期化
        $this->lfInitFile();

        // 管理ページからの確認の場合は、非公開の商品も表示する。
        if(isset($_GET['admin']) && $_GET['admin'] == 'on') {
            SC_Utils_Ex::sfIsSuccess(new SC_Session());
            $status = true;
            $where = "del_flg = 0";
        } else {
            $status = false;
            $where = "del_flg = 0 AND status = 1";
        }

        if(isset($_POST['mode']) && $_POST['mode'] != "") {
            $tmp_id = $_POST['product_id'];
        } else {
            $tmp_id = $_GET['product_id'];
        }

        // 値の正当性チェック
        if(!SC_Utils_Ex::sfIsInt($_GET['product_id'])
                || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {
            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
        }
        // ログイン判定
        if($objCustomer->isLoginSuccess()) {
            //お気に入りボタン表示
            $this->tpl_login = true;

        /* 閲覧ログ機能は現在未使用

            $table = "dtb_customer_reading";
            $where = "customer_id = ? ";
            $arrval[] = $objCustomer->getValue('customer_id');
            //顧客の閲覧商品数
            $rpcnt = $objQuery->count($table, $where, $arrval);

            //閲覧数が設定数以下
            if ($rpcnt < CUSTOMER_READING_MAX){
                //閲覧履歴に新規追加
                lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
            } else {
                //閲覧履歴の中で一番古いものを削除して新規追加
                $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?";
                $old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id")));
                $where = "customer_id = ? AND update_date = ? ";
                $arrval = array($objCustomer->getValue("customer_id"), $old);
                //削除
                $objQuery->delete($table, $where, $arrval);
                //追加
                lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
            }
        */
        }


        // 規格選択セレクトボックスの作成
        $this->lfMakeSelect($tmp_id);

        // 商品IDをFORM内に保持する。
        $this->tpl_product_id = $tmp_id;
// 商品の属するカテゴリIDを取得する


$this->category_id = $objDb->sfGetCategoryId($tmp_id, "");
// 商品の属するカテゴリ名を取得する


$this->category_name = $objDb->sfGetFirstCat($this->category_id);
//$conn = new SC_DBConn();
//$objPage->category_name = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($objPage->category_id));

        if (!isset($_POST['mode'])) $_POST['mode'] = "";

        switch($_POST['mode']) {
        case 'cart':
            // 入力値の変換
            $this->objFormParam->convParam();
            $this->arrErr = $this->lfCheckError();
            if(count($this->arrErr) == 0) {
                $objCartSess = new SC_CartSession();
  //$classcategory_id1 = $_POST['classcategory_id1'];
//$classcategory_id2 = $_POST['classcategory_id2']; 
list($classcategory_id1, $classcategory_id2) = explode("-", $_POST['classcategory_id_mixed']);
GC_Utils::gfPrintLog("[D]統合版セレクトボックスのパース:規格1 = " . $classcategory_id1);
GC_Utils::gfPrintLog("[D]統合版セレクトボックスのパース:規格2 = " . $classcategory_id2); 

                // 規格1が設定されていない場合
                if(!$this->tpl_classcat_find1) {
                    $classcategory_id1 = '0';
                }

                // 規格2が設定されていない場合
                if(!$this->tpl_classcat_find2) {
                    $classcategory_id2 = '0';
                }

                $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
                $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
                $this->sendRedirect($this->getLocation(URL_CART_TOP));
                exit;
            }
            break;

        default:
            break;
        }

        $objQuery = new SC_Query();
        // DBから商品情報を取得する。
        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
        $this->arrProduct = $arrRet[0];

        // 商品コードの取得
        $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
        $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode);
        $this->arrProductCode = $arrProductCode["product_code"];

        // 購入制限数を取得
        if($this->arrProduct['sale_unlimited'] == 1 || $this->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
          $this->tpl_sale_limit = SALE_LIMIT_MAX;
        } else {
          $this->tpl_sale_limit = $this->arrProduct['sale_limit'];
        }
        // サブタイトルを取得
        $arrCategory_id = $objDb->sfGetCategoryId($arrRet[0]['product_id'], $status);
        $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
        $this->tpl_subtitle = $arrFirstCat['name'];

        // DBからのデータを引き継ぐ
        $this->objUpFile->setDBFileList($this->arrProduct);
        // ファイル表示用配列を渡す
        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true);
        // 支払方法の取得
        $this->arrPayment = $this->lfGetPayment();
        // 入力情報を渡す
        $this->arrForm = $this->objFormParam->getFormParamList();
        //レビュー情報の取得
        $this->arrReview = $this->lfGetReviewData($tmp_id);
        // トラックバック情報の取得

        // トラックバック機能の稼働状況チェック
        if (SC_Utils_Ex::sfGetSiteControlFlg(SITE_CONTROL_TRACKBACK) != 1) {
            $this->arrTrackbackView = "OFF";
        } else {
            $this->arrTrackbackView = "ON";
            $this->arrTrackback = $this->lfGetTrackbackData($tmp_id);
        }
        $this->trackback_url = TRACKBACK_TO_URL . $tmp_id;
        // タイトルに商品名を入れる
        $this->tpl_title = $this->arrProduct["name"];
        //オススメ商品情報表示
        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id);
        //この商品を買った人はこんな商品も買っています
        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id);

        // 拡大画像のウィンドウサイズをセット
        if (isset($this->arrFile["main_large_image"])) {
            $image_path = IMAGE_SAVE_DIR . basename($this->arrFile["main_large_image"]["filepath"]);
        } else {
            $image_path = "";
        }

        list($large_width, $large_height) = getimagesize($image_path);
        $this->tpl_large_width = $large_width + 60;
        $this->tpl_large_height = $large_height + 80;

        $this->lfConvertParam();

        $objView->assignobj($this);
        $objView->display(SITE_FRAME);
    }

    /**
     * デストラクタ.
     *
     * @return void
     */
    function destroy() {
        parent::destroy();
    }

    /**
     * モバイルページを初期化する.
     *
     * @return void
     */
    function mobileInit() {
        $this->init();
        $this->tpl_mainpage = "products/detail.tpl";
    }

    /**
     * Page のプロセス(モバイル).
     *
     * FIXME 要リファクタリング
     *
     * @return void
     */
    function mobileProcess() {
        $objView = new SC_MobileView();
        $objCustomer = new SC_Customer();
        $objQuery = new SC_Query();
        $objDb = new SC_Helper_DB_Ex();

        // パラメータ管理クラス
        $this->objFormParam = new SC_FormParam();
        // パラメータ情報の初期化
        $this->lfInitParam();
        // POST値の取得
        $this->objFormParam->setParam($_POST);

        // ファイル管理クラス
        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
        // ファイル情報の初期化
        $this->lfInitFile();

        if (!isset($_POST['mode'])) $_POST['mode'] = "";

        if(!empty($_POST['mode'])) {
            $tmp_id = $_POST['product_id'];
        } else {
            $tmp_id = $_GET['product_id'];
        }

        // ログイン判定
        if($objCustomer->isLoginSuccess(true)) {
            //お気に入りボタン表示
            $this->tpl_login = true;

            /* 閲覧ログ機能は現在未使用

               $table = "dtb_customer_reading";
               $where = "customer_id = ? ";
               $arrval[] = $objCustomer->getValue('customer_id');
               //顧客の閲覧商品数
               $rpcnt = $objQuery->count($table, $where, $arrval);

               //閲覧数が設定数以下
               if ($rpcnt < CUSTOMER_READING_MAX){
               //閲覧履歴に新規追加
               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
               } else {
               //閲覧履歴の中で一番古いものを削除して新規追加
               $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?";
               $old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id")));
               $where = "customer_id = ? AND update_date = ? ";
               $arrval = array($objCustomer->getValue("customer_id"), $old);
               //削除
               $objQuery->delete($table, $where, $arrval);
               //追加
               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
               }
            */
        }


        // 規格選択セレクトボックスの作成
        $this->lfMakeSelectMobile($this, $tmp_id);

        // 商品IDをFORM内に保持する。
        $this->tpl_product_id = $tmp_id;

        switch($_POST['mode']) {
        case 'select':
            // 規格1が設定されている場合
            if($this->tpl_classcat_find1) {
                // templateの変更
                $this->tpl_mainpage = "products/select_find1.tpl";
                break;
            }

        case 'select2':
            $this->arrErr = $this->lfCheckError();

            // 規格1が設定されている場合
            if($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) {
                // templateの変更
                $this->tpl_mainpage = "products/select_find1.tpl";
                break;
            }

            // 規格2が設定されている場合
            if($this->tpl_classcat_find2) {
                $this->arrErr = array();

                $this->tpl_mainpage = "products/select_find2.tpl";
                break;
            }

        case 'selectItem':
            $this->arrErr = $this->lfCheckError();

            // 規格1が設定されている場合
            if($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) {
                // templateの変更
                $this->tpl_mainpage = "products/select_find2.tpl";
                break;
            }
            // 商品数の選択を行う
            $this->tpl_mainpage = "products/select_item.tpl";
            break;

        case 'cart':
            // 入力値の変換
            $this->objFormParam->convParam();
            $this->arrErr = $this->lfCheckError();
            if(count($this->arrErr) == 0) {
                $objCartSess = new SC_CartSession();
                $classcategory_id1 = $_POST['classcategory_id1'];
                $classcategory_id2 = $_POST['classcategory_id2'];

                // 規格1が設定されていない場合
                if(!$this->tpl_classcat_find1) {
                    $classcategory_id1 = '0';
                }

                // 規格2が設定されていない場合
                if(!$this->tpl_classcat_find2) {
                    $classcategory_id2 = '0';
                }

                $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
                $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
                $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true);
                exit;
            }
            break;

        default:
            break;
        }

        $objQuery = new SC_Query();
        // DBから商品情報を取得する。
        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
        $this->arrProduct = $arrRet[0];

        // 商品コードの取得
        $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
        $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode);
        $this->arrProductCode = $arrProductCode["product_code"];

        // 購入制限数を取得
        if($this->arrProduct['sale_unlimited'] == 1 || $this->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
            $this->tpl_sale_limit = SALE_LIMIT_MAX;
        } else {
            $this->tpl_sale_limit = $this->arrProduct['sale_limit'];
        }

        // サブタイトルを取得
        $arrFirstCat = $objDb->sfGetFirstCat($arrRet[0]['category_id']);
        $tpl_subtitle = $arrFirstCat['name'];
        $this->tpl_subtitle = $tpl_subtitle;

        // DBからのデータを引き継ぐ
        $this->objUpFile->setDBFileList($this->arrProduct);
        // ファイル表示用配列を渡す
        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true);
        // 支払方法の取得
        $this->arrPayment = $this->lfGetPayment();
        // 入力情報を渡す
        $this->arrForm = $this->objFormParam->getFormParamList();
        //レビュー情報の取得
        $this->arrReview = $this->lfGetReviewData($tmp_id);
        // タイトルに商品名を入れる
        $this->tpl_title = "商品詳細 ". $this->arrProduct["name"];
        //オススメ商品情報表示
        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id);
        //この商品を買った人はこんな商品も買っています
        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id);

        // 拡大画像のウィンドウサイズをセット
        if (!empty($this->arrFile["main_large_image"])) {
            list($large_width, $large_height) = getimagesize(IMAGE_SAVE_DIR . basename($this->arrFile["main_large_image"]["filepath"]));
        }
        $this->tpl_large_width = isset($large_width) ? $large_width + 60 : 0;
        $this->tpl_large_height = isset($large_height) ? $large_height + 80 : 0;

        $objView->assignobj($this);
        $objView->display(SITE_FRAME);
    }

    /* ファイル情報の初期化 */
    function lfInitFile() {
        $this->objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
        $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
        $this->objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
        for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
            $this->objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);
            $this->objUpFile->addFile("詳細-サブ拡大画像$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
        }
        $this->objUpFile->addFile("商品比較画像", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT);
        $this->objUpFile->addFile("商品詳細ファイル", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false);
    }

    /* 規格選択セレクトボックスの作成 */
    function lfMakeSelect($product_id) {

        $objDb = new SC_Helper_DB_Ex();
        $classcat_find1 = false;
        $classcat_find2 = false;
        // 在庫ありの商品の有無
        $stock_find = false;

        // 規格名一覧
        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
        // 規格分類名一覧
        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
        // 商品規格情報の取得
        $arrProductsClass = $this->lfGetProductsClass($product_id);

        // 規格1クラス名の取得
        $this->tpl_class_name1 = isset($arrClassName[$arrProductsClass[0]['class_id1']])
                                        ? $arrClassName[$arrProductsClass[0]['class_id1']] : "";
        // 規格2クラス名の取得
        $this->tpl_class_name2 = isset($arrClassName[$arrProductsClass[0]['class_id2']])
                                        ? $arrClassName[$arrProductsClass[0]['class_id2']] : "";

        // すべての組み合わせ数
        $count = count($arrProductsClass);

        $classcat_id1 = "";

        $arrSele = array();
        $arrList = array();
        $arrPrice = array();
        $arrName = array();
$arrPrice2 = array();
$arrPoint = array();

        $list_id = 0;
        $arrList[0] = "\tlist0 = new Array('選択してください'";
        $arrVal[0] = "\tval0 = new Array(''";

        for ($i = 0; $i < $count; $i++) {
            // 在庫のチェック
            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
                continue;
            }

            $stock_find = true;
$objSiteInfo = new SC_SiteInfo;
// 店舗情報の取得
$arrInfo = $objSiteInfo->data;

$taxin_price = SC_Utils::sfPreTax($arrProductsClass[$i]['price02'], $arrInfo['tax'], $arrInfo['tax_rule']);

            // 規格1のセレクトボックス用
            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
                $arrList[$list_id].=");\n";
                $arrVal[$list_id].=");\n";
                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
                $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
                $classcat_id1_2 = $classcat_id1 . "-" . $classcat_id2;
                $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];


$arrSele1_2[$classcat_id1_2] = $arrClassCatName[$classcat_id1] . " " . $arrClassCatName[$classcat_id2] . " " . number_format($taxin_price) . "円(税込) "; //←右端に全角スペースを付加したのは、コンボボックスを見易くするため 
                $list_id++;
            }

            // 規格2のセレクトボックス用
            $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
                $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
                $classcat_id1_2 = $classcat_id1 . "-" . $classcat_id2;

// 規格別の価格と規格名を格納する処理
$arrPrice[$classcat_id1][$classcat_id2] = $arrProductsClass[$i]['price02'] ;
$arrPrice2[$classcat_id1][$classcat_id2] = $arrProductsClass[$i]['price01'] ;
$arrPoint[$classcat_id1][$classcat_id2] = $arrProductsClass[$i]['point_rate'] ;

if ($classcat_id2 == 0 )
   {
   // 規格2が設定されていない場合
   $arrName[$classcat_id1][$classcat_id2] = $arrProductsClass[$i]['name'] ;
   }
else
   {
   $arrName[$classcat_id1][$classcat_id2] = $arrProductsClass[$i]['name']."(".$arrProductsClass[$i]['name2'].")" ;
   }

$arrSele1_2[$classcat_id1_2] = $arrClassCatName[$classcat_id1] . " " . $arrClassCatName[$classcat_id2] . " " . number_format($taxin_price) . "円(税込) "; //←右端に全角スペースを付加したのは、コンボボックスを見易くするため 

            // セレクトボックス表示値
            if (!isset($arrList[$list_id])) $arrList[$list_id] = "";
            if($arrList[$list_id] == "") {
                $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'";
            } else {
                $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
            }

            // セレクトボックスPOST値
            if (!isset($arrVal[$list_id])) $arrVal[$list_id] = "";
            if($arrVal[$list_id] == "") {
                $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'";
            } else {
                $arrVal[$list_id].= ", '".$classcat_id2."'";
            }
        }

        $arrList[$list_id].=");\n";
        $arrVal[$list_id].=");\n";

        // 規格1
        $this->arrClassCat1 = $arrSele;
$this->arrClassCat1_2 = $arrSele1_2;
$this->arrClassPrice = $arrPrice;
$this->arrClassName = $arrName;
$this->arrClassPrice2 = $arrPrice2;
$this->arrClassPoint = $arrPoint;

        $lists = "\tlists = new Array(";
        $no = 0;

        foreach($arrList as $val) {
            $this->tpl_javascript.= $val;
            if ($no != 0) {
                $lists.= ",list".$no;
            } else {
                $lists.= "list".$no;
            }
            $no++;
        }
        $this->tpl_javascript.=$lists.");\n";

        $vals = "\tvals = new Array(";
        $no = 0;

        foreach($arrVal as $val) {
            $this->tpl_javascript.= $val;
            if ($no != 0) {
                $vals.= ",val".$no;
            } else {
                $vals.= "val".$no;
            }
            $no++;
        }
        $this->tpl_javascript.=$vals.");\n";

        // 選択されている規格2ID
        if (!isset($_POST['classcategory_id2'])) $_POST['classcategory_id2'] = "";
        $this->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . htmlspecialchars($_POST['classcategory_id2'], ENT_QUOTES) . "');";

        // 規格1が設定されている
        if($arrProductsClass[0]['classcategory_id1'] != '0') {
            $classcat_find1 = true;
        }

        // 規格2が設定されている
        if($arrProductsClass[0]['classcategory_id2'] != '0') {
            $classcat_find2 = true;
        }

        $this->tpl_classcat_find1 = $classcat_find1;
        $this->tpl_classcat_find2 = $classcat_find2;
        $this->tpl_stock_find = $stock_find;
    }

    /* 規格選択セレクトボックスの作成
     * FIXME 要リファクタリング
     */
    function lfMakeSelectMobile(&$objPage, $product_id) {

        $objDb = new SC_Helper_DB_Ex();
        $classcat_find1 = false;
        $classcat_find2 = false;
        // 在庫ありの商品の有無
        $stock_find = false;

        // 規格名一覧
        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
        // 規格分類名一覧
        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
        // 商品規格情報の取得
        $arrProductsClass = $this->lfGetProductsClass($product_id);

        // 規格1クラス名の取得
        $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
        // 規格2クラス名の取得
        $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];

        // すべての組み合わせ数
        $count = count($arrProductsClass);

        $classcat_id1 = "";

        $arrSele1 = array();
        $arrSele2 = array();

        for ($i = 0; $i < $count; $i++) {
            // 在庫のチェック
            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
                continue;
            }

            $stock_find = true;

            // 規格1のセレクトボックス用
            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
                $arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1];
            }

            // 規格2のセレクトボックス用
            if($arrProductsClass[$i]['classcategory_id1'] == $_POST['classcategory_id1'] and $classcat_id2 != $arrProductsClass[$i]['classcategory_id2']) {
                $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
                $arrSele2[$classcat_id2] = $arrClassCatName[$classcat_id2];
            }
        }

        // 規格1
        $objPage->arrClassCat1 = $arrSele1;
        $objPage->arrClassCat2 = $arrSele2;
$objPage->arrClassCat1_2 = $arrSele1_2;

        // 規格1が設定されている
        if($arrProductsClass[0]['classcategory_id1'] != '0') {
            $classcat_find1 = true;
        }

        // 規格2が設定されている
        if($arrProductsClass[0]['classcategory_id2'] != '0') {
            $classcat_find2 = true;
        }

        $objPage->tpl_classcat_find1 = $classcat_find1;
        $objPage->tpl_classcat_find2 = $classcat_find2;
        $objPage->tpl_stock_find = $stock_find;
    }

    /* パラメータ情報の初期化 */
    function lfInitParam() {
        $this->objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
        $this->objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
        $this->objFormParam->addParam("個数", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
    }

    /* 商品規格情報の取得 */
    function lfGetProductsClass($product_id) {
        $arrRet = array();
        if(SC_Utils_Ex::sfIsInt($product_id)) {
            // 商品規格取得
            $objQuery = new SC_Query();
            $col = "price02 , dtb_classcategory.name , price01 , point_rate , aaa.name AS name2 , product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
                $table = "vw_product_class AS prdcls , dtb_classcategory , dtb_classcategory AS aaa";
                $where = "classcategory_id1 =  dtb_classcategory.classcategory_id and classcategory_id2 =  aaa.classcategory_id and product_id = ?";
                $objQuery->setorder("rank1 DESC, rank2 DESC");
            $objQuery->setorder("rank1 DESC, rank2 DESC");
            $arrRet = $objQuery->select($col, $table, $where, array($product_id));
        }
        return $arrRet;
    }

    /* 登録済みオススメ商品の読み込み */
    function lfPreGetRecommendProducts($product_id) {
        $arrRecommend = array();
        $objQuery = new SC_Query();
        $objQuery->setorder("rank DESC");
        $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
        $max = count($arrRet);
        $no = 0;
        $from = "vw_products_allclass AS T1 "
                . " JOIN ("
                . " SELECT max(T2.rank) AS product_rank, "
                . "        T2.product_id"
                . "   FROM dtb_product_categories T2  "
                . " GROUP BY product_id) AS T3 USING (product_id)";
        $objQuery->setorder("product_rank DESC");
        for($i = 0; $i < $max; $i++) {
            $where = "del_flg = 0 AND T3.product_id = ? AND status = 1";
            $arrProductInfo = $objQuery->select("DISTINCT main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate, product_rank", $from, $where, array($arrRet[$i]['recommend_product_id']));

            if(count($arrProductInfo) > 0) {
                $arrRecommend[$no] = $arrProductInfo[0];
                $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
                $arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
                $no++;
            }
        }
        return $arrRecommend;
    }

    /* 入力内容のチェック */
    function lfCheckError() {
        // 入力データを渡す。
        $arrRet =  $this->objFormParam->getHashArray();
        $objErr = new SC_CheckError($arrRet);
        $objErr->arrErr = $this->objFormParam->checkError();

        // 複数項目チェック
//        if ($this->tpl_classcat_find1) {
//            $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK"));
//        }
//        if ($this->tpl_classcat_find2) {
//            $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK"));
//        }

      return $objErr->arrErr;
    }

    //閲覧履歴新規登録
    function lfRegistReadingData($tmp_id, $customer_id){
        $objQuery = new SC_Query;
        $sqlval['customer_id'] = $customer_id;
        $sqlval['reading_product_id'] = $tmp_id;
        $sqlval['create_date'] = 'NOW()';
        $sqlval['update_date'] = 'NOW()';
        $objQuery->insert("dtb_customer_reading", $sqlval);
    }

    //この商品を買った人はこんな商品も買っています FIXME
    function lfGetRelateProducts($tmp_id) {
        $objQuery = new SC_Query;
        //自動抽出
        $objQuery->setorder("random()");
        //表示件数の制限
        $objQuery->setlimit(RELATED_PRODUCTS_MAX);
        //検索条件
        $col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate";
        $from = "vw_products_allclass AS allcls ";
        $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
        $arrval[] = $tmp_id;
        //結果の取得
        $arrProducts = $objQuery->select($col, $from, $where, $arrval);

        return $arrProducts;
    }

    //商品ごとのレビュー情報を取得する
    function lfGetReviewData($id) {
        $objQuery = new SC_Query;
        //商品ごとのレビュー情報を取得する
        $col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment";
        $from = "dtb_review";
        $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . REVIEW_REGIST_MAX;
        $arrval[] = $id;
        $arrReview = $objQuery->select($col, $from, $where, $arrval);
        return $arrReview;
    }

    /*
     * 商品ごとのトラックバック情報を取得する
     *
     * @param $product_id
     * @return $arrTrackback
     */
    function lfGetTrackbackData($product_id) {

        $arrTrackback = array();

        $objQuery = new SC_Query;
        //商品ごとのトラックバック情報を取得する
        $col = "blog_name, url, title, excerpt, title, create_date";
        $from = "dtb_trackback";
        $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . TRACKBACK_VIEW_MAX;
        $arrval[] = $product_id;
        $arrTrackback = $objQuery->select($col, $from, $where, $arrval);
        return $arrTrackback;
    }

    //支払方法の取得
    //payment_id	1:クレジット 2:ショッピングローン
    function lfGetPayment() {
        $objQuery = new SC_Query;
        $col = "payment_id, rule, payment_method";
        $from = "dtb_payment";
        $where = "del_flg = 0";
        $order = "payment_id";
        $objQuery->setorder($order);
        $arrRet = $objQuery->select($col, $from, $where);
        return $arrRet;
    }

    function lfConvertParam() {
        if (!isset($this->arrForm['quantity']['value'])) $this->arrForm['quantity']['value'] = "";
        $value = $this->arrForm['quantity']['value'];
        $this->arrForm['quantity']['value'] = htmlspecialchars($value, ENT_QUOTES, CHAR_CODE);
    }
}

?>
CAT
投稿日時: 2008/3/31 18:02
対応状況: −−−
半人前
登録日: 2007/11/29
居住地:
投稿: 17
Re: 規格で分けられた商品の価格表示
羽生様
 当方のEC-CUBEでも使わせていただいています。
 とても有用な情報をありがとうございます。

pineray様
 pineray様の考えと同じく商品一覧でも統合セレクトボックスを出したいと思い、投稿内容を参考にしてソースを変更しておりますが上手く表示されません。

1番最後の商品の規格しか取得できない上、商品の購入が出来なくなってしまいまいどうも煮詰まっています。

もし宜しければ詳しいアドバイスをご教示お願いできませんでしょうか?
kvex2004
投稿日時: 2008/4/1 4:46
対応状況: −−−
長老
登録日: 2007/10/31
居住地: 埼玉
投稿: 218
Re: 規格で分けられた商品の価格表示
どのように変更したのか提示したほうがわかりやすいのでは無いでしょうか?
duckei
投稿日時: 2008/4/1 10:58
対応状況: −−−
半人前
登録日: 2008/3/19
居住地:
投稿: 23
Re: 規格で分けられた商品の価格表示
CAT様
横レス失礼します。
ECCUBEのバージョンはいくつをご利用でしょうか。
私は羽生様とpineray様のレスを見てver2.01の商品一覧で統合セレクトボックスを導入することができました。
もし2.01でしたらアドバイスできるかもしれません。
CAT
投稿日時: 2008/4/1 17:52
対応状況: −−−
半人前
登録日: 2007/11/29
居住地:
投稿: 17
Re: 規格で分けられた商品の価格表示
使用しているバージョンは1.45です。
あれから色々試してみて各商品のセレクトボックスに入るようになったのですが金額が“¥0−”固定になっています。
どうも金額の取得が出来ていないみたいです・・・・

当方で書き換えたソースを載せます。(皆様の書かれた内容の切り張りなので恐縮です)
ソース内の“引用 080331”、“コメント 080331”が追加/変更した箇所です。

list.tplの方はpineray様の書かれた内容そのままです。

どうかご存知の方がいらっしゃればアドバイスお願いします。引用:

<?php
/*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*/

require_once("../require.php");
require_once(DATA_PATH . "include/page_layout.inc");

class LC_Page {
function LC_Page() {
global $arrSTATUS;
$this->arrSTATUS = $arrSTATUS;
global $arrSTATUS_IMAGE;
$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
global $arrDELIVERYDATE;
$this->arrDELIVERYDATE = $arrDELIVERYDATE;
global $arrPRODUCTLISTMAX;
$this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX;
/*
session_start時のno-cacheヘッダーを抑制することで
「戻る」ボタン使用時の有効期限切れ表示を抑制する。
private-no-expire:クライアントのキャッシュを許可する。
*/
session_cache_limiter('private-no-expire');
}
}

$objPage = new LC_Page();
$conn = new SC_DBConn();

//表示件数の選択
if(sfIsInt($_POST['disp_number'])) {
$objPage->disp_number = $_POST['disp_number'];
} else {
//最小表示件数を選択
$objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX));
}

//表示順序の保存
$objPage->orderby = $_POST['orderby'];

// GETのカテゴリIDを元に正しいカテゴリIDを取得する。
$category_id = sfGetCategoryId("", $_GET['category_id']);

// タイトル編集
$tpl_subtitle = "";
if($_GET['mode'] == 'search'){
$tpl_subtitle = "検索結果";
}elseif ($category_id == "" ) {
$tpl_subtitle = "全商品";
}else{
$arrFirstCat = sfGetFirstCat($category_id);
$tpl_subtitle = $arrFirstCat['name'];
}

$objQuery = new SC_Query();
$count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id));

// ログイン判定
$objCustomer = new SC_Customer();
if($objCustomer->isLoginSuccess()) {
$objPage->tpl_login = true;
}

// ▽追加 080331
$objSiteInfo = new SC_SiteInfo;
// △追加 080331

// 以下の条件でBEST商品を表示する
// ・BEST最大数の商品が登録されている。
// ・カテゴリIDがルートIDである。
// ・検索モードでない。
if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) {
// 商品TOPの表示処理
/** 必ず指定する **/
$objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // メインテンプレート

$objPage->arrBestItems = sfGetBestProducts($conn, $category_id);
$objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2);
} else {
if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){
// 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す
$category_id = '';
}

// 商品一覧の表示処理
$objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']);

// 検索条件を画面に表示
// カテゴリー検索条件
if (strlen($_GET['category_id']) == 0) {
$arrSearch['category'] = "指定なし";
}else{
$arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));
$arrSearch['category'] = $arrCat;
}

// 商品名検索条件
if ($_GET['name'] === "") {
$arrSearch['name'] = "指定なし";
}else{
$arrSearch['name'] = $_GET['name'];
}
}

// レイアウトデザインを取得
$objPage = sfGetPageLayout($objPage, false, "products/list.php");

if($_POST['mode'] == "cart" && $_POST['product_id'] != "") {
// 値の正当性チェック
if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {
sfDispSiteError(PRODUCT_NOT_FOUND);
} else {
// 入力値の変換
$objPage->arrErr = lfCheckError($_POST['product_id']);
if(count($objPage->arrErr) == 0) {
$objCartSess = new SC_CartSession();
$classcategory_id = "classcategory_id". $_POST['product_id'];
$classcategory_id1 = $_POST[$classcategory_id. '_1'];
$classcategory_id2 = $_POST[$classcategory_id. '_2'];
$quantity = "quantity". $_POST['product_id'];

// ▽コメント化 080331

// // 規格1が設定されていない場合
// if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) {
// $classcategory_id1 = '0';
// }
// // 規格2が設定されていない場合
// if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) {
// $classcategory_id2 = '0';
// }

// △コメント化 080331

// ▽追加 080331
list($classcategory_id1, $classcategory_id2) = explode("-", $_POST[$classcategory_id. '_mixed']);
// △追加 080331

$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
header("Location: " . URL_CART_TOP);
exit;
}
}
}


$objPage->tpl_subtitle = $tpl_subtitle;

// 支払方法の取得
$objPage->arrPayment = lfGetPayment();
// 入力情報を渡す
$objPage->arrForm = $_POST;

lfConvertParam();

$objPage->category_id = $category_id;
$objPage->arrSearch = $arrSearch;

$objView = new SC_SiteView();
$objView->assignObj($objPage);
$objView->display(SITE_FRAME);
//-----------------------------------------------------------------------------------------------------------------------------------
/* カテゴリIDがルートかどうかの判定 */
function lfIsRootCategory($category_id) {
$objQuery = new SC_Query();
$level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id));
if($level == 1) {
return true;
}
return false;
}

/* 商品一覧の表示 */
function lfDispProductsList($category_id, $name, $disp_num, $orderby) {
global $objPage;
$objQuery = new SC_Query();
$objPage->tpl_pageno = $_POST['pageno'];

//表示件数でテンプレートを切り替える
$objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // メインテンプレート

//表示順序
switch($orderby) {
//価格順
case 'price':
$order = "price02_min ASC";
break;
//新着順
case 'date':
$order = "create_date DESC";
break;
default:
$order = "category_rank DESC, rank DESC";
break;
}

// 商品検索条件の作成(未削除、表示)
$where = "del_flg = 0 AND status = 1 ";
// カテゴリからのWHERE文字列取得
if ( $category_id ) {
list($tmp_where, $arrval) = sfGetCatWhere($category_id);
if($tmp_where != "") {
$where.= " AND $tmp_where";
}
}

// 商品名をwhere文に
$name = ereg_replace(",", "", $name);
if ( strlen($name) > 0 ){
$where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";
$ret = sfManualEscape($name);
$arrval[] = "%$ret%";
$arrval[] = "%$ret%";
}

// 行数の取得
$linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval);
$objPage->tpl_linemax = $linemax; // 何件が該当しました。表示用

// ページ送りの取得
$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);

$strnavi = $objNavi->strnavi;
$strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi);
$objPage->tpl_strnavi = $strnavi; // 表示文字列
$startno = $objNavi->start_row; // 開始行

// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($disp_num, $startno);
// 表示順序
$objQuery->setorder($order);

// 検索結果の取得
$objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval);

// 規格名一覧
$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
// 規格分類名一覧
$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
// 企画セレクトボックス設定
if($disp_num == 15) {
for($i = 0; $i < count($objPage->arrProducts); $i++) {
$objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
// 購入制限数を取得
$objPage = lfGetSaleLimit($objPage->arrProducts[$i]);
}
}

return $objPage;
}

/* 規格セレクトボックスの作成 */
function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) {
global $objPage;

$classcat_find1 = false;
$classcat_find2 = false;
// 在庫ありの商品の有無
$stock_find = false;

// 商品規格情報の取得
$arrProductsClass = lfGetProductsClass($product_id);

// ▽追加 080331
// 商品の属するカテゴリIDを取得する


$objPage->category_id = sfGetCategoryId($tmp_id, "");
// 商品の属するカテゴリ名を取得する


//$objPage->category_name = GetFirstCat($objPage->category_id);
$conn = new SC_DBConn();
$objPage->category_name = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($objPage->category_id));
// △追加 080331


// 規格1クラス名の取得
$objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']];
// 規格2クラス名の取得
$objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']];

// すべての組み合わせ数
$count = count($arrProductsClass);

$classcat_id1 = "";

$arrSele = array();
$arrList = array();

$list_id = 0;
$arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'";
$arrVal[0] = "\tval". $product_id. "_0 = new Array(''";

for ($i = 0; $i < $count; $i++) {
// 在庫のチェック
if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
continue;
}

$stock_find = true;

// 規格1のセレクトボックス用
if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
$arrList[$list_id].=");\n";
$arrVal[$list_id].=");\n";
$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
$arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
$list_id++;
}

// 規格2のセレクトボックス用
$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];

// セレクトボックス表示値
if($arrList[$list_id] == "") {
$arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'";
} else {
$arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
}

// セレクトボックスPOST値
if($arrVal[$list_id] == "") {
$arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";
} else {
$arrVal[$list_id].= ", '".$classcat_id2."'";
}

// ▽追加 080331
// 統合版 規格セレクトボックス用配列

$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
$classcat_id1_2 = $classcat_id1 . "-" . $classcat_id2;

global $objSiteInfo;
$arrInfo = $objSiteInfo->data;
$taxin_price = sfPreTax($arrProductsClass[$i]['price02'], $arrInfo['tax'], $arrInfo['tax_rule']);
$taxin_price = $arrProductsClass[$i]['price02'];

$arrSele1_2[$classcat_id1_2] = $arrClassCatName[$classcat_id1] . " " . $arrClassCatName[$classcat_id2] . " \\" . number_format($taxin_price) . "(税込) "; //←右端に全角スペースを付加したのは、コンボボックスを見易くするため
// △追加 080331

}

$arrList[$list_id].=");\n";
$arrVal[$list_id].=");\n";

// 規格1
$objPage->arrClassCat1[$product_id] = $arrSele;

// ▽追加 080331
$objPage->arrClassCat1_2[$product_id] = $arrSele1_2;
// △追加 080331

$lists = "\tlists".$product_id. " = new Array(";
$no = 0;
foreach($arrList as $val) {
$objPage->tpl_javascript.= $val;
if ($no != 0) {
$lists.= ",list". $product_id. "_". $no;
} else {
$lists.= "list". $product_id. "_". $no;
}
$no++;
}
$objPage->tpl_javascript.= $lists.");\n";

$vals = "\tvals".$product_id. " = new Array(";
$no = 0;
foreach($arrVal as $val) {
$objPage->tpl_javascript.= $val;
if ($no != 0) {
$vals.= ",val". $product_id. "_". $no;
} else {
$vals.= "val". $product_id. "_". $no;
}
$no++;
}
$objPage->tpl_javascript.= $vals.");\n";

// 選択されている規格2ID
$classcategory_id = "classcategory_id". $product_id;
$objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); ";

// 規格1が設定されている
if($arrProductsClass[0]['classcategory_id1'] != '0') {
$classcat_find1 = true;
}

// 規格2が設定されている
if($arrProductsClass[0]['classcategory_id2'] != '0') {
$classcat_find2 = true;
}

$objPage->tpl_classcat_find1[$product_id] = $classcat_find1;
$objPage->tpl_classcat_find2[$product_id] = $classcat_find2;
$objPage->tpl_stock_find[$product_id] = $stock_find;

return $objPage;
}
/* 商品規格情報の取得 */
function lfGetProductsClass($product_id) {
$arrRet = array();
if(sfIsInt($product_id)) {
// 商品規格取得
$objQuery = new SC_Query();
$col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
$table = "vw_product_class AS prdcls";
$where = "product_id = ?";
$objQuery->setorder("rank1 DESC, rank2 DESC");
$arrRet = $objQuery->select($col, $table, $where, array($product_id));
}
return $arrRet;
}

/* 入力内容のチェック */
function lfCheckError($id) {
global $objPage;

// 入力データを渡す。
$objErr = new SC_CheckError();

$classcategory_id1 = "classcategory_id". $id. "_1";
$classcategory_id2 = "classcategory_id". $id. "_2";
$quantity = "quantity". $id;

// 複数項目チェック
// ▽コメント080331
// if ($objPage->tpl_classcat_find1[$id]) {
// $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
// }
// if ($objPage->tpl_classcat_find2[$id]) {
// $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
// }
// $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
// △コメント080331

return $objErr->arrErr;
}

// 購入制限数の設定
function lfGetSaleLimit($product) {
global $objPage;
//在庫が無限または購入制限値が設定値より大きい場合
if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {
$objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;
} else {
$objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];
}

return $objPage;
}

//支払方法の取得
//payment_id 1:代金引換 2:銀行振り込み 3:現金書留
function lfGetPayment() {
$objQuery = new SC_Query;
$col = "payment_id, rule, payment_method";
$from = "dtb_payment";
$where = "del_flg = 0";
$order = "payment_id";
$objQuery->setorder($order);
$arrRet = $objQuery->select($col, $from, $where);
return $arrRet;
}

function lfconvertParam () {
global $objPage;

foreach ($objPage->arrForm as $key => $value) {
if (preg_match('/^quantity[0-9]+/', $key)) {
$objPage->arrForm[$key]
= htmlspecialchars($objPage->arrForm[$key], ENT_QUOTES, CHAR_CODE);
}
}
}
?>

(1) 2 »
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,856名です
総投稿数は109,989件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1291
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.