I have created a custom dynamic page set up for my products on my ecommerce guitar store. On the product page I have connected, image, price, video, description and more to data through the content manager and it has gone quite well.
Like many online shops I am trying to set up a variation selector so customers can choose there preferred, colour, size, bundle etc and have that particular variation added to cart.
In the screenshot below is my product page set up. The blue variation selectors are made up of a text element connected to data within a small, blue, container box. The text element is dynamically linked (using the 'URL' field in content manger) to a separate dynamic page with that particular variation.
Now with in the content manager, I have set up some different variations to show up for different products on there respected dynamic page. The text is showing up dynamically on each page just fine, and the button is clickable; taking the user to the correct variation page. The issue i am having is with the blue container boxes. I would like the blue container boxes to be hidden or collapsed when the text element isn't showing any content.
As the screenshot shows, some of the blue container boxes remain even though there is no text content showing. I feel like this is a simple coding issue that I just don't have the knowledge to fix.
If you have any questions or a superior code thread that can help, a comment on this post will be very much apricated as I know nothing of coding.
Here's what i have so far:
$w.onReady(() => { $w("#dynamicDataset").onReady(() => { const item = $w("#dynamicDataset").getCurrentItem(); if (!item.textElement1) { $w("#blueContainerBox1").collapse(); } }); });
Simply put, I want the blue container box to hide/collapse when there is no content showing in the text element. I would then go on to apply this to each blue container box and text, but for now the code is just for the first blue variation selector.
Hope I have made sense. Any help you can give me will be greatly appreciated. This is frustrating me to my very core
Thanks,
Jamie