Hello, ok so I’ve pretty much fried my brain today, all I want to do is link to a page (within my site) via the url field in a dataset.
I’ve created a mega menu using repeaters and linking datatsets, works fine, however i need the links in the menu to actually link to a page, so I’ve created a field within my data set that is a url, ready for this url sting, but I can’t work out how i have to write so that wix reads it like an ID so…
example:
title/Label . Page URL
Chairs . …/chairs
Tables …/tables
Lighting …/lighting
etc…
I have tried setting up dynamic pages for this…doesn’t work they way i’d like as i want to utilise the store’s end-user filtering functionalities without writing a load of new code… hence the non dynamic pages displaying pre defined collection, per page…as it stands we don’t have the ability to create collection pages that offer up a unique page url/ID, so I have had to create individual collection pages (tables etc) displaying the collections and their products (nightmare)
I’ve got there anyway now i just want to link up the page…so i need the unique page URL, but surly that should be as above?) or do they have to be full links, (i.e it includes the custom domain) that would be silly? How can i test if that is the case, i don’t want to publish my client isn’t ready so it will be a free wix for the time being, meaning I’d have to go back into all the datasets that use it and update when it goes live…
Please someone help, i’ve literally had enough today, Wix really needs to sort out the communication issues with Stores and Custom datasets, or at least have the ability to create category pages for Stores!! I wouldn’t have to do this then! - unless we can and i’m totally missing it… My brain is fried trying to figure out workarounds for functionalities that a missing!
Sorry if i’m just being dense…or if this is confusing…
1 Like
Hi Kate … don’t worry, you’re confusion makes perfect sense to me 
Great job in making a mega menu using a repeater! Not many people have been able to accomplish this. Let me walk you through some thoughts… Since you are using a repeater, you may want to consider using a button for the URL. Don’t link the button! We will only be using the onClick event.
https://www.wix.com/corvid/reference/$w.Button.html#onClick
What you will have to do is ‘get’ the itemData and then tell it to navigate to that page. To do this you will need to wait for onItemReady in the repeater.
Here is an example from the Wix API guide about onItemReady:
https://www.wix.com/corvid/reference/$w.Repeater.html#onItemReady
I’m going to explain a tiny piece of code they use. In their example they use itemData.description to get the content located under the description field. You can use this code to get the page URL saved in your database collection. All you have to do is use your field key.
Pay close attention to the example in the Repeater code and notice how they identify each element by using $item instead of $w.
Then you can modify the code by using the location API to trigger the navigation to the correct URL:
https://www.wix.com/corvid/reference/wix-location.html#to
By adding an onClick event to the button, getting the page URL and adding the navigation code, you should be able to accomplish what you are looking for.
Recently I created a tutorial video showing people how to navigate to a different page by using a dropdown element (not in a repeater). While this is a completely different method, perhaps it will give you some ideas as well: https://www.youtube.com/watch?v=iMror4Ox61I
I was also doing research on it.
Thank you so much for your reply, I’ll give it a go and may come back to you if I need some more help if you don’t mind, your tutorials are great, thank you very much.
Actually just one question if you don’t mind, am I able to link to an anchor point on a page within the URL?
@kate87628 The community is happy to help! For future questions, try to create individual posts for each one so that it is easier for the community to find answers and answer questions.
To answer your anchor point questions, yes, it is possible to scroll to an element on the page. Here is the WIX API information for that: https://www.wix.com/corvid/reference/wix-location.html#to
P.s. Thanks for watching my videos!
Please do not post unrelated external links, especially when those links lead to non-Wix websites. For forum participation, make sure to read the Forum Guidelines, as provided by Wix:
https://www.wix.com/corvid/forum/community-discussion/corvid-community-guidelines
@code-queen Thank you for your help!
I know this post is old, but it can be done almost as the OP has it. However it is simply slash your page-name (must be lower case). without the preceding periods.
So lets say you have a page called Products, in your dataset, in your URL type column it would be: /products.
And it will link internally to that Page.
If you want to go externally, it’s just the full blown URL (https:// …). Unfortunately it doesn’t provide the option of a target, so it will open that external page within the same tab of your main site.