This produces a list of all the products, not in alphabetical order, and with duplicates too.
Is there a way to combine all these filtered products into one object / array (ex: $filtered), sort it alphabetically and remove duplicates, finally loop through it and export the list?
Something like:
<?php foreach($codes as $item): ?>
add $item to $filtered
<?php endforeach ?>
<?php foreach($brands as $item): ?>
add $item to $filtered
<?php endforeach ?>
<?php foreach($manufacturers as $item): ?>
add $item to $filtered
<?php endforeach ?>
<?php $filtered = array_unique($filtered); ?>
<?php asort($filtered) ?>
Then I would finally output all these filtered results.
Your system works, but it is creating a $filtered array of my tags.
I would like instead to create a $filtered object containing all the pages, filtered by those tags, sorted alphabetically and with duplicates removed.
I am practically trying to create a “Related Pages” component.
I have the following “spaghetti” code working at the moment. It filter through each of the $tubeNames (Code) tags, then $brands tags or $manufacturers tags, but it break the results into buckets.
I would like instead to get all the results together into a $filtered object, much as $results for the search results, and then clean it of duplicates and organize it alphabetically.
In fact, part of the problem also affect my search page: I don’t know how to sort alphabetically the $results.