バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > 管理機能 > TOPページの新着商品にステータスアイコンを表示させたい

管理機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
l58
投稿日時: 2019/7/31 17:07
対応状況: −−−
常連
登録日: 2015/2/15
居住地:
投稿: 36
TOPページの新着商品にステータスアイコンを表示させたい
▼テンプレート
[EC-CUBE] 2.13.5
[レンタルサーバ] WADAX
[OS] win7
[PHP] 5.3
[データベース] MySQL 5.1.73
[ブラウザ] firefox


いつもお世話になっております。
TOPページに新規に登録された商品が自動でランダムに表示されるようカスタマイズを行い、ブロック表示させているのですが、ステータスアイコンを表示させるにはどうすれば良いのでしょうか。

どなたかご教授頂けますと幸いです。
何卒宜しくお願い致します。

--------------------------------------------------------
新着商品を登録順にランダムに4つ表示させるブロックnew_bloc.tpl内にステータスアイコンを表示させたい
--------------------------------------------------------

data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_NewBloc.php

**********************************************************
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';

/**
* NewBloc のページクラス.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_FrontParts_Bloc_Best5 - Copy.php -1 $
*/
class LC_Page_FrontParts_Bloc_NewBloc extends LC_Page_FrontParts_Bloc_Ex
{
/** テンプレートクラス名1 */
public $tpl_class_name1 = array();

/** テンプレートクラス名2 */
public $tpl_class_name2 = array();

/** JavaScript テンプレート */
public $tpl_javascript;

public $orderby;

public $mode;

/** 検索条件(内部データ) */
public $arrSearchData = array();

/** 検索条件(表示用) */
public $arrSearch = array();

public $tpl_subtitle = '';

/** ランダム文字列 **/
public $tpl_rnd = '';

/**
* Page を初期化する.
*
* @return void
*/
public function init()
{
parent::init();
$bloc_file = 'new_bloc.tpl';
$this->setTplMainpage($bloc_file);
$masterData = new SC_DB_MasterData_Ex();
$this->arrSTATUS = $masterData->getMasterData('mtb_status');
$this->arrSTATUS_IMAGE = $masterData->getMasterData('mtb_status_image');
}

/**
* Page のプロセス.
*
* @return void
*/
public function process()
{
if (defined("MOBILE_SITE") && MOBILE_SITE) {
$objView = new SC_MobileView();
} else {
$objView = new SC_SiteView();
}

$objQuery = new SC_Query_Ex();

// 商品一覧を取得
$col = 'T1.product_id, T1.main_list_image, T1.name, T1.main_list_comment, T2.price02 AS price02_min';
$from = 'dtb_products as T1 INNER JOIN dtb_products_class as T2 ON T1.product_id = T2.product_id';
$from .= ' INNER JOIN dtb_product_categories as T3 ON T1.product_id = T3.product_id';
$where = 'T2.del_flg = 0 and T3.category_id IN ( ? )'; // $arrval で指定するカテゴリIDの数だけ ? を増やす
$arrval = Array( 210 ); // 一番下層のカテゴリIDを指定する
//$objQuery->setOrder("T1.update_date desc");
$objQuery->setOrder('RAND()');
$arrProducts = $objQuery->select($col, $from, $where, $arrval);
// 税込金額を設定する
SC_Product_Ex::setIncTaxToProducts($arrProducts);

// 重複データ削除
$tmp = Array();
$i = 0;
$max_count = 4; // 取得したい商品個数を指定する
foreach($arrProducts as $arrProduct){
if(!in_array($arrProduct['product_id'], $tmp)){
$this->arrProducts[$i] = $arrProduct;
$i++;
}
$tmp[] = $arrProduct['product_id'];
if($i >= $max_count){
break;
}
}

$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}


/**
* Page のアクション.
*
* @return void
*/
public function action()
{
parent::action();
// 基本情報を渡す
$objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData();
$this->arrInfo = $objSiteInfo->data;

//おすすめ商品表示
$this->arrBestProducts = $this->lfGetRanking();

//表示条件の取得
$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']
);
}

/* 商品一覧の表示 */

/**
* @param SC_Product_Ex $objProduct
*/
public function lfGetProductsList($searchCondition, $disp_number, $startno, &$objProduct)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();

$arrOrderVal = array();

// 表示順序
switch ($this->orderby) {
// 販売価格が安い順
case 'price':
$objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC');
break;

// 新着順
case 'date':
//$objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC');

//更新順に
$objProduct->setProductsOrder('update_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';
}
$col = 'MAX(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';
$sub_sql = $objQuery->getSql($col, $from, $where);

$objQuery->setOrder("($sub_sql) DESC ,product_id DESC");
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;
}

/**
* 商品情報配列に商品ステータス情報を追加する
*
* @param Array $arrProducts 商品一覧情報
* @param Array $arrStatus 商品ステータス配列
* @param Array $arrStatusImage スタータス画像配列
* @return Array $arrProducts 商品一覧情報
*/
public 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;
}

}
**********************************************************

html/frontparts/bloc/new_bloc.php

**********************************************************

require_once realpath(dirname(__FILE__)) . '/../../require.php';
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_NewBloc_Ex.php';

$objPage = new LC_Page_FrontParts_Bloc_NewBloc_Ex();
$objPage->blocItems = $params['items'];
$objPage->init();
$objPage->process();

**********************************************************
data/Smarty/templates/default/frontparts/bloc/new_bloc.tpl
**********************************************************

<!--▼商品ステータス-->
<!--{assign var=id value=$arrProduct.product_id}-->
<!--{assign var=arrErr value=$arrProduct.arrErr}-->
<!--{if count($productStatus[$id]) > 0}-->
<ul class="status_icon clearfix">
<!--{foreach from=$productStatus[$id] item=status}-->
<li><img src="<!--{$TPL_URLPATH}--><!--{$arrSTATUS_IMAGE[$status]}-->" alt="<!--{$arrSTATUS[$status]}-->"/></li>
<!--{/foreach}-->
</ul>
<!--{/if}-->
<!--▲商品ステータス-->
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
 » TOPページの新着商品にステータスアイコンを表示させたい l58 2019/7/31 17:07
     Re: TOPページの新着商品にステータスアイコンを表示させたい 468 2019/7/31 21:48
       Re: TOPページの新着商品にステータスアイコンを表示させたい l58 2019/8/1 14:23
         Re: TOPページの新着商品にステータスアイコンを表示させたい 468 2019/8/1 16:20
           Re: TOPページの新着商品にステータスアイコンを表示させたい l58 2019/8/7 18:50

 



ログイン


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

統計情報

総メンバー数は88,288名です
総投稿数は109,688件です

投稿数ランキング

1
seasoft
7365
2
468
3217
3
AMUAMU
2712
4
nanasess
2303
5
umebius
2085
6
yuh
1818
7
h_tanaka
1610
8
red
1567
9
mcontact
1240
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
796
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.