I am doing a module in Prestashop. I have taken fancytransection as slider. In the slider as per documentation I am using all these values to show slider
effect: '', // wave, zipper, curtain
width: 500, // width of panel
height: 332, // height of panel
strips: 20, // number of strips
delay: 5000, // delay between images in ms
stripDelay: 50, // delay beetwen strips in ms
titleOpacity: 0.7, // opacity of title
titleSpeed: 1000, // speed of title appereance in ms
position: 'alternate', // top, bottom, alternate, curtain
direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
navigation: false, // prev and next navigation buttons
links: false // show images as links
Here I am fetching the value of width,height and navigation
from the database. So that one can manually set values for all this. This is working for width and hight that I am getting from the database. But the value for navigation which I am getting either true or false from the database is not working. Everytime it is showing the slider navigation.
Here is the codes that have been used in my .tpl file
<script>
var result_navigation="{$result_navigation}";
var result_width="{$result_width}";
var result_height="{$result_height}";
$.fn.jqFancyTransitions.defaults = {
width: result_width, // width of panel
height: result_height, // height of panel
strips: 10, // number of strips
delay: 5000, // delay between images in ms
stripDelay: 50, // delay beetwen strips in ms
titleOpacity: 0.7, // opacity of title
titleSpeed: 1000, // speed of title appereance in ms
position: 'alternate', // top, bottom, alternate, curtain
direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
effect: '', // curtain, zipper, wave
navigation: result_navigation, // prev next and buttons
links : true // show images as links
};
</script>
Here the value for width as result_width and height as result_height has been working fine. But the value for result_navigation is fetching fine with false or true value
. But when I am using that in the code its not working. It is showing the navigation just like the value is true. value for false is not working here. Can someone kindly tell me how to solve this issue? Any help and suggestions will be really appreciable. Thanks
Check the output of {$result_navigation}
. As you're using quotes, you're passing a string, which will be seen as true-ish in the js code. You should try something like this:
<script>
// if you use a boolean
var result_navigation = {if $result_navigation}true{else}false{/if};
// if you use `true` or `false` as strings - but that's just weird
var result_navigation = {if $results_navigation == 'true'}true{else}false{/if};
</script>