elivz / VzAddress-Craft

Address fieldtype for the Craft CMS
30 stars 13 forks source link

Using VZ address with ElementCriteriaModel searches #28

Open prkirby opened 7 years ago

prkirby commented 7 years ago

I was wondering if there was a way to use VZ address sub-fields with the element criteria model within a plugin.

Essentially I need to filter users by postalcode, state, you get the point.

Ive tried: $criteria->addressField->postalCode = '48348', $criteria->addressField['postalCode'] = '48348', and $criteria->search = 'addressField["postalCode"]:48348' All of which fail.

Not sure if this is possible since I'm not 100% on how the subfields are set up. Any help on this would be fantastic!

elivz commented 7 years ago

Unfortunately, I don't think that is possible. At least, last time I tried it, I couldn't find any API to make those sub-fields available to Craft to filter by. I can take another look in the next couple days to see if there have been any new developments there since I last looked, though!

prkirby commented 7 years ago

No Problem! I love the plugin, just figured I would reach out. For now I'm just gonna use basic text fields so I can use them in the search criteria. If it is possible, let me know. It's something I would be interested in contributing 👍