Hello!
I am relatively new to Yii2, but have worked with Yii1 before. Here’s what I’m trying to accomplish:
6187
A product catalog with filters.
Here’s my model structure:
6188
There are Products, Categories, Properties and Values. So Samsung Galaxy is a Product of category Smartphone. There’s a Screen Size Property and there are several Values of this Property, like 5", 6" and 10".
The models are pretty much what Gii has generated automatically. The products are shown using ListView.
ProductSearch model is what’s giving me trouble, though. The example uses a form for this model, but I’d like to make all those fields clickable urls. The question is, what’s the easiest way to do it?
Let’s say 10" value has id 456. So if my current instance of ProductSearch has a category id of 123 when I print the list of those filters, I need a link like index.php?r=somecontroller/index&category=123&filter=456.
This spawns two questions:
-
Is there a way to get these urls automatically?
-
How do I pass multiple values of the same parameter? So if 10" is 456 and 6" is 567, how do I pass that filter is 456 and 567?
I may be reinventing the wheel here, but yii2 examples are few and far between