「[EC-CUBE]商品詳細ページで在庫数を別ウィンドウで表示する」の編集履歴(バックアップ)一覧に戻る
1. 在庫表示用PHPスクリプトの作成 2. 在庫表示用テンプレートの作成 3. 詳細ページからリンクを張る
* /html/products/stock.php * /data/class_extends/page_extends/products/LC_Page_Products_Stock_Ex.php * /data/class/pages/products/LC_Page_Products_Stock.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.
*/
* 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.
*/
* LC_Page_Products_Stock のページクラス(拡張).
*
* LC_Page_Products_Stock をカスタマイズする場合はこのクラスを編集する.
*
* @package Page
* @author ARATANA INC.
* @version $Id: LC_Page_Products_Stock_Ex.php 2008-05-13 22:41:55Z $
*/
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
parent::process();
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
* 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.
*/
* 在庫表示 のページクラス.
*
* @package Page
* @author ARATANA INC.
* @version $Id: LC_Page_Products_Stock.php 2008-05-13 22:32:27Z $
*/
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$this->tpl_mainpage = 'products/stock.tpl';
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
$objView = new SC_SiteView();
$objDb = new SC_Helper_DB_Ex();
// 管理ページからの確認の場合は、非公開の商品も表示する。
if(isset($_GET['admim']) && $_GET['admin'] == 'on') {
SC_Utils_Ex::sfIsSuccess(new SC_Session());
$where = "del_flg = 0";
} else {
$where = "del_flg = 0 AND status = 1";
}
// 値の正当性チェック
if(!SC_Utils_Ex::sfIsInt($_GET['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_GET['product_id'], $where)) {
SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
}
$objQuery = new SC_Query();
// 商品情報
$col = "t1.name, t2.product_code, t2.stock, t2.stock_unlimited, t2.price01, t2.price02, t2.classcategory_id1, t2.classcategory_id2, ";
$col .= "(SELECT name FROM dtb_classcategory WHERE classcategory_id = t2.classcategory_id1) AS classcategory1_name, (SELECT name FROM dtb_classcategory WHERE classcategory_id = t2.classcategory_id2) AS classcategory2_name, ";
$col .= "(SELECT rank FROM dtb_classcategory WHERE classcategory_id = t2.classcategory_id1) AS classcategory1_rank, (SELECT rank FROM dtb_classcategory WHERE classcategory_id = t2.classcategory_id2) AS classcategory2_rank";
$arrRet = $objQuery->select($col, "dtb_products AS t1, dtb_products_class AS t2", "t1.product_id = ? AND t1.product_id = t2.product_id ORDER BY classcategory1_rank DESC, classcategory2_rank DESC", array($_GET['product_id']));
// 選択している規格を抽出
$col = "class_id";
$arrSelectClass = $objQuery->select($col, "dtb_classcategory", "classcategory_id = ".$arrRet[0]['classcategory_id1']." OR classcategory_id = ".$arrRet[0]['classcategory_id2']);
$where = "";
if($arrSelectClass[1]['class_id']) {
$where = "class_id = '".$arrSelectClass[0]['class_id']."' OR class_id = ".$arrSelectClass[1]['class_id']. " ORDER BY rank DESC";