Hello! There is an array of products:
array(4) { [0]=> array(21) { ["product_id"]=> string(2) "54" ... ["category"]=> string(2) "76" ["parent_category"]=> string(2) "62" } [1]=> ... You must first split them across the parent_category field, then among those products that have the same parent_category split across the category field. Those. should end up with something like this:
- Π ΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠ°Ρ ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ 1 -- ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ 1 ~ΡΠΎΠ²Π°Ρ ΠΈΠ· ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ 1 ~ΡΠΎΠ²Π°Ρ ΠΈΠ· ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ 1 -- ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ 2 ~ΡΠΎΠ²Π°Ρ ΠΈΠ· ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ 2 - Π ΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠ°Ρ ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ 2 -- ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ 3 ~ΡΠΎΠ²Π°Ρ ΠΈΠ· ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ 3 ~ΡΠΎΠ²Π°Ρ ΠΈΠ· ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΎΠΉ ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΠΈ 3 While it turns out to divide them only by parent categories