Does anyone know how I can get from the database the autocalculated url that create with the dynamic pages and what are hidden?
for through these create redirection from repeaters?
Or can this issue be addressed in another way?
sorry for my bad english.
I’m going to check the links you shared and I’ll tell you.
What I need is for a button on a repeater that is in a “promotions” section to send me to the page of the company that generates the promotion, which is generated as a dynamic item page.
“promotions” and “company profile” have different databases.
I am building a directory of services, within it I built a section where all the companies appear with a dynamic page and repeaters, which has its page items that serves as the profile of each company, this section has its database " companies_DB " Elsewhere I built a page that is not dynamic where, through repeaters, I show the promotions of these businesses, these promotions build them from a form that is stored in the database “promotions_DB” The repeater connects to the database “promotions_DB” in which there are no dynamic links. Therefore, the button does not connect me to the dynamic item of the business profile. That is the matter basically.
using this generates error
he tells me he doesn’t wait “[”
$w ("# dataset2"). getCurrentItem (). ["link-companies-services-emp_name"];
I used this code but it didn’t work, I think it’s because the repeater is connected to “promotions_DB” and the url info is in “companies_DB” the promotions database is referenced with that of companies
import wixLocation from 'wix-location';
$ w.onReady (() => {
$ w ("# repeater2"). onItemReady (($ w, dataItem, index) => {
let linkToDynamicPage = dataItem ["link-companies-services-company_name"];
$ w ('# button2'). onClick (() => {
wixLocation.to (linkToDynamicPage);
});
});
});
Would it be possible to capture in the promotions form this URL of “companies_DB” and then simply write it in a field in “promotions_DB” then connect the button normally from the repeater dataset?
Could you help me with a sample code?
So if I understand correctly that each company has their own dynamic page with the pages being populated with data from the companies_DB.
So how does the repeater fit into these pages, does it show each company and provide a link to their own dynamic page? Is this your index page so to speak?
As for the promotions, you have a repeater on a static page which lists all of the promotions from the companies which is feed by the promotions_DB
So, you want a button to go from the promotion shown in the repeater to the specific companies dynamic item page for which the promotion applies?
If yes, then you can do something simple like as in this previous post here.
https://www.wix.com/corvid/forum/community-discussion/direct-repeater-item-to-dynamic-page
You can do it without using code too as shown here.
https://www.wix.com/corvid/forum/community-discussion/repeater-buttons-and-dynamic-pages
exactly…
I will review and write to you many thanks for your help!
This is my code and I’m still stuck, try to do it without code and although it allows me to connect it doesn’t work, that’s why I try to do it with code.
He shows this error when running
Someone says to solve it in this way I think it has to do with the format of the url field in the database, but I don’t want to risk breaking down the dynamic pages trying this.
Hi,
I managed to figure this out using the below which I have adapted with your info.
import wixLocation from ‘wix-location’;
$w(“#repeater2”).onItemReady( ($item, itemData, index) => {
$item(“#button2”).onClick( (event) => {
wixLocation.to(itemData[“link-empresas-servicios-nombre-_ID”]); }); })
The item in this section;
wixLocation.to(itemData["link-empresas-servicios-nombre-_ID"]);
Is just the field key of the dynamic page.
It then allows me to connect the dataset click function to route to the dynamic page of the id associated with the item in the repeater
You need to change it to be the same as J.D. put originally in the forum post…
$w("#repeater1").onItemReady( ($item, itemData, index) => {
$item("#text47").onClick( (event) => {
wixLocation.to(itemData["link-mobilestorytimekit-Kit-Info-title"]);
});
})
As you are working with it in repeaters you need it to be $item and not $w as you have done in your code.
You can see about using repeaters in code here.
Repeated Item Scope
There are two instances where you get a repeated-item-scope selector:
-
The $item parameter of the forEachItem(), forItems(), and onItemReady() event handlers.
-
When calling the $w.at() and passing it an event whose context is “COMPONENT_SCOPE”. This is usually done in an event handler that handles event on an element inside a repeater.
Maybe I’m getting annoyed with the subject, but I really appreciate your help.
If you save your site and then try this, you can always just go back to the latest saved version in your site history.
https://support.wix.com/en/article/restoring-a-saved-version-of-your-site
I think that something is wrong when I try to enter the database I get this error, my internet connection works fine.
the other databases open to me without problems