Source for file LC_Page_Admin_Contents_Recommend.php
Documentation is available at LC_Page_Admin_Contents_Recommend.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 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.
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Admin_Contents_Recommend.php 21185 2011-08-11 10:37:10Z shutta $
$this->tpl_mainpage = 'contents/recommend.tpl';
$this->tpl_mainno = 'contents';
$this->tpl_subno = 'recommend';
$this->tpl_maintitle = 'コンテンツ管理';
$this->tpl_subtitle = 'おすすめ商品管理';
$this->tpl_disp_max = RECOMMEND_NUM;
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$objFormParam->convParam();
switch ($this->getMode()) {
case 'regist': // 商品を登録する。
$arrPost = $objFormParam->getHashArray();
// 登録処理にエラーがあった場合は商品選択の時と同じ処理を行う。
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$member_id = $_SESSION['member_id'];
$this->checkRank = $arrPost['rank'];
$this->tpl_onload = "window.alert('編集が完了しました');";
case 'delete': // 商品を削除する。
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$this->tpl_onload = "window.alert('削除しました');";
case 'set_item': // 商品を選択する。
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr['rank']) && SC_Utils_Ex::isBlank($this->arrErr['product_id'])) {
$this->checkRank = $arrPost['rank'];
$this->category_id = intval($arrPost['category_id']);
$this->arrItems = $arrItems;
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList("level = 1");
* @param Object $objFormParam
$objFormParam->addParam("商品ID", "product_id", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("カテゴリID", "category_id", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("ランク", 'rank', INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("コメント", 'comment', LTEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
* 入力されたパラメーターのエラーチェックを行う。
* @param Object $objFormParam
$objErr = new SC_CheckError_Ex($objFormParam->getHashArray());
$objErr->arrErr = $objFormParam->checkError();
* @return Array $arrReturnProducts データベースに登録されているおすすめ商品の配列
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$col = 'dtb_products.name,dtb_products.main_list_image,dtb_best_products.*';
$table = 'dtb_best_products INNER JOIN dtb_products USING (product_id)';
$where = 'dtb_best_products.del_flg = 0';
$objQuery->setOrder($order);
$arrProducts = $objQuery->select($col, $table, $where);
$arrReturnProducts = array();
foreach( $arrProducts as $data ){
$arrReturnProducts[$data['rank']] = $data;
return $arrReturnProducts;
* @param Array $arrPost POSTの値を格納した配列
* @param Integer $member_id 登録した管理者を示すID
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$sqlval['product_id'] = $arrPost['product_id'];
$sqlval['category_id'] = $arrPost['category_id'];
$sqlval['rank'] = $arrPost['rank'];
$sqlval['comment'] = $arrPost['comment'];
$sqlval['creator_id'] = $member_id;
$sqlval['create_date'] = 'CURRENT_TIMESTAMP';
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$sqlval['best_id'] = $objQuery->nextVal('dtb_best_products_best_id');
$objQuery->insert("dtb_best_products", $sqlval);
* @param Array $arrPost POSTの値を格納した配列
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$table = 'dtb_best_products';
$where = 'category_id = ? AND rank = ?';
$arrval = array($arrPost['category_id'],$arrPost['rank']);
$objQuery->delete($table, $where, $arrval);
* @param Integer $product_id 商品ID
* @return Array $arrProduct 商品のデータを格納した配列
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$col = 'product_id,main_list_image,name';
$where = 'product_id = ? AND del_flg = 0';
$arrval = array($product_id);
$arrProduct = $objQuery->select($col, $table, $where, $arrval);
* @param Array $arrPost POSTのデータを格納した配列
* @param Array $arrItems フロントに表示される商品の情報を格納した配列
$arrProduct = $this->getProduct($arrPost['product_id']);
if (count($arrProduct) > 0) {
$rank = $arrPost['rank'];
foreach( $arrProduct as $key => $val){
$arrItems[$rank][$key] = $val;
$arrItems[$rank]['rank'] = $rank;
Documentation generated on Fri, 24 Feb 2012 14:01:11 +0900 by Seasoft
|