- EC-CUBEで商品ステータス別に検索し一覧ページに表示する
- 2015.07.04
ECCUBEバージョン:2.13.3
対象ファイル
data/class/pages/products/LC_Page_Products_List.php
data/Smarty/templates/default/products/list.tpl変更箇所
1)action関数内の配列にproduct_status_idを追加$this->arrSearchData = array(
‘category_id’ => $this->lfGetCategoryId(intval($this->arrForm[‘category_id’])),
‘maker_id’ => intval($this->arrForm[‘maker_id’]),
‘name’ => $this->arrForm[‘name’],
‘product_status_id’ => $this->arrForm[‘product_status_id’]
);2)lfInitParam関数内に下記を追加
$objFormParam->addParam(‘商品ステータスID’, ‘product_status_id’, INT_LEN, ‘n’, array(‘NUM_CHECK’, ‘MAX_LENGTH_CHECK’));
3)lfGetSearchCondition関数内に下記を追加
if ($arrSearchData[‘product_status_id’]) {
$searchCondition[‘where’] .= ‘ AND product_id IN (SELECT product_id FROM dtb_product_status WHERE product_status_id = ? AND del_flg = 0)’;
$searchCondition[‘arrval’][] = $arrSearchData[‘product_status_id’];
}4)lfGetPageTitle内に下記を追加
※追加分のみ表示しています。カッコはきちんと閉じてください。} elseif ($this->arrSearchData[‘product_status_id’] > 0) {
return $this->arrSTATUS[$this->arrSearchData[‘product_status_id’]];5)list.tpl内のform1内に下記を追加
<input type=”hidden” name=”product_status_id” value=”<!--{$arrSearchData.product_status_id|h}-->” />
ECCUBE