Jump to content

Getting a list of Categories from the found Product Pages where this Products are in a Category Page Field


Recommended Posts

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

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...