Last active
December 26, 2016 05:59
-
-
Save nanasess/30f1e8cf4a5ed08b66da02604d0226ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/Eccube/Form/Type/SearchProductType.php | |
+++ b/src/Eccube/Form/Type/SearchProductType.php | |
@@ -54,8 +54,8 @@ class SearchProductType extends AbstractType | |
*/ | |
public function buildForm(FormBuilderInterface $builder, array $options) | |
{ | |
- $Categories = $this->app['eccube.repository.category'] | |
- ->getList(null, true); | |
+ // $Categories = $this->app['eccube.repository.category'] | |
+ // ->getList(null, true); | |
$builder->add('mode', 'hidden', array( | |
'data' => 'search', | |
@@ -63,7 +63,12 @@ class SearchProductType extends AbstractType | |
$builder->add('category_id', 'entity', array( | |
'class' => 'Eccube\Entity\Category', | |
'property' => 'NameWithLevel', | |
- 'choices' => $Categories, | |
+ // 'choices' => $Categories, | |
+ 'query_builder' => function (EntityRepository $er) { | |
+ return $er | |
+ ->createQueryBuilder('c') | |
+ ->orderBy('c.rank', 'DESC'); | |
+ }, | |
'empty_value' => '全ての商品', | |
'empty_data' => null, | |
'required' => false, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment