バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > 新着商品プラグインの特定カテゴリのみ表示について

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
D-18
投稿日時: 2016/3/31 22:57
対応状況: −−−
半人前
登録日: 2012/10/31
居住地:
投稿: 16
Re: 新着商品プラグインの特定カテゴリのみ表示について

<?php
// {{{ requires
require_once CLASS_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php';

/**
 * 新着商品ブロックのブロッククラス
 */
class LC_Page_FrontParts_Bloc_Newbooks extends LC_Page_FrontParts_Bloc {

    /**
     * 初期化する.
     *
     * @return void
     */
    function init() {
        parent::init();
    }

    /**
     * プロセス.
     *
     * @return void
     */
    function process() {
        $this->action();
        $this->sendResponse();
    }

    /**
     * Page のアクション.
     *
     * @return void
     */
    function action() {
        //商品情報取得
        $this->arrNewbooks = $this->lfGetNewbooks();
    }

    /**
     * デストラクタ.
     *
     * @return void
     */
    function destroy() {
        parent::destroy();
    }
    
    /**
     * 新着商品の情報を取得
     *
     * @return array
     * @setcookie array
     */
    function lfGetNewbooks(){
        $objQuery =& SC_Query_Ex::getSingletonInstance();
        $objProduct = new SC_Product_Ex();
		


        // プラグイン情報を取得.
        $plugin     = SC_Plugin_Util_Ex::getPluginByPluginCode("Newbooks");
        //表示条件
        $disp_rule  = is_numeric($plugin['free_field1']) ? $plugin['free_field1'] : 0;
        //表示件数
        $disp_count = unserialize($plugin['free_field2']);
        //表示ステータス
        $product_status = $plugin['free_field3'];

        //デバイスフラグ
       $disp_device == SC_Display_Ex::detectDevice();

        // 新着商品情報取得 特定のカテゴリ 【11】
        $col = 'product_id';
        $table = 'dtb_products';
		$where = 'category_id = 11';
		$where .= 'and status = 1 and del_flg = 0';
		

        if($product_status){
            $arrStatus = unserialize($product_status);
            if(is_array( $arrStatus )){
                $strstatus = '';
                foreach( $arrStatus as $status ){
                    if( $strstatus ) $strstatus .= ',';
                    $strstatus .= $status;
                }
                $where .= ' '
                        . 'AND product_id IN ('
                        . '    SELECT product_id FROM dtb_product_status WHERE product_status_id IN (' . $strstatus . ')'
                        . ')';
            }
        }
        switch($disp_rule) {
            case 1://登録日順
                $objQuery->setOrder('create_date desc');
            break;
            case 2://更新日順
                $objQuery->setOrder('update_date desc');
            break;
        }
		
        if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_PC ) {
           $objQuery->setLimit($disp_count[10]);
        }elseif(SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE){
           $objQuery->setLimit($disp_count[1]);
        }elseif(SC_Display_Ex::detectDevice() == DEVICE_TYPE_SMARTPHONE ){
           $objQuery->setLimit($disp_count[2]);
        }
		
		
        $arrProducts = $objQuery->select($col, $table, $where);


        $objQuery =& SC_Query_Ex::getSingletonInstance();
        if (count($arrProducts) > 0) {

            $arrProductId = array();
            foreach ($arrProducts as $key => $val) {
                $arrProductId[] = $val['product_id'];
            }

            // 商品詳細情報取得
            $arrTmp = $objProduct->getListByProductIds($objQuery, $arrProductId);
            foreach ($arrTmp as $key => $arrRow) {
                $_row = $arrRow;
                $arrProductList[] = $_row;
            }
        }
        return $arrProductList;
    }

}
?>


自分なりに色々と調べながら試してみました!
残念ながらエラーで動作はできておりません。。。。


        // 新着商品情報取得 特定のカテゴリ 【11】
        $col = 'product_id';
        $table = 'dtb_products';
	$where = 'category_id = 11';
	$where .= 'and status = 1 and del_flg = 0';


とカテゴリーIDを先に指定してみたのですがどこがダメなんでしょうか?

ご教授頂けますとたすかります。。。。。
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   新着商品プラグインの特定カテゴリのみ表示について D-18 2016/2/28 23:55
     Re: 新着商品プラグインの特定カテゴリのみ表示について karin 2016/2/29 15:50
       Re: 新着商品プラグインの特定カテゴリのみ表示について D-18 2016/3/4 17:25
     » Re: 新着商品プラグインの特定カテゴリのみ表示について D-18 2016/3/31 22:57

 



ログイン


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

統計情報

総メンバー数は88,923名です
総投稿数は110,012件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1296
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
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.