Hi, I have an issue with loading the repeater items on live. I connected the repeater to a dataset but i only connected to the dataset a gallery and the name of the products. I didn’t want to connect to the repeater the number of total products displayed, the prices and the checkboxes (see image below). I managed those through code(see code below).
On preview I see everything, even the number of total products (Prodotti totali: (15)) and the price of each product and the checkboxes work.
If I go live this is what is displayed on screen: Total products = 0, prices aren’t load, checkboxes aren’t displayed at all and I now see that not even the wix-chat app is displayed.
I’ve been working on this website for a while, I caught this issue only two days ago and I can’t find what’s causing it. I tried everything I could but I need some guidance. I hope someone can fix it.
Here’s the code of the onReady items on this page:
the Repeater onReady(): N.B. I tried both async and not async repeater onItemReady function and it is not working either way
export function repeater1_itemReady($item, itemData,index) {
//I show the discounted price
if(itemData.price !== itemData.discountedPrice)
{
$item("#price").html = `<span style="text-decoration: line-through;"><p style="font-size: 200%;">${$item("#price").text = itemData.formattedPrice}</p></span>`;
$item("#sale").show();
$item('#sale').html = `<p class="p1" style="font-size: 21px;"><span style="font-size:21px;"><span style="color:#EA2727">${$item("#price").text = itemData.formattedDiscountedPrice}</span></span></p>`;
}
else
{
$item("#price").html = `<p style="font-size: 200%;">${$item("#price").text = itemData.formattedPrice}</p>`;
$item("#sale").hide();
}
// I manage the variants because I want to show a dropdown ONLY if the product has colors variants
if(itemData.manageVariants === true)
{
wixData.isReferenced('Stores/Products','collections',itemData,'2db37036-ea73-ce80-d650-e2b825791f1d' /*<-this is the Id of a specific collection where I have all the products that have colors variants*/).then((result)=>{
let isReferenced = result;
// console.log(itemData, isReferenced);
if(isReferenced === true)
{
$w('#text49').text = 'Errore: scegli una tonalità.'
if(wixWindow.formFactor === 'Desktop')
{
$item('#checkbox1').hide();
$item('#checkbox2').hide();
$item('#colors').show(); //this is a dropdown and it's not shown either on live like the checkboxes whereas it does and works on preview
}
if(wixWindow.formFactor === 'Mobile')
{
$item('#checkbox1').collapse();
$item('#checkbox2').collapse();
$item('#colors').expand();
}
}
});
//here's how i get the number of total product displayed
$w('#prodotti').onReady(()=>{
let count = $w('#prodotti').getTotalCount();
$w('#tot').text = 'Prodotti totali: (' + count + ')';
})
//I show checkboxes only if the product has variants which are not colors
if(wixWindow.formFactor === 'Desktop')
{
$item('#checkbox1').show();
$item('#checkbox2').show();
}
if(wixWindow.formFactor === 'Mobile')
{
$item('#checkbox1').expand();
$item('#checkbox2').expand();
}
}
}
The onReady() function:
$w.onReady( function () {
//i just want some elements to be shown in desktop and others in mobile
if(wixWindow.formFactor === "Desktop")
{
$w("#button4").hide();
$w("#mobileDescription").hide();
$w('#box3').collapse();
$w('#lineaName').collapse();
//this loop is used only when the database is filtered (by another function) in certain ways, it just sets the layouts of some boxes
for(let i=0;i<insiemeBox.length;i++)
{
insiemeBox[i].onMouseIn(()=>{layoutLinee(insiemeBox[i],insiemeText[i]);});
boxisClicked(insiemeBox[i+1]);
}
}
if (wixWindow.formFactor === "Mobile")
{
$w('#mobileDescription').show();
$w('#button3').show();
$w('#columnStrip8').onViewportEnter($w('#prodotti').loadMore);
$w('#mobileBox1').collapse();
$w('#box3').collapse();
$w('#lineaName').collapse();
$w('#goToLinee').hide();
$w('#filtra').onClick(() =>{
$w('#mobileBox1').expand();
$w('#closeAll').onClick(()=>{$w('#mobileBox1').collapse();
$w('#repeater1').show();
});
$w('#close').onClick(()=>{
$w('#box3').collapse();
$w('#repeater1').show();
$w('#button3').show();
if($w('#brands').value === 'TMT' || $w('#brands').value === 'Odhea')
$w('#goToLinee').show();
});
$w('#goToLinee').onClick(()=>{
$w('#box3').expand();
$w('#repeater1').hide();
$w('#button3').hide();
$w('#goToLinee').hide();
});
});
$w('#filtra').onDblClick(()=>{ $w('#mobileBox1').collapse();})
}
//here's how i scroll up to the page when the user changes page through the pagination bar which is connected to the dataset
$w('#pagination1').onChange(()=>{
setTimeout(()=>{$w('#tot').scrollTo()}, 1200);
});
});
My guess is that the issue is on the repeater onItemRady, because I can see that the dataset actually loads. I have two other pages on my website, both have repeaters connected to two different datasets the same way this problematic repeater is. The only difference is that the datasets of those pages are very small for now (total products are 6 and 2) and I only have one item to manage through variants.
Can anyone help me please? Thank you.