Filtering products on specific super attributes?

victor.vanherpt
victor.vanherpt Spryker Solution Partner Posts: 58 🪐 - Explorer
edited November 2023 in Spryker Development

For context: I'm in the middle of implementing a feature where I have to update the stock for products sharing a specific super-attribute, and that share another super-attribute.
I ended up in the SpyStockProduct::doUpdate() method.
Example:
Product A has superAttribute1 = blue and superAttribute2 = wood
Product B has superAttribute1 = yellow and superAttribute2 = wood
Product C has superAttribute1 = green and superAttribute2 = metal

When I have to update product A, I want product B to be added to the select criteria. I can get product abstracts, but I don't see an obvious (performant) way of filtering out by shared super attribute (in this case, all concrete products that have superAttribute = wood). Attributes are stored as a json object (text type in mysql).
I thought of crating some kind of functional indexes, but apparently propel is not ready for that (I can only add columns to indexes?). Also filtering out on some regex (expensive, I'd say).

Any ideas?

P.S. We are already studying the possibility to update product structure to match better the feature requirements, but we need to fix this for now first.

Tagged: