バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > 「メインビジュアルスライドショープラグイン」のランダム表示がしたいです。

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
NB0
投稿日時: 2017/4/5 18:24
対応状況: −−−
新米
登録日: 2014/11/2
居住地:
投稿: 10
「メインビジュアルスライドショープラグイン」のランダム表示がしたいです。
----------------------------------
EC-CUBE 2.13.2
サーバーOS FreeBSD 9.1-RELEASE-p24 amd64
DBサーバー MySQL 5.5
WEBサーバー Apache/2.2.31
PHP 5.6.18
----------------------------------

お世話になります。

「メインビジュアルスライドショープラグイン」
http://www.ec-cube.net/products/detail.php?product_id=804

このプラグインで表示されるスライドショーを、アクセスごとに登録されている商品をランダムで表示したいのですが、どのようなカスタマイズを施せば実現できますでしょうか?

メインビジュアルスライドショープラグインで登録できる5つの商品を、順番固定ではなくアクセスごとにランダムで表示したいという事です。

わかる方、どうかご教授いただけますと幸いです。
よろしくお願い致します。
umebius
投稿日時: 2017/4/5 23:05
対応状況: −−−
登録日: 2016/7/22
居住地:
投稿: 2085
Re: 「メインビジュアルスライドショープラグイン」のランダム表示がしたいです。
具体的な方法ではないですが、スライドショーのデータ(ファイル名など)はDBのテーブルに登録されているはずですので、その取得部分を探し出して、phpでランダムにソートしてやればOKだと思います。

MYSQLならSQLにORDER BY RAND()などカスタマイズしても良いと思います。


----------------
EC-CUBEカスタマイズ・高速化・脆弱性対策・SEO ご相談ください。

2系・3系から4系へのバージョンアップ実績豊富

NB0
投稿日時: 2017/4/8 17:06
対応状況: −−−
新米
登録日: 2014/11/2
居住地:
投稿: 10
Re: 「メインビジュアルスライドショープラグイン」のランダム表示がしたいです。
ありがとうございます。
おっしゃる通りrandom関数で表示部をランダム表示することに成功しました。
しかし、メインイメージとサムネイルイメージが一致しないという不具合が発生しております。

サムネイルイメージをクリックすれば対応したメインイメージに変わるというデフォルトの機能ですが、

function lfGetMainImageList()
function lfGetMainImageThumbnailList()

この2つの関数の取得部をrandomにしたので、それぞれがランダム取得という事で一致しないことは必然といえばそうですが…。

これをメインイメージとサムネイルイメージを一致させる方法はありますでしょうか?

念のためコードを記載します。



function action() {
$this->arrMainImageListFree = $this->lfGetMainImageList();
$this->arrMainImageOption = $this->lfGetMainImageOption();
$this->tpl_peger = $this->tplPeger();
$this->tpl_peger_tag = $this->tplPegerTag();

$PThumnaiList = $this->lfGetMainImageThumbnailList();
}

function lfGetMainImageList() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = "*";
$where = "del_flg = 0";
$table = "plg_dtb_main_image";
$objQuery->setOrder("random()");
$arrRet = $objQuery->select($col, $table, $where);
return $arrRet;
}

function lfGetMainImageThumbnailList() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = "main_image_image2,main_image_title1";
$where = "del_flg = 0";
$table = "plg_dtb_main_image";
$objQuery->setOrder("random()");
$arrRet = $objQuery->select($col, $table, $where);


foreach ($arrRet as $key => $ThumnaiList) {
$PThumnaiList .= "<div><img class=\"peger_thumbnail\" src=\"" . IMAGE_SAVE_URLPATH . $ThumnaiList['main_image_image2'] . "\" alt=\"" . $ThumnaiList['main_image_title1'] . "\"/></div>";

}

return $PThumnaiList;
}

function lfGetMainImageOption() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = "*";
$where = "";
$table = "plg_dtb_main_image_option";
$arrRet = $objQuery->select($col, $table, $where);
return $arrRet;
}

function tplPeger() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = "main_image_peger";
$where = "";
$table = "plg_dtb_main_image_option";
$arrRet = $objQuery->select($col, $table, $where);
if($arrRet[0]['main_image_peger'] == "number"){
$div = "data-cycle-pager=\"#custom-pager\" data-cycle-pager-template=\"<span><a href=#> {{slideNum}} </a></span>\"";
}elseif($arrRet[0]['main_image_peger'] == "thumbnail"){
$div = "data-cycle-pager=\"#adv-custom-pager\" data-cycle-pager-template=\"\"";
}

return $this->tpl_peger = $div;
}

function tplPegerTag() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = "main_image_peger";
$where = "";
$table = "plg_dtb_main_image_option";
$arrRet = $objQuery->select($col, $table, $where);

if($arrRet[0]['main_image_peger'] == "number"){
$tag = "<div id=\"custom-pager\" class=\"center cycle-pager\"></div>";
}elseif($arrRet[0]['main_image_peger'] == "thumbnail"){
$tag = "<div id=\"adv-custom-pager\" class=\"center cycle-pager\">" . $this->lfGetMainImageThumbnailList() . "</div>";
}elseif($arrRet[0]['main_image_peger'] == "standerd"){
$tag = "<p class=\"cycle-pager\"></p>";
}

return $this->tpl_peger_tag = $tag;
}



function lfGetMainImageList()
function lfGetMainImageThumbnailList()
の中の
$objQuery->setOrder("rank DESC");

$objQuery->setOrder("random()");
に変えました。

よろしくお願い致します。
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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.