質問 > フロント機能 > 2.11.4|ランキングブロックでの通常価格表示について |
フロント機能
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
maruuuuuun |
投稿日時: 2013/1/23 1:04
対応状況: −−−
|
半人前 登録日: 2012/2/12 居住地: 投稿: 22 |
2.11.4|ランキングブロックでの通常価格表示について いつもお世話になっております。
2.11.4系でランキングを表示させる事までは成功したのですが、そこのブロックでの通常価格表示について困惑しております。 ランキングにはおすすめ商品や新着商品のように <!--{$arrProduct.price02_min|sfCalcIncTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> と「price02」や「price01」と分ける記述がなく、どうやって表示したら良いのかわかりません。 またデータベースの操作も必要なのかな?とも思いますが、何分phpやデータベース事はあまり分からず、どうにもならない状態です。 どなたかご教授下さいますと幸いです。 個人的には「LC_Page_FrontParts_Bloc_Ranking.php」内の -----------↓↓↓------------ // ランキング検索 function lfGetRanking(){ $objQuery = new SC_Query(); $col = "T1.product_id, T1.product_name as name, T3.main_list_image, COUNT(*) as order_count, T1.price"; $from = "dtb_order_detail AS T1 INNER JOIN dtb_order AS T2 ON T1.order_id = T2.order_id INNER JOIN dtb_products AS T3 ON T1.product_id = T3.product_id"; $objQuery->setwhere("T3.status = 1 AND T3.del_flg = 0"); $objQuery->setGroupBy("T1.product_id, T1.product_name, T3.main_list_image"); $objQuery->setOrder("order_count DESC"); $objQuery->setLimit(5); return $objQuery->select($col, $from); } -----------↑↑↑------------ ここなんかが怪しいかと感じます。 なお制作したファイルは下記のようになります。 -------------------------------------------------------------------------------------------------------------------------------- ■ranking.php -----------↓↓↓------------ <?php require_once(CLASS_EX_REALDIR . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ranking_Ex.php"); $objPage = new LC_Page_FrontParts_BLoc_Ranking_Ex(); register_shutdown_function(array($objPage, "destroy")); $objPage->init(); $objPage->process(); ?> -------------------------------------------------------------------------------------------------------------------------------- ■LC_Page_FrontParts_Bloc_Ranking.php -----------↓↓↓------------ <?php /* * This file is part of EC-CUBE * * Copyright(c) 2000-2010 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/frontparts/bloc/LC_Page_FrontParts_Bloc.php"); /** * ランキング のページクラス. */ class LC_Page_FrontParts_Bloc_Ranking extends LC_Page_FrontParts_Bloc { /** * Page を初期化する. * * @return void */ function init() { parent::init(); $bloc_file = 'ranking.tpl'; $this->setTplMainpage($bloc_file); } /** * Page のプロセス. * * @return void */ function process() { if (defined("MOBILE_SITE") && MOBILE_SITE) { $objView = new SC_MobileView(); } else { $objView = new SC_SiteView(); } $objSiteInfo = $objView->objSiteInfo; // 基本情報を渡す $objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData(); // ランキング表示 2009.05.08追加 $this->arrRanking = $this->lfGetRanking(); $objView->assignobj($this); $objView->display($this->tpl_mainpage); //おすすめ商品表示 //$this->arrBestProducts = $this->lfGetRanking(); //$objView->assignobj($this); //objView->display($this->tpl_mainpage); } /** * モバイルページを初期化する. * * @return void */ function mobileInit() { $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "frontparts/" . BLOC_DIR . 'ranking.tpl'; } /** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $this->process(); } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } // ランキング検索 function lfGetRanking(){ $objQuery = new SC_Query(); $col = "T1.product_id, T1.product_name as name, T3.main_list_image, COUNT(*) as order_count, T1.price"; $from = "dtb_order_detail AS T1 INNER JOIN dtb_order AS T2 ON T1.order_id = T2.order_id INNER JOIN dtb_products AS T3 ON T1.product_id = T3.product_id"; $objQuery->setwhere("T3.status = 1 AND T3.del_flg = 0"); $objQuery->setGroupBy("T1.product_id, T1.product_name, T3.main_list_image"); $objQuery->setOrder("order_count DESC"); $objQuery->setLimit(5); return $objQuery->select($col, $from); } } ?> -------------------------------------------------------------------------------------------------------------------------------- ■LC_Page_FrontParts_Bloc_Ranking_Ex.php -----------↓↓↓------------ <?php /* * This file is part of EC-CUBE * * Copyright(c) 2000-2010 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/frontparts/bloc/LC_Page_FrontParts_Bloc_Ranking.php"); /** * ランキング のページクラス(拡張). * * LC_Page_FrontParts_Bloc_Ranking をカスタマイズする場合はこのクラスを編集する. */ class LC_Page_FrontParts_Bloc_Ranking_Ex extends LC_Page_FrontParts_Bloc_Ranking { /** * Page を初期化する. * * @return void */ function init() { parent::init(); } /** * Page のプロセス. * * @return void */ function process() { parent::process(); } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } } ?> -------------------------------------------------------------------------------------------------------------------------------- ■ranking.tpl(ブロックテンプレート内) -----------↓↓↓------------ <!--{if count($arrRanking) > 0}--> <div class="bloc_outer clearfix"> <div id="recommend_area"> <h2><img src="<!--{$TPL_URLPATH}-->img/title/rankitem_title.gif" alt="ランキング" title="ランキング" /></h2> <div class="bloc_body clearfix"> <!--{foreach from=$arrRanking key=myId item=i}--> <div class="itembox_block"> <dl class="itembox"> <dt class="rank_number"> <!--{assign var=rank value=$myId+1}--> <img src="<!--{$TPL_URLPATH}-->img/rank<!--{$rank}-->.gif" alt="ランキング" /> </dt> <dt> <a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$i.product_id}-->"><img src="<!--{$smarty.const.IMAGE_SAVE_URLPATH|sfTrimURL}-->/<!--{$i.main_list_image}-->" width="130px" alt="<!--{$i.name}-->"></a> </dt> <a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$i.product_id}-->"> <dt> <!--{assign var=rank value=$myId+1}--> <!--{$i.name}--> </dt> <dd> <!--{$i.price|sfCalcIncTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> 円</dd> </a> </dl> </div> <!--{/foreach}--> </div> </div> </div> <!--{/if}--> -------------------------------------------------------------------------------------------------------------------------------- よろしくお願いいたします。 |
dkazuto |
投稿日時: 2013/1/23 2:39
対応状況: −−−
|
一人前 登録日: 2012/5/10 居住地: 投稿: 95 |
Re: 2.11.4|ランキングブロックでの通常価格表示について こんにちは。
おすすめ商品や新着商品をあえてまねて書くのであれば、掲載いただいたコードの LC_Page_FrontParts_Bloc_Ranking.php内の一部分を 以下のように変更する必要があるかと思います。
さらにテンプレートの方も変更します。
となっている部分を
と置き換えます。 ランキングそのものは掲載頂いたコードのロジックを利用しますが、 商品価格(price01_minやprice02_min)は別の場所から 再度取得してくるという方法を取っています。 また、補足となりますが、price01というのは商品マスタでいう通常価格ですので、 登録上必須項目ではありません。 通常価格が登録されていない商品にprice01を使うと0円で表示されてしまいますので、 ご注意ください。 以上、ご参考になれば幸いです。 |
maruuuuuun |
投稿日時: 2013/1/23 10:02
対応状況: 解決済
|
半人前 登録日: 2012/2/12 居住地: 投稿: 22 |
Re: 2.11.4|ランキングブロックでの通常価格表示について dkazuto 様
ありがとうございます! 問題なく表示されました。 早々のご返答で非常に助かりました。 またなにかあればどうぞ宜しくお願いします! |
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |