バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > 商品情報追加プラグインの値で商品をソートしたい

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
h_tanaka
投稿日時: 2018/2/9 9:52
対応状況: −−−
登録日: 2016/7/22
居住地: 愛媛県
投稿: 1610
商品情報追加プラグインの値で商品をソートしたい
EC-CUBE3.0.15

商品情報追加プラグインで追加した値を元に商品一覧をソートすることは可能でしょうか?

商品情報に「公開日」という項目を追加し、商品一覧ページ表示時にこの値を元にソートしたいと考えています。

以下のように実装してみたのですが、エラーが発生してしまいます。
どうすればエラーを解決できますでしょうか?または他に良い方法がありますでしょうか?

■エラー
ContextErrorException in SqlWalker.php line 887:
Notice: Undefined index: Product

src/Eccube/Resource/doctrine/Eccube.Entity.Product.dcm.yml
    ManyToOne:
        PlgExpandProductColumnsValue:
            targetEntity: Plugin\PlgExpandProductColumns\Entity\PlgExpandProductColumnsValue
            mappedBy: Product


src/Eccube/Entity/Product.php
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $PlgExpandProductColumnsValue;

    /**
     * Add PlgExpandProductColumnsValue
     *
     * @param \Plugin\PlgExpandProductColumns\Entity\PlgExpandProductColumnsValue $plgExpandProductColumnsValue
     * @return Product
     */
    public function addPlgExpandProductColumnsValue(\Plugin\PlgExpandProductColumns\Entity\PlgExpandProductColumnsValue $plgExpandProductColumnsValue)
    {
        $this->PlgExpandProductColumnsValue[] = $plgExpandProductColumnsValue;

        return $this;
    }

    /**
     * Remove PlgExpandProductColumnsValue
     *
     * @param \Plugin\PlgExpandProductColumns\Entity\PlgExpandProductColumnsValue $plgExpandProductColumnsValue
     */
    public function removePlgExpandProductColumnsValue(\Plugin\PlgExpandProductColumns\Entity\PlgExpandProductColumnsValue $plgExpandProductColumnsValue)
    {
        $this->PlgExpandProductColumnsValue->removeElement($plgExpandProductColumnsValue);
    }

    /**
     * Get PlgExpandProductColumnsValue
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPlgExpandProductColumnsValue()
    {
        return $this->PlgExpandProductColumnsValue;
    }


src/Eccube/Repository/ProductRepository.php
             $qb->leftJoin('p.PlgExpandProductColumnsValue', 'pepcv', 'WITH', 'pepcv.columnId = 16');    // 公開日
             $qb->orderBy('pepcv.value', 'DESC');
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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

統計情報

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

投稿数ランキング

1
seasoft
7365
2
468
3217
3
AMUAMU
2712
4
nanasess
2303
5
umebius
2085
6
yuh
1818
7
h_tanaka
1610
8
red
1568
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.