バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

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

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
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);
}
}
}
?>

フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   規格で分けられた商品の価格表示 ゲスト 2007/3/3 10:38
     Re: 規格で分けられた商品の価格表示 habu 2007/3/6 9:42
       Re: 規格で分けられた商品の価格表示 ゲスト 2007/3/6 11:13
         Re: 規格で分けられた商品の価格表示 habu 2007/3/12 13:43
           Re: 規格で分けられた商品の価格表示 pineray 2007/3/16 18:10
             Re: 規格で分けられた商品の価格表示 ゲスト 2008/3/25 18:03
               Re: 規格で分けられた商品の価格表示 パンくずナビが... gunpowder 2009/6/26 0:50
                 Re: 規格で分けられた商品の価格表示 パンくずナビが... mituki 2009/7/27 19:03
                   Re: 規格で分けられた商品の価格表示 パンくずナビが... miyu1219 2010/3/4 16:24
                   Re: 規格で分けられた商品の価格表示 パンくずナビが... sasami 2010/5/29 15:00
             Re: 規格で分けられた商品の価格表示 CAT 2008/3/31 18:02
               Re: 規格で分けられた商品の価格表示 kvex2004 2008/4/1 4:46
               Re: 規格で分けられた商品の価格表示 duckei 2008/4/1 10:58
             » Re: 規格で分けられた商品の価格表示 CAT 2008/4/1 17:52
                 Re: 規格で分けられた商品の価格表示 duckei 2008/4/3 8:38
                 解決しました(^^; CAT 2008/4/3 17:39

 



ログイン


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

統計情報

総メンバー数は89,027名です
総投稿数は110,020件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1296
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.