X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Flexslider X-Cart 4.4.5 Intergration (https://forum.x-cart.com/showthread.php?t=63808)

VWD 05-31-2012 02:05 PM

Flexslider X-Cart 4.4.5 Intergration
 
Hello everyone, I╢ve been trying to get Flexslider to work in X-CART 4.4.5, but thus far it╢s not working.
Works great otherwise, but I╢m having problems getting it to run in X-CART.
Has anyone done this successfully and if so do you have a tutorial or tips you could share ?

Thanks

totaltec 06-01-2012 05:25 AM

Re: Flexslider X-Cart 4.4.5 Intergration
 
I implemented the Flexslider successfully. What sort of problems are you having with it?

A common mistake is to include jquery twice. I see this line:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

But X-cart already has Jquery included.

VWD 06-01-2012 07:16 AM

Re: Flexslider X-Cart 4.4.5 Intergration
 
Hello Mike, thanks for responding. That could be what's causing it, I will remove that line, test again and let you know if I get it working.

VWD 06-01-2012 10:01 AM

Re: Flexslider X-Cart 4.4.5 Intergration
 
Hello Mike, I tried removing it, but no luck.
Added the following code to <head> in home.tpl
<link rel="stylesheet" type="text/css" href="{$AltSkinDir}/custom/css/flexslider.css" />
<script src="{$AltSkinDir}/custom/js/jquery.flexslider-min.js"></script>.
Also added and removed the load function script:
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
$('.flexslider').flexslider();
});
</script>

Added the following to welcome.tpl:
<div class="flexslider">
<ul class="slides">
<li>
<img src="{$AltImagesDir}/custom/pic1.jpg" alt="" title=""/>
</li>
<li>
<img src="{$AltImagesDir}/custom/pic2.jpg" alt="" title=""/>
</li>
<li>
<img src="{$AltImagesDir}/custom/pic3.jpg" alt="" title=""/>
</li>
</ul>
</div>
Pictures and css loading but not the flexslider.js as far as I can see. I╢m probably missing something obvious, any ideas..
Thanks

gb2world 06-01-2012 11:08 AM

Re: Flexslider X-Cart 4.4.5 Intergration
 
Also check that anywhere you have added javascript to a template (.tpl file), that you enclose it within {literal} {/literal} tags. Smarty and javascript share characters in their syntax, and you do do not want smarty to interpret the javascript characters. The literal tags tell smarty to ignore the javascript.

---

totaltec 06-01-2012 01:19 PM

Re: Flexslider X-Cart 4.4.5 Intergration
 
Quote:

Originally Posted by gb2world
Also check that anywhere you have added javascript to a template (.tpl file), that you enclose it within {literal} {/literal}

That is probably what is wrong now.

This bit:
PHP Code:

<script type="text/javascript" charset="utf-8">
  $(
window).load(function() {
    $(
'.flexslider').flexslider();
  });
< /
script

Should be:
PHP Code:

<script type="text/javascript" charset="utf-8">
  {
literal}
$(
window).load(function() {
    $(
'.flexslider').flexslider();
  });
{/
literal}
< /
script

The problem is that Smarty uses those same delimiters { and }, see those in the JavaScript?

Another way to escape those is to use {$ldelim} for "{" and {$rdelim} for "}".
Like this:
PHP Code:

<script type="text/javascript" charset="utf-8">
  $(
window).load(function() {$ldelim}
    $(
'.flexslider').flexslider();
{
$rdelim});
< /
script


VWD 06-09-2012 03:46 AM

Re: Flexslider X-Cart 4.4.5 Intergration
 
Thanks Mike, I have not got it working in X-Cart yet, got it working in Drupal though. Will continue, sooner or later I╢m sure I╢ll find out what╢s wrong.


All times are GMT -8. The time now is 07:38 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.