How to link to a static collection page from a dynamic collection?

I have 25 static product pages from a static collection called “Products”.

In Xano I have 3 tables: Favorites, Products, and Users.

Users can “favorite” these static products. I have a “favorites” page where I display a list of favorited products that user has favorited. I do this by displaying another collection “Favorited Products” (I am assuming this needs to be a dynamic collection since user can favorite and unfavorite) on this page.

I want to display ONLY the favorite products on this page, BUT then users can click on their favorite products and it links to the corresponding static product pages.

Now how do I do this?

So far I am only able to link to static product pages from the corresponding static collection. But in this case, the collection that I am linking from is dynamic…?

How do I click on this dynamic collection and have it go to the corresponding static product page?

Hi raelyn,

Your data architecture doesn’t immediately make sense to me. Maybe I’m missing something, but here’s how I would do it:

  1. 2 tables: “Product” and “User”
  2. In “Product” create a “Favorite” field of Table Reference type and make that a a list structure instead of single (so you can add multiple)
  3. When “Product 1” is favorited by “Person A”, you add a reference to “Person A” to the “Product > Product 1 > Favorite” record field.
  4. Create an API endpoint that will retrieve all products where “Person A” has been added to the “Favorite” field.
  5. In WeWeb, use a Xano Request action to get all products where the logged in person (replacing “Person A”) has been added to the “Favorite” field on the table “Products” records.

In WeWeb, this is just a single page, but it uses a component that is dynamically populated. This process is tied to the logged in user.

You could use a collection instead of a Xano Request. This collection would be configured to query the same way the Xano Request would. It might give you better performance. Make sure that any filtering is done on the API side and not on the front-end.

Let me know if this makes sense!

The problem I see with doing it that way (favorites column in product database table) is, what if 2 users favorite the same product at the same time? That would lead to issues…

Additionally, I asked in a separate thread on how best to do this and consensus was a separate table: What's the best way to create a "favorite" function? - #4 by Joyce

But regardless of which way, how do I link to it to my static product pages? Because I am already having these static product pages from a static product collection that I want to show for seo purposes. But how do I link to these static pages from my (dynamic) favorite product page / collection? As even if I have a “favorites” column" that has to be dynamic?

I hope this makes sense…

Gotcha, yeah totally makes sense now. I didn’t understand it this way at first.

I agree that a join table between USERS and PRODUCTS is the way to go for a clearer view of the data, specially if you are going to add more to it than “user” and “product” and if you are going to have a lot of products. So it’s the more complete/complexe but better solution long term.

Onto your main question, here’s how you would use logic to change page. You could store the WeWeb page ID in a field of your product records in Xano, and return it with an add-on in your api endpoint. Then use this in a workflow to redirect the user to the appropriate page when they click the product.