
デフォルトで存在する商品一覧ページ(html/products/list.php)で、メーカー一覧ページとしても機能するようになっているので、
あまり必要ないのですが、まー何となくブログのネタとして作ってみました。
基本的には、商品一覧ページを丸々コピって、ちょこちょこっと直しただけです。
html/products/maker.php?maker_id=xx で、PC用メーカー一覧ページが表示できるようにします。
1.html/products/maker.php を以下のコードで作成
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2012 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 '../require.php';
require_once CLASS_EX_REALDIR . 'page_extends/products/LC_Page_Products_Maker_Ex.php';
// }}}
// {{{ generate page
$objPage = new LC_Page_Products_Maker_Ex();
register_shutdown_function(array($objPage, 'destroy'));
$objPage->init();
$objPage->process();
2.data/class_extends/page_extends/products/LC_Page_Products_Maker_Ex.php を以下のコードで作成
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2012 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_REALDIR . 'pages/products/LC_Page_Products_Maker.php';
/**
* LC_Page_Products_Maker のページクラス(拡張).
*
* LC_Page_Products_Maker をカスタマイズする場合はこのクラスを編集する.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Products_Maker_Ex.php 2012-10-20 07:37:01Z fukap $
*/
class LC_Page_Products_maker_Ex extends LC_Page_Products_Maker {
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
parent::process();
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
3.data/class/pages/products/LC_Page_Products_Maker.php を以下のコードで作成
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2012 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_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
/**
* メーカー一覧 のページクラス.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Products_List.php 2012-10-20 17:51:28Z fukap $
*/
class LC_Page_Products_Maker extends LC_Page_Ex {
// {{{ properties
/** テンプレートクラス名1 */
var $tpl_class_name1 = array();
/** テンプレートクラス名2 */
var $tpl_class_name2 = array();
/** JavaScript テンプレート */
var $tpl_javascript;
var $orderby;
var $mode;
/** 検索条件(内部データ) */
var $arrSearchData = array();
/** 検索条件(表示用) */
var $arrSearch = array();
var $tpl_subtitle = '';
/** ランダム文字列 **/
var $tpl_rnd = '';
// }}}
// {{{ 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->arrPRODUCTLISTMAX = $masterData->getMasterData('mtb_product_list_max');
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
parent::process();
$this->action();
$this->sendResponse();
}
/**
* Page のAction.
*
* @return void
*/
function action() {
$objProduct = new SC_Product_Ex();
$this->arrForm = $_REQUEST;//時間が無いのでコレで勘弁してください。 tao_s
//modeの取得
$this->mode = $this->getMode();
//表示条件の取得
$this->arrSearchData = array(
'category_id' => $this->lfGetCategoryId(intval($this->arrForm['category_id'])),
'maker_id' => intval($this->arrForm['maker_id']),
'name' => $this->arrForm['name']
);
$this->orderby = $this->arrForm['orderby'];
//ページング設定
$this->tpl_pageno = $this->arrForm['pageno'];
$this->disp_number = $this->lfGetDisplayNum($this->arrForm['disp_number']);
// 画面に表示するサブタイトルの設定
$this->tpl_subtitle = $this->lfGetPageTitle($this->mode, $this->arrSearchData['maker_id']);
// 画面に表示する検索条件を設定
$this->arrSearch = $this->lfGetSearchConditionDisp($this->arrSearchData);
// 商品一覧データの取得
$arrSearchCondition = $this->lfGetSearchCondition($this->arrSearchData);
$this->tpl_linemax = $this->lfGetProductAllNum($arrSearchCondition);
$urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
// モバイルの場合に検索条件をURLの引数に追加
if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
$searchNameUrl = urlencode(mb_convert_encoding($this->arrSearchData['name'], 'SJIS-win', 'UTF-8'));
$urlParam .= "&mode={$this->mode}&name={$searchNameUrl}&orderby={$this->orderby}";
}
$this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'fnNaviPage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
$this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct);
switch ($this->getMode()) {
case 'json':
$this->doJson($objProduct);
break;
default:
$this->doDefault($objProduct);
break;
}
$this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
/**
* カテゴリIDの取得
*
* @return integer カテゴリID
*/
function lfGetCategoryId($category_id) {
// 指定なしの場合、0 を返す
if (empty($category_id)) return 0;
// 正当性チェック
if (!SC_Utils_Ex::sfIsInt($category_id)
|| SC_Utils_Ex::sfIsZeroFilling($category_id)
|| !SC_Helper_DB_Ex::sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')
) {
SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
}
// 指定されたカテゴリIDを元に正しいカテゴリIDを取得する。
$arrCategory_id = SC_Helper_DB_Ex::sfGetCategoryId('', $category_id);
if (empty($arrCategory_id)) {
SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
}
return $arrCategory_id[0];
}
/* 商品一覧の表示 */
function lfGetProductsList($searchCondition, $disp_number, $startno, $linemax, &$objProduct) {
$arrOrderVal = array();
$objQuery =& SC_Query_Ex::getSingletonInstance();
// 表示順序
switch ($this->orderby) {
// 販売価格が安い順
case 'price':
$objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC');
break;
// 新着順
case 'date':
$objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC');
break;
default:
if (strlen($searchCondition['where_category']) >= 1) {
$dtb_product_categories = '(SELECT * FROM dtb_product_categories WHERE '.$searchCondition['where_category'].')';
$arrOrderVal = $searchCondition['arrvalCategory'];
} else {
$dtb_product_categories = 'dtb_product_categories';
}
$order = <<< __EOS__
(
SELECT
T3.rank * 2147483648 + T2.rank
FROM
$dtb_product_categories T2
JOIN dtb_category T3
ON T2.category_id = T3.category_id
WHERE T2.product_id = alldtl.product_id
ORDER BY T3.rank DESC, T2.rank DESC
LIMIT 1
) DESC
,product_id DESC
__EOS__;
$objQuery->setOrder($order);
break;
}
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setLimitOffset($disp_number, $startno);
$objQuery->setWhere($searchCondition['where']);
// 表示すべきIDとそのIDの並び順を一気に取得
$arrProductId = $objProduct->findProductIdsOrder($objQuery, array_merge($searchCondition['arrval'], $arrOrderVal));
$objQuery =& SC_Query_Ex::getSingletonInstance();
$arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
// 規格を設定
$objProduct->setProductsClassByProductIds($arrProductId);
$arrProducts['productStatus'] = $objProduct->getProductStatus($arrProductId);
return $arrProducts;
}
/* 入力内容のチェック */
function lfCheckError($product_id, &$arrForm, $tpl_classcat_find1, $tpl_classcat_find2) {
// 入力データを渡す。
$objErr = new SC_CheckError_Ex($arrForm);
// 複数項目チェック
if ($tpl_classcat_find1[$product_id]) {
$objErr->doFunc(array('規格1', 'classcategory_id1', INT_LEN), array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
}
if ($tpl_classcat_find2[$product_id]) {
$objErr->doFunc(array('規格2', 'classcategory_id2', INT_LEN), array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
}
$objErr->doFunc(array('商品規格ID', 'product_class_id', 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'));
return $objErr->arrErr;
}
/**
* パラメーターの読み込み
*
* @return void
*/
function lfGetDisplayNum($display_number) {
// 表示件数
return (SC_Utils_Ex::sfIsInt($display_number))
? $display_number
: current(array_keys($this->arrPRODUCTLISTMAX));
}
/**
* ページタイトルの設定
*
* @return str
*/
function lfGetPageTitle($mode, $maker_id = 0) {
if ($mode == 'search') {
return '検索結果';
} elseif ($maker_id == 0) {
return '全商品';
} else {
$objQuery = SC_Query_Ex::getSingletonInstance();
$arrMaker = $objQuery->getCol('name as maker_name', 'dtb_maker', 'maker_id = ?', array($maker_id));
return $arrMaker[0];
}
}
/**
* 表示用検索条件の設定
*
* @return array
*/
function lfGetSearchConditionDisp($arrSearchData) {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$arrSearch = array('category' => '指定なし', 'maker' => '指定なし', 'name' => '指定なし');
// カテゴリ検索条件
if ($arrSearchData['category_id'] > 0) {
$arrSearch['category'] = $objQuery->get('category_name', 'dtb_category', 'category_id = ?', array($arrSearchData['category_id']));
}
// メーカー検索条件
if (strlen($arrSearchData['maker_id']) > 0) {
$arrSearch['maker'] = $objQuery->get('name', 'dtb_maker', 'maker_id = ?', array($arrSearchData['maker_id']));
}
// 商品名検索条件
if (strlen($arrSearchData['name']) > 0) {
$arrSearch['name'] = $arrSearchData['name'];
}
return $arrSearch;
}
/**
* 該当件数の取得
*
* @return int
*/
function lfGetProductAllNum($searchCondition) {
// 検索結果対象となる商品の数を取得
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objQuery->setWhere($searchCondition['where_for_count']);
$objProduct = new SC_Product_Ex();
return $objProduct->findProductCount($objQuery, $searchCondition['arrval']);
}
/**
* 検索条件のwhere文とかを取得
*
* @return array
*/
function lfGetSearchCondition($arrSearchData) {
$searchCondition = array(
'where' => '',
'arrval' => array(),
'where_category' => '',
'arrvalCategory' => array()
);
// カテゴリからのWHERE文字列取得
if ($arrSearchData['category_id'] != 0) {
list($searchCondition['where_category'], $searchCondition['arrvalCategory']) = SC_Helper_DB_Ex::sfGetCatWhere($arrSearchData['category_id']);
}
// ▼対象商品IDの抽出
// 商品検索条件の作成(未削除、表示)
$searchCondition['where'] = 'alldtl.del_flg = 0 AND alldtl.status = 1 ';
if (strlen($searchCondition['where_category']) >= 1) {
$searchCondition['where'] .= ' AND EXISTS (SELECT * FROM dtb_product_categories WHERE ' . $searchCondition['where_category'] . ' AND product_id = alldtl.product_id)';
$searchCondition['arrval'] = array_merge($searchCondition['arrval'], $searchCondition['arrvalCategory']);
}
// 商品名をwhere文に
$name = $arrSearchData['name'];
$name = str_replace(',', '', $name);
// 全角スペースを半角スペースに変換
$name = str_replace(' ', ' ', $name);
// スペースでキーワードを分割
$names = preg_split('/ +/', $name);
// 分割したキーワードを一つずつwhere文に追加
foreach ($names as $val) {
if (strlen($val) > 0) {
$searchCondition['where'] .= ' AND ( alldtl.name ILIKE ? OR alldtl.comment3 ILIKE ?) ';
$searchCondition['arrval'][] = "%$val%";
$searchCondition['arrval'][] = "%$val%";
}
}
// メーカーらのWHERE文字列取得
if ($arrSearchData['maker_id']) {
$searchCondition['where'] .= ' AND alldtl.maker_id = ? ';
$searchCondition['arrval'][] = $arrSearchData['maker_id'];
}
$searchCondition['where_for_count'] = $searchCondition['where'];
// 在庫無し商品の非表示
if (NOSTOCK_HIDDEN) {
$searchCondition['where'] .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = alldtl.product_id AND del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))';
$searchCondition['where_for_count'] .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = alldtl.product_id AND del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))';
}
return $searchCondition;
}
/**
* カートに入れる商品情報にエラーがあったら戻す
*
* @return str
*/
function lfSetSelectedData(&$arrProducts, $arrForm, $arrErr, $product_id) {
$js_fnOnLoad = '';
foreach ($arrProducts as $key => $value) {
if ($arrProducts[$key]['product_id'] == $product_id) {
$arrProducts[$key]['product_class_id'] = $arrForm['product_class_id'];
$arrProducts[$key]['classcategory_id1'] = $arrForm['classcategory_id1'];
$arrProducts[$key]['classcategory_id2'] = $arrForm['classcategory_id2'];
$arrProducts[$key]['quantity'] = $arrForm['quantity'];
$arrProducts[$key]['arrErr'] = $arrErr;
$js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProducts[$key]['product_id']}, '{$arrForm['classcategory_id2']}');";
}
}
return $js_fnOnLoad;
}
/**
* カートに商品を追加
*
* @return void
*/
function lfAddCart($arrForm, $referer) {
$product_class_id = $arrForm['product_class_id'];
$objCartSess = new SC_CartSession_Ex();
$objCartSess->addProduct($product_class_id, $arrForm['quantity']);
}
/**
* 商品情報配列に商品ステータス情報を追加する
*
* @param Array $arrProducts 商品一覧情報
* @param Array $arrStatus 商品ステータス配列
* @param Array $arrStatusImage スタータス画像配列
* @return Array $arrProducts 商品一覧情報
*/
function setStatusDataTo($arrProducts, $arrStatus, $arrStatusImage) {
foreach ($arrProducts['productStatus'] as $product_id => $arrValues) {
for ($i = 0; $i < count($arrValues); $i++) {
$product_status_id = $arrValues[$i];
if (!empty($product_status_id)) {
$arrProductStatus = array(
'status_cd' => $product_status_id,
'status_name' => $arrStatus[$product_status_id],
'status_image' =>$arrStatusImage[$product_status_id],
);
$arrProducts['productStatus'][$product_id][$i] = $arrProductStatus;
}
}
}
return $arrProducts;
}
/**
*
* @param type $objProduct
* @return void
*/
function doJson(&$objProduct) {
$this->arrProducts = $this->setStatusDataTo($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE);
$this->arrProducts = $objProduct->setPriceTaxTo($this->arrProducts);
// 一覧メイン画像の指定が無い商品のための処理
foreach ($this->arrProducts as $key=>$val) {
$this->arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']);
}
echo SC_Utils_Ex::jsonEncode($this->arrProducts);
SC_Response_Ex::actionExit();
}
/**
*
* @param type $objProduct
* @return void
*/
function doDefault(&$objProduct) {
//商品一覧の表示処理
$strnavi = $this->objNavi->strnavi;
// 表示文字列
$this->tpl_strnavi = empty($strnavi) ? ' ' : $strnavi;
// 規格1クラス名
$this->tpl_class_name1 = $objProduct->className1;
// 規格2クラス名
$this->tpl_class_name2 = $objProduct->className2;
// 規格1
$this->arrClassCat1 = $objProduct->classCats1;
// 規格1が設定されている
$this->tpl_classcat_find1 = $objProduct->classCat1_find;
// 規格2が設定されている
$this->tpl_classcat_find2 = $objProduct->classCat2_find;
$this->tpl_stock_find = $objProduct->stock_find;
$this->tpl_product_class_id = $objProduct->product_class_id;
$this->tpl_product_type = $objProduct->product_type;
// 商品ステータスを取得
$this->productStatus = $this->arrProducts['productStatus'];
unset($this->arrProducts['productStatus']);
$this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';
//onloadスクリプトを設定. 在庫ありの商品のみ出力する
foreach ($this->arrProducts as $arrProduct) {
if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) {
$js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});";
}
// 関連カテゴリを取得
$this->arrRelativeCat[$arrProduct['product_id']] = SC_Helper_DB_Ex::sfGetMultiCatTree($arrProduct['product_id']);
}
//カート処理
$target_product_id = intval($this->arrForm['product_id']);
if ($target_product_id > 0) {
// 商品IDの正当性チェック
if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id'])
|| !SC_Helper_DB_Ex::sfIsRecord('dtb_products', 'product_id', $this->arrForm['product_id'], 'del_flg = 0 AND status = 1')) {
SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
}
// 入力内容のチェック
$arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
if (empty($arrErr)) {
$this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']);
SC_Response_Ex::sendRedirect(CART_URLPATH);
SC_Response_Ex::actionExit();
}
$js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id);
} else {
// カート「戻るボタン」用に保持
$netURL = new Net_URL();
//該当メソッドが無いため、$_SESSIONに直接セット
$_SESSION['cart_referer_url'] = $netURL->getURL();
}
$this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';
$this->tpl_onload .= 'fnOnLoad(); ';
}
}
4.data/Smarty/templates/default/products/maker.tpl を以下のコードで作成
<!--{*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2012 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.
*}-->
<script type="text/javascript" src="<!--{$smarty.const.ROOT_URLPATH}-->js/products.js"></script>
<script type="text/javascript">//<![CDATA[
function fnSetClassCategories(form, classcat_id2_selected) {
var $form = $(form);
var product_id = $form.find('input[name=product_id]').val();
var $sele1 = $form.find('select[name=classcategory_id1]');
var $sele2 = $form.find('select[name=classcategory_id2]');
setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
}
// 並び順を変更
function fnChangeOrderby(orderby) {
fnSetVal('orderby', orderby);
fnSetVal('pageno', 1);
fnSubmit();
}
// 表示件数を変更
function fnChangeDispNumber(dispNumber) {
fnSetVal('disp_number', dispNumber);
fnSetVal('pageno', 1);
fnSubmit();
}
// カゴに入れる
function fnInCart(productForm) {
var searchForm = $("#form1");
var cartForm = $(productForm);
// 検索条件を引き継ぐ
var hiddenValues = ['mode','category_id','maker_id','name','orderby','disp_number','pageno','rnd'];
$.each(hiddenValues, function(){
// 商品別のフォームに検索条件の値があれば上書き
if (cartForm.has('input[name='+this+']')) {
cartForm.find('input[name='+this+']').val(searchForm.find('input[name='+this+']').val());
}
// なければ追加
else {
cartForm.append($("<input/>").attr("name", this).val(searchForm.find('input[name='+this+']').val()));
}
});
// 商品別のフォームを送信
cartForm.submit();
}
//]]></script>
<style type="text/css">
/* 関連カテゴリ */
div.listrightbloc dl.relative_cat {
//background: url("../img/background/line_dot_01.gif") repeat-x scroll center bottom transparent;
margin: 0 0 10px;
//padding: 0 0 10px;
}
div.listrightbloc dl.relative_cat dt,
div.listrightbloc dl.relative_cat dd {
float: none;
display:block;
padding-bottom:0;
}
div.listrightbloc dl.relative_cat dd {
margin-left: 1em;
}
</style>
<div id="undercolumn">
<form name="form1" id="form1" method="get" action="?">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="<!--{$mode|h}-->" />
<!--{* ▼検索条件 *}-->
<input type="hidden" name="category_id" value="<!--{$arrSearchData.category_id|h}-->" />
<input type="hidden" name="maker_id" value="<!--{$arrSearchData.maker_id|h}-->" />
<input type="hidden" name="name" value="<!--{$arrSearchData.name|h}-->" />
<!--{* ▲検索条件 *}-->
<!--{* ▼ページナビ関連 *}-->
<input type="hidden" name="orderby" value="<!--{$orderby|h}-->" />
<input type="hidden" name="disp_number" value="<!--{$disp_number|h}-->" />
<input type="hidden" name="pageno" value="<!--{$tpl_pageno|h}-->" />
<!--{* ▲ページナビ関連 *}-->
<!--{* ▼注文関連 *}-->
<input type="hidden" name="product_id" value="" />
<input type="hidden" name="classcategory_id1" value="" />
<input type="hidden" name="classcategory_id2" value="" />
<input type="hidden" name="product_class_id" value="" />
<input type="hidden" name="quantity" value="" />
<!--{* ▲注文関連 *}-->
<input type="hidden" name="rnd" value="<!--{$tpl_rnd|h}-->" />
</form>
<!--★タイトル★-->
<h2 class="title"><!--{$tpl_subtitle|h}--></h2>
<!--▼検索条件-->
<!--{if $tpl_subtitle == "検索結果"}-->
<ul class="pagecond_area">
<li><strong>商品カテゴリ:</strong><!--{$arrSearch.category|h}--></li>
<!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー:</strong><!--{$arrSearch.maker|h}--></li><!--{/if}-->
<li><strong>商品名:</strong><!--{$arrSearch.name|h}--></li>
</ul>
<!--{/if}-->
<!--▲検索条件-->
<!--▼ページナビ(本文)-->
<!--{capture name=page_navi_body}-->
<div class="pagenumber_area clearfix">
<div class="change">
<!--{if $orderby != 'price'}-->
<a href="javascript:fnChangeOrderby('price');">価格順</a>
<!--{else}-->
<strong>価格順</strong>
<!--{/if}-->
<!--{if $orderby != "date"}-->
<a href="javascript:fnChangeOrderby('date');">新着順</a>
<!--{else}-->
<strong>新着順</strong>
<!--{/if}-->
表示件数
<select name="disp_number" onchange="javascript:fnChangeDispNumber(this.value);">
<!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}-->
<!--{if $num == $disp_number}-->
<option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
<!--{else}-->
<option value="<!--{$num}-->" ><!--{$dispnum}--></option>
<!--{/if}-->
<!--{/foreach}-->
</select>
</div>
<div class="navi"><!--{$tpl_strnavi}--></div>
</div>
<!--{/capture}-->
<!--▲ページナビ(本文)-->
<!--{foreach from=$arrProducts item=arrProduct name=arrProducts}-->
<!--{if $smarty.foreach.arrProducts.first}-->
<!--▼件数-->
<div>
<span class="attention"><!--{$tpl_linemax}-->件</span>の商品がございます。
</div>
<!--▲件数-->
<!--▼ページナビ(上部)-->
<form name="page_navi_top" id="page_navi_top" action="?">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<!--{if $tpl_linemax > 0}--><!--{$smarty.capture.page_navi_body|smarty:nodefaults}--><!--{/if}-->
</form>
<!--▲ページナビ(上部)-->
<!--{/if}-->
<!--{assign var=id value=$arrProduct.product_id}-->
<!--{assign var=arrErr value=$arrProduct.arrErr}-->
<!--▼商品-->
<form name="product_form<!--{$id|h}-->" action="?" onsubmit="return false;">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<div class="list_area clearfix">
<a name="product<!--{$id|h}-->"></a>
<div class="listphoto">
<!--★画像★-->
<a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}-->">
<img src="<!--{$smarty.const.IMAGE_SAVE_URLPATH}--><!--{$arrProduct.main_list_image|sfNoImageMainList|h}-->" alt="<!--{$arrProduct.name|h}-->" class="picture" /></a>
</div>
<div class="listrightbloc">
<!--▼商品ステータス-->
<!--{if count($productStatus[$id]) > 0}-->
<ul class="status_icon clearfix">
<!--{foreach from=$productStatus[$id] item=status}-->
<li>
<img src="<!--{$TPL_URLPATH}--><!--{$arrSTATUS_IMAGE[$status]}-->" width="60" height="17" alt="<!--{$arrSTATUS[$status]}-->"/>
</li>
<!--{/foreach}-->
</ul>
<!--{/if}-->
<!--▲商品ステータス-->
<!--★商品名★-->
<h3>
<a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}-->"><!--{$arrProduct.name|h}--></a>
</h3>
<!--★価格★-->
<div class="pricebox sale_price">
<!--{$smarty.const.SALE_PRICE_TITLE}-->(税込):
<span class="price">
<span id="price02_default_<!--{$id}-->"><!--{strip}-->
<!--{if $arrProduct.price02_min_inctax == $arrProduct.price02_max_inctax}-->
<!--{$arrProduct.price02_min_inctax|number_format}-->
<!--{else}-->
<!--{$arrProduct.price02_min_inctax|number_format}-->~<!--{$arrProduct.price02_max_inctax|number_format}-->
<!--{/if}-->
</span><span id="price02_dynamic_<!--{$id}-->"></span><!--{/strip}-->
円</span>
</div>
<!--★関連カテゴリ★-->
<dl class="relative_cat">
<dt>関連カテゴリ:</dt>
<!--{section name=r loop=$arrRelativeCat[$id]}-->
<dd>
<!--{section name=s loop=$arrRelativeCat[$id][r]}-->
<!--{if $smarty.section.s.last}-->
<a href="<!--{$smarty.const.ROOT_URLPATH}-->products/list.php?category_id=<!--{$arrRelativeCat[$id][r][s].category_id}-->"><!--{$arrRelativeCat[$id][r][s].category_name}--></a>
<!--{/if}-->
<!--{/section}-->
</dd>
<!--{/section}-->
</dl>
<!--★コメント★-->
<div class="listcomment"><!--{$arrProduct.main_list_comment|h|nl2br}--></div>
<!--★商品詳細を見る★-->
<div class="detail_btn">
<!--{assign var=name value="detail`$id`"}-->
<a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}-->" onmouseover="chgImg('<!--{$TPL_URLPATH}-->img/button/btn_detail_on.jpg','<!--{$name}-->');" onmouseout="chgImg('<!--{$TPL_URLPATH}-->img/button/btn_detail.jpg','<!--{$name}-->');">
<img src="<!--{$TPL_URLPATH}-->img/button/btn_detail.jpg" alt="商品詳細を見る" name="<!--{$name}-->" id="<!--{$name}-->" /></a>
</div>
<!--▼買い物かご-->
<input type="hidden" name="product_id" value="<!--{$id|h}-->" />
<input type="hidden" name="product_class_id" id="product_class_id<!--{$id|h}-->" value="<!--{$tpl_product_class_id[$id]}-->" />
<div class="cart_area clearfix">
<!--{if $tpl_stock_find[$id]}-->
<!--{if $tpl_classcat_find1[$id]}-->
<div class="classlist">
<dl class="size01 clearfix">
<!--▼規格1-->
<dt><!--{$tpl_class_name1[$id]|h}-->:</dt>
<dd>
<select name="classcategory_id1" style="<!--{$arrErr.classcategory_id1|sfGetErrorColor}-->">
<!--{html_options options=$arrClassCat1[$id] selected=$arrProduct.classcategory_id1}-->
</select>
<!--{if $arrErr.classcategory_id1 != ""}-->
<p class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</p>
<!--{/if}-->
</dd>
<!--▲規格1-->
</dl>
<!--{if $tpl_classcat_find2[$id]}-->
<dl class="size02 clearfix">
<!--▼規格2-->
<dt><!--{$tpl_class_name2[$id]|h}-->:</dt>
<dd>
<select name="classcategory_id2" style="<!--{$arrErr.classcategory_id2|sfGetErrorColor}-->">
</select>
<!--{if $arrErr.classcategory_id2 != ""}-->
<p class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</p>
<!--{/if}-->
</dd>
<!--▲規格2-->
</dl>
<!--{/if}-->
</div>
<!--{/if}-->
<div class="cartin clearfix">
<div class="quantity">
数量:<input type="text" name="quantity" class="box" value="<!--{$arrProduct.quantity|default:1|h}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.quantity|sfGetErrorColor}-->" />
<!--{if $arrErr.quantity != ""}-->
<br /><span class="attention"><!--{$arrErr.quantity}--></span>
<!--{/if}-->
</div>
<div class="cartin_btn">
<!--★カゴに入れる★-->
<div id="cartbtn_default_<!--{$id}-->">
<input type="image" id="cart<!--{$id}-->" src="<!--{$TPL_URLPATH}-->img/button/btn_cartin.jpg" alt="カゴに入れる" onclick="fnInCart(this.form); return false;" onmouseover="chgImg('<!--{$TPL_URLPATH}-->img/button/btn_cartin_on.jpg', this);" onmouseout="chgImg('<!--{$TPL_URLPATH}-->img/button/btn_cartin.jpg', this);" />
</div>
<div class="attention" id="cartbtn_dynamic_<!--{$id}-->"></div>
</div>
</div>
<!--{else}-->
<div class="cartbtn attention">申し訳ございませんが、只今品切れ中です。</div>
<!--{/if}-->
</div>
<!--▲買い物かご-->
</div>
</div>
</form>
<!--▲商品-->
<!--{if $smarty.foreach.arrProducts.last}-->
<!--▼ページナビ(下部)-->
<form name="page_navi_bottom" id="page_navi_bottom" action="?">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<!--{if $tpl_linemax > 0}--><!--{$smarty.capture.page_navi_body|smarty:nodefaults}--><!--{/if}-->
</form>
<!--▲ページナビ(下部)-->
<!--{/if}-->
<!--{foreachelse}-->
<!--{include file="frontparts/search_zero.tpl"}-->
<!--{/foreach}-->
</div>
5.データベースの dtb_pagelayout に新規ページのレコードを追加
phpMyAdmin のSQLからドバッと流します。(自己責任で宜しくです。)
insert into dtb_pagelayout values(10, 29, 'メーカー一覧ページ', 'products/maker.php', 'products/maker', 1, 1, 2, NULL, NULL, NULL, NULL, now(), now());
以上、お粗末でした。












こちらのソース、とても助かっています。
ところで、この一覧ページにロゴと説明を入れたいのですが、どうしたらできますでしょうか。
「Maker Extension」というプラグインをいれて、
そこにデータがあるのですが、商品詳細用のブロックで表示しませんでした。
新たにメーカー登録をカスタマイズする形でもよいですし、このプラグインで登録されているデータを引っ張ってくるやりかたでもどちらでもよいです。
どうぞよろしくお願いいたします。
おそらく「Maker Extension」というプラグインで、
dtb_maker を拡張しているか、専用テーブルを持っているのだと思います。
こちらで開発したプラグインではありませんので、
プラグイン開発元にお尋ねいただけますでしょうか。
よろしくお願いいたします。