TarikAli's avatar

Every category has it's logic

Hello, i have categories

when the user click category it opens the category page

the problem is some of these categories has it's logic

category A : i will get it's items with a query A and the page has search input box

category B : i will get it's items with a another query B (small changes than query A) and the page has search input box and search dropdoenlist

in categoryController in show category function

i get the category by alias no problem

but how can i seperate the logic of every category

check category id and according to it make it's logic ? any good way to do this

Thanks

0 likes
3 replies
MohamedTammam's avatar
Level 51

Add type column to the category to determine what logic you should go with.

1 like
TarikAli's avatar

@MohamedTammam Thanks . a good solution

but

category A has type 'a_logic'

if the admin deleted it and try to create it again to has the same logic 'a_logic' he cant because the type is internal thing i use .

it's not visible for admin he just create a new category but can't determine which logic it should have

so admin cant delete any category has type, he just enable or disable it right?

MohamedTammam's avatar

@TarikAli It depends on business logic. Allowing admins to specify the logic is also a valid solution I think.

Please or to participate in this conversation.