バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > 管理機能 > 特定カテゴリでのおすすめ商品の表示数について

管理機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
r.ts
投稿日時: 2024/3/3 11:32
対応状況: −−−
半人前
登録日: 2024/2/29
居住地:
投稿: 11
特定カテゴリでのおすすめ商品の表示数について
▼テンプレート
[EC-CUBE] EC-CUBE4.1
[レンタルサーバ] xserver
[PHP] 7.4
[データベース] Mysql
[導入プラグインの有無] おすすめ商品プラグイン
[カスタマイズの有無] 無し
[現象]

デフォルトのおすすめ商品プラグインについて
質問です。

下記の方法で特定カテゴリのおすすめ商品を一覧で
表示しています。


{% set recommend_products = repository('Plugin\\Recommend4\\Entity\\RecommendProduct').getRecommendProduct %}

<div class="ec-shelfRole">
    <ul class="ec-shelfGrid">
{% for RecommendProduct in recommend_products %}
{% set ProductCategories = repository('Eccube\\Entity\\ProductCategory').findBy({product_id: RecommendProduct.Product.id}) %}
{% set hasCategory = false %}
{% for ProductCategory in ProductCategories %}
{% if ProductCategory.category_id == 7 %}
{% set hasCategory = true %}
    <li class="ec-shelfGrid__item">
                <a href="{{ url('product_detail', {'id': RecommendProduct.Product.id}) }}">
                    <img src="{{ asset(RecommendProduct.Product.mainFileName|no_image_product, "save_image") }}">
                    <p>{{ RecommendProduct.comment|raw|nl2br }}</p>
                    <dl>
                        <dt class="item_name">{{ RecommendProduct.Product.name }}</dt>
                        <dd class="item_price">
                            {% if RecommendProduct.Product.hasProductClass %}
                                {% if RecommendProduct.Product.getPrice02Min == RecommendProduct.Product.getPrice02Max %}
                                    {{ RecommendProduct.Product.getPrice02IncTaxMin|price }}
                                {% else %}
                                    {{ RecommendProduct.Product.getPrice02IncTaxMin|price }} ~ {{ RecommendProduct.Product.getPrice02IncTaxMax|price }}
                                {% endif %}
                            {% else %}
                                {{ RecommendProduct.Product.getPrice02IncTaxMin|price }}
                            {% endif %}
                        </dd>
                    </dl>
                </a>
            </li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
</div>


ここで表示数4つだけにしたい場合

{% set ProductCategories = repository('Eccube\\Entity\\ProductCategory').findBy({product_id: RecommendProduct.Product.id},4,0) %}


とすると下記のようなエラーが出てしまいます。

Argument 2 passed to Doctrine\ORM\EntityRepository::findBy() must be of the type array or null, int given, called in /httpdocs/ec/vendor/twig/twig/src/Extension/CoreExtension.php on line 1564

どのようにしたらよいでしょうか
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
 » 特定カテゴリでのおすすめ商品の表示数について r.ts 2024/3/3 11:32
     Re: 特定カテゴリでのおすすめ商品の表示数について k.nakayama 2024/3/3 12:11
       Re: 特定カテゴリでのおすすめ商品の表示数について r.ts 2024/3/3 15:18
         Re: 特定カテゴリでのおすすめ商品の表示数について k.nakayama 2024/3/3 16:11
           Re: 特定カテゴリでのおすすめ商品の表示数について r.ts 2024/3/5 9:11

 



ログイン


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

統計情報

総メンバー数は89,231名です
総投稿数は110,052件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1651
8
red
1570
9
mcontact
1299
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.