Page List filtering based on custom attribute object

I am developing a v9 site and would like to tag blog posts with a product so I can show a filtered page list of blog posts on each product page.

My first thought was to set up a topic category with topics for each product and tag each blog post with the relevant product topic. This would be straight forward to set up and easy to manage with the built-in Page List options but I am mindful when handing over the site to be managed by someone else it is not the most intuitive.

I came across an excellent package by Mesuva, Multiple Page Selector Attribute which adds a new attribute where related pages can be selected using a popup sitemap view which would potentially take the Topics requirement out of the equation. Anyone could then add a new blog post and tag as many products as required from the sitemap without having to worry about setting up a new topic.

I have started to look at options for listing and sorting pages using an embedded Page List which has great flexibility for filtering by Custom Attibutes. When I add this new attribute and set this filter I cannot seem to set it up to work correctly. I believe this is because the attribute stores the related pages as an object so when I try to check if the current page ID (integer) is in the custom attribute (object) there is a type mismatch.

Does anyone know if this would be technically possible or if I am better off sticking with the Topic approach? Theoretically at least Topics themselves involve comparing a single Topic with a list of topics so there must be a way of mirroring that in some way? I am sure that it would require some custom SQL query rather than built in filters e.g.
$pageList->getQueryObject()->where("ak_attribute_handle LIKE '%\n" . $c->getCollectionID() . "\n%'");
but any pointers would be gratefully recieved.

Thanks for your help.

There are some extra-functional Page List extensions in the marketplace that include filtering. For example:

Thank you JohntheFish, I will take a look at that to see if it will provide the solution.

Thanks for your help.

@phowie74 I’m working today to get core page selector functionality working in my package as noted above by @JohntheFish. This will allow you to tag one product page per blog post using a Page Selector attribute. Setting up the filters in my page list is simple. Multi Page Select is MUCH desirable and will follow in the near future!! Shoot me a direct message with an email. I’ll send you a download location when it’s ready…

That sounds great enlil - I would definitely be interested when that is available.

In this instance I was only looking to show three posts on the product page so I have kind of fudged a solution for now. I am looping through the $pages object and unsetting pages if they are not related until I have my 3. I then reindex and chop off any remaining pages. I am hoping that using the cache will mean this is not too much processing and I can make sure the page is re-cached when related posts are added.

Thanks for taking the time to respond and I will look out for that update.