strandoo Posted July 21, 2022 Share Posted July 21, 2022 I'm sorry if this has been covered before. I can't seem to get my head around how I do this. I have a bunch of Product pages with product codes (just say P1, P2, P3, etc). Different products may be displayed on the site depending on many criteria, including what region you are in (EU, USA, GB). Each product belongs to a Category page, but this relationship is set in a Category page field called product_codes which contains a number of product codes separated by spaces (P1 P2 P5 P6 ...). I need to display only the Category pages for those products in my found products list. If I were doing this from scratch, I probably would have structured this differently, but the data comes from frequently updated CSV files. Is this a case of creating an array from $category->product_codes and searching through those or creating a selector from that field with pipes (P1|P2|P3)? Thanks all. Link to comment Share on other sites More sharing options...
Jan Romero Posted July 21, 2022 Share Posted July 21, 2022 Since you have the codes separated by spaces, word matching selectors may work well for you. Check out “~|= Contains any words”, “**= Contains match” and “~= Contains all words” in particular. You could also hook after Pages::savedPageOrField and transform the textual list into page references whenever it changes. Link to comment Share on other sites More sharing options...
strandoo Posted July 21, 2022 Author Share Posted July 21, 2022 @Jan RomeroThanks. I did try that with limited success. For some reason, it would only return the same 12 category pages then stop. I ended up doing something completely different (getting the categories, then getting the products for each by converting those spaces to pipes ( | ) and using the text as a selector. Much simpler and more 'ProcessWirey'. Thanks for leading me there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now