From a329f4f973e458af5e273ddf41eb3d60b2265a0c Mon Sep 17 00:00:00 2001
From: Nicolas <nicolas@bejean.eu>
Date: Sun, 7 Oct 2018 14:24:16 +0200
Subject: [PATCH] =?UTF-8?q?Corrections=20:=20Affichage=20des=20sous-cat?=
 =?UTF-8?q?=C3=A9gories?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Model/Config/Source/CategoryList.php                 | 12 ++++++++----
 etc/widget.xml                                       |  2 +-
 view/frontend/templates/widget/category_widget.phtml |  4 ----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Model/Config/Source/CategoryList.php b/Model/Config/Source/CategoryList.php
index 185f7a9..0d09826 100755
--- a/Model/Config/Source/CategoryList.php
+++ b/Model/Config/Source/CategoryList.php
@@ -51,16 +51,20 @@ class CategoryList implements ArrayInterface
      */
     public function toArray()
     {
+        /*
+         * Le paramètre asCollection permet à true d'afficher le second niveau des catÊgories
+         */
 
-        $categories = $this->getStoreCategories(true,false,true);
+        $categories = $this->getStoreCategories(false,true,true);
+
+        $categoryList = array();
 
-        $catagoryList = array();
         foreach ($categories as $category){
 
-            $catagoryList[$category->getEntityId()] = __($category->getName());
+            $categoryList[$category->getEntityId()] = __($category->getName());
         }
 
-        return $catagoryList;
+        return $categoryList;
     }
 }
 ?>
\ No newline at end of file
diff --git a/etc/widget.xml b/etc/widget.xml
index c3d4426..f089c06 100755
--- a/etc/widget.xml
+++ b/etc/widget.xml
@@ -11,7 +11,7 @@
             <parameter name="widget_content" xsi:type="text" visible="true" sort_order="2">
                 <label translate="true">content</label>
             </parameter>
-			<parameter name="category_selection"  xsi:type="multiselect" visible="true" sort_order="3" source_model="NicolasBejean\CategoryWidget\Model\Config\Source\CategoryList">
+			<parameter name="category_selection" xsi:type="multiselect" visible="true" sort_order="3" source_model="NicolasBejean\CategoryWidget\Model\Config\Source\CategoryList">
                 <label translate="true">category_selection</label>
                 <description translate="true">category_selection_description</description>
             </parameter>
diff --git a/view/frontend/templates/widget/category_widget.phtml b/view/frontend/templates/widget/category_widget.phtml
index 5b3df46..a9d193b 100755
--- a/view/frontend/templates/widget/category_widget.phtml
+++ b/view/frontend/templates/widget/category_widget.phtml
@@ -22,10 +22,6 @@
             <?php if($categories != null): ?>
             <div class="categories">
                 <?php
-                /*
-                 * TODO : Supprimer le foreach lorsqu'il n'y a qu'un enfant
-                 * TODO : Permettre d'afficher plusieurs fois la mÃĒme catÊgorie
-                 */
                 foreach($categories as $category):
                     $cat = $this->getCategoryModel($category->getId());
 
-- 
GitLab