Skip Navigation

[Closed] Creating a crossfade slider with views in a Woocommerce product

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1941115

We need to create a slider that shows with a crossfade effect the images of a repeatable field in a product of Woocommerce.
We saw a tutorial
hidden link
where it is explained how to create a slider with Views but it doesn't work with our repeatable images field.

Is it possible to use the repeatable field of images for a slider made with views?

Thanks

Franco.

#1941823

Hi, unfortunately Views is designed to loop over posts or Repeatable Field Groups (RFGs), or Users or taxonomy terms, but not designed to loop over a custom image field that allows multiple values. If it's possible to reconfigure your repeating image field to be a single field in a repeatable field group, then you could use Views. If not, the Block Editor offers two Toolset Blocks that are designed to work with image fields that allow multiple values as sliders or in a gallery format. You can use the Toolset Image Slider block or the Toolset Gallery block to display those types of repeating fields, but neither of those blocks applies a crossfade transition. The slider block is probably the closest thing built-in, but it's a right-to-left slide effect instead of a crossfade transition.

If you're interested in a solution using custom code, you can check out the Flexslider implementation discussed in several other tickets in the forum. A "fade" animation transition is available, so that might work for your needs.
Flexslider plugin: https://woocommerce.com/flexslider/
Forum reference: https://toolset.com/forums/topic/how-to-display-the-pics-i-uploaded-as-a-slider/

Let me know if you have questions and I can offer more information where available.

#1941995

Thanks Christian, I have to say that you're the best support person in Toolset team. I will definitely try to reconfigure the custom fields section so to create a repeatable field group and create a slider with a view.
I keep this ticket open so I can contact you again if something goes wrong.
Thanks.

Franco

#1942413

Thank you, I'm honored! I'll stand by for your update.

#1955655

Hi Christian sorry for late reply but I need to keep this ticket still open because I dodn't had the time to test the slider you suggested.
Thanks.
Franco

#1955827

Hi Christian,
I successfully created the crossfade slider with the group of fields and view.
Is it possible for that type of slider creating a lightbox when clicking on images and also eventually apply a link to those images?
Thanks
Franco

#1956281

Is it possible for that type of slider creating a lightbox when clicking on images and also eventually apply a link to those images?
With custom JavaScript code, it is possible to combine lightbox and flexslider features in many different ways. It can become somewhat complex depending on what you want to achieve, exactly. If you can show me an example online, we can discuss how it might be implemented with Toolset. A quick search led me to these examples:
https://www.iomundo.com/Blog/August-2016/Easy-image-carousel-with-lightbox-using-Flexslider
https://stackoverflow.com/questions/23640450/flexslider-click-on-pictures-to-bring-up-lightbox-like-ability
https://codepen.io/krnlde/pen/pGijB
Do you have an online example to share, or can you share more details about how you want to implement this combination of Flexslider and Lightbox?

#1956433

Hi Christian I can send you a link but I need it a secure connection since the website is not yet online. In addition I didn't use flexslider but the view block as you told me. I suppose we need Flexslider for creating the lightbox, if there is a less heavy solution in terms of plugin it would be appreciated because we just need to applu the lightbox feature to the existing slider made with the view.

As soon as you activete the secure connection i will send you the URl.
thanks

Franco

#1956593

Please find private fields available here for your next reply. If you'd like to provide login credentials as well, I can take a closer look to see how you were able to set this up on your site.

#1956613

Hi Christian here is the page where we placed the slider in the hero area.

hidden link

We need to know if it is possible for that slider to activate the same lightbox that is activated in the small gallery at the bottom part of the sidebar.

Thanks

Franco

#1956953

Can you provide login credentials in the private reply fields here? I will take a look at the View and see if it's possible to trigger a lightbox by adding some HTML attributes to the View in the hero area.

#1961743
sidebar-slider.png

Okay I've never tried triggering a lightbox from a separate View block before, but we can give it a shot and see if it works. To trigger the lightbox from the top View, you would have to replace the Single Field block in the top View with a custom HTML block. In the HTML block, add the following code to create a lightbox trigger and image:

<a href='[types field="hero-image" output="raw"][/types]' data-lightbox='7b31b424-8992-4f11-82fa-9aa981a3f3f7'>[types field="hero-image" align="center" size="full"][/types]</a>

Please test that and let me know the results. The data-lightbox value 7b31b424-8992-4f11-82fa-9aa981a3f3f7 might change. You can find the updated hash value by inspecting the sidebar slider in the browser inspector (see sidebar-slider.png).

#1961807

Hi Christian, I am trying to replace the single field block in the view but if I place a HTML block instead of a single block the lightbox works but the slider do not work because it is not anymore a repeatable field.

Maybe I have to find a different way to obtain a slideshow with a lightbox... maybe with a custom slider plugin integrated with a lightbox solution, btw what lightbox uses Toolset in the sidebar gallery maybe I can call that lightbox from a custom coded slider.

In addition I don't understand where to retrieve the data-lightbox value because I don0t know how is generated.

Franco

#1962843
Screen Shot 2021-02-22 at 9.39.25 AM.png

Hi Christian, I am trying to replace the single field block in the view but if I place a HTML block instead of a single block the lightbox works but the slider do not work because it is not anymore a repeatable field.
Are you saying the sidebar slider will stop working if you change the top hero View? I think there was a miscommunication somewhere, because the changes I am suggesting will not impact the sidebar slider. Nothing in the sidebar slider will change. I am only suggesting you change the Single Field block in the loop of the hero View, and replace it with an HTML block containing the hero image inside a link tag. The sidebar slider, which is currently configured to work with the repeating Gallery Prodotto field, will continue to function as expected. The top hero View is configured to loop over the Hero slider RFG and display one RFG item per "page", automatically paginating with a fade transition. Each page contains one image from that RFG item - the Hero Image custom field. I am not suggesting you change the sidebar slider field configuration, or the main configurations of the top hero View. I am only suggesting we change how the image is displayed on each "page" of the Hero View. Whether it's displayed with a single field block or an HTML block should not impact the sidebar slider or the fading feature of the top hero View. Am I misunderstanding something?

In addition I don't understand where to retrieve the data-lightbox value because I don0t know how is generated.
The data-lightbox value is not available anywhere in wp-admin, it is generated by the system in a way that is not obviously predicatable. You must use the browser inspector to find this value on the front-end of the site. From the Product page, you must right-click or control-click an image in the sidebar slider, then click "Inspect" in the popup menu to inspect that element in the browser inspector (screenshot). If you do not have developer tools active in your browser, you may need to activate them to activate the browser inspector. Consult the documentation of your browser if you are not familiar with this feature. It is activated different ways in different browsers. The screenshot I attached in my previous reply shows where to access the value in the browser inspector when you inspect one of the sidebar slider images.

#1962877

Hi Christian,
maybe I didn't explain well what I was intended to do. My intent is to allow the lightbox in the HERO slider like it does in the sidebar gallery. So I don't want to change that gallery just indicating it as an example of the result.
I tried to investigate how to change the single field code to a HTML code in the loop but since the page works with blocks I cannot see the loop code where I shall change the single field to the HTML content. If ti click in the block element of the loop I have limited option in the block customizer on the sidebar, so my problem is that I don't know how to change that field into a HTML.
Regarding the lightbox code I know how to inspect the page source but if I use the lightbox data placed in the sidebar gallery it refers to that gallery and not to the hero slider (since that data I assume is generated by the system, and so it is not present in teh hero slider since that element is not attached to a lightbox feature). What am I missing?
Franco

The topic ‘[Closed] Creating a crossfade slider with views in a Woocommerce product’ is closed to new replies.