Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

AJAX based flash/gif banner rotetor

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-07-2009, 06:27 AM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Thumbs up AJAX based flash/gif banner rotetor

Guys,
Since many days I was looking for banner system for x-cart which should support flash. I tried many free php scripts but non of them worked with flash support in x-cart.

I found open source ajax based javascript from dynamicdrive.com ( http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm ) which runs fine in x-cart to display banners & good thing is that as it's ajax based the new flash/gif banners are loaded without page refresh as per time set by you.

Following steps I did & manage to display banners in my x-cart's main page (welcome.tpl)

Step1
----------
create folder "flash" in skin1 directory

Open home.tpl & enter following code just before </head> tag
Code:
<script src="/your-store-directory/skin1/flash/ajaxticker.js" type="text/javascript"> /*********************************************** * Ajax Ticker script (txt file source)- ╘ Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ </script>
Note: you can put ajaxticker.js on any directory on your sever. But make sure you give proper path on above code.

Step2 (optional)
----------
Open Skin1.css & at end put
Code:
/#ajaxticker1{ width: 466px; height: 60px; border: 1px ridge black; padding: 5px; background-color: #FEEEB8; } #ajaxticker1 div{ /*IE6 bug fix when text is bold and fade effect (alpha filter) is enabled. Style inner DIV with same color as outer DIV*/ background-color: #FEEEB8; } .someclass{ //class to apply to your scroller(s) if desired }

Note: you need to follow above step if you want to run this as ticker system & not banner roteting system. Don't forget to define width & height as per your requirement

Step3
----------
Open welcome.tpl & after the tag {$lng.txt_welcome} paste
Code:
{literal}<script type="text/javascript"> var xmlfile="/your-store-directory/skin1/flash/tickercontent.txt" //path to ticker txt file on your server. //ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot) new ajax_ticker(xmlfile, "ajaxticker1", "someclass", 25000, "fade") </script>{/literal}
Note: you can increase/decrease value of default time "25000" as per your need to load next banner
Step 4
------------
Save ajaxticker.js file & tickercontent.txt files in the folder skin1/flash/ folder

Step 5
----------
I have put 2 sample flash banners code in file tickercontent.txt. You should place your flash banner code between tag <div class="message"> </div>. You can save your swf files in skin1/flash folder or any directory at your web site but make sure to give proper path else banner will not display.

For more info about how exatly above code works please visit http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm

I have not tried but I guess you can display random products also using this code.

Any idea from other members to improve this code is always welcome
Attached Files
File Type: zip ajaxticker.js.zip (2.0 KB, 199 views)
File Type: txt tickercontent.txt (1.3 KB, 153 views)
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote

The following 3 users thank anandat for this useful post:
am2003 (07-11-2010), chastie (03-23-2009), maineiac (05-11-2009)
  #2  
Old 05-20-2010, 02:42 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: AJAX based flash/gif banner rotetor

Will this work in 4.3?
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #3  
Old 05-20-2010, 08:45 PM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: AJAX based flash/gif banner rotetor

Hi minfinger,
Sorry I haven't tested in 4.3 but I guess it should work in 4.3 without any problem.
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #4  
Old 05-21-2010, 02:27 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: AJAX based flash/gif banner rotetor

The head.tpl doesn't have a </head> in it.

I stopped there because I didn't want to screw up the files.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #5  
Old 05-21-2010, 02:32 AM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: AJAX based flash/gif banner rotetor

Quote:
Originally Posted by minfinger
The head.tpl doesn't have a </head> in it.

I stopped there because I didn't want to screw up the files.


Don't worry, just toss it in there and it should work
__________________
- Shane Munroe
Reply With Quote
  #6  
Old 05-21-2010, 12:41 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: AJAX based flash/gif banner rotetor

OK I can't get it to work right. This isn't terribly confusing, but I just can't get it to show up.

Here's my head.tpl (I did have the code at the bottom and it didn't work there either)
Code:
{* $Id: head.tpl,v 1.20 2009/06/05 11:46:27 joy Exp $ vim: set ts=2 sw=2 sts=2 et: *} <div class="line1"> <script src="{$SkinDir}/hr.js" type="text/javascript"></script> <div class="logo"> <div class=logo1"> <script src="{$SkinDir}/flash/ajaxticker.js" type="text/javascript"> /*********************************************** * Ajax Ticker script (txt file source)- ╘ Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ </script> </div> </div> {include file="customer/tabs.tpl"} </div> <div class="line2"> {if $main ne "fast_lane_checkout"} {include file="customer/language_selector.tpl"} {else} {include file="modules/Fast_Lane_Checkout/head.tpl"} {/if} </div> {if $categories_menu_list} <div class="top-categories"> <div class="hor-categories"> <ul id="hr_list"> {foreach from=$categories_menu_list item=c} <li><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category}</a></li> {/foreach} </ul> </div> <div class="more-categories" onmouseover="javascript: hrMenuShow('cat_list');" onmouseout="javascript: hrMenuHide('cat_list');"> <a href="javascript:void(0);"><img id="menu_more" src="{$ImagesDir}/custom/menu_more.gif" alt="" /></a> <ul id="hr_menu" style="display: none;"> <li>&nbsp;</li> </ul> </div> </div> {/if} {include file="customer/noscript.tpl"}


Here's my welcome.tpl
Code:
{* $Id: welcome.tpl,v 1.33 2008/10/30 17:57:31 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $display_greet_visitor_name} <h1>{$lng.lbl_welcome_back|substitute:"name":$display_greet_visitor_name} </h1> {elseif $lng.lbl_site_title} <h1>{$lng.lbl_welcome_to|substitute:"company":$lng.lbl_site_title}</h1> {else} <h1>{$lng.lbl_welcome_to|substitute:"company":$config.Company.company_name}</h1> {/if} {$lng.txt_welcome}<br /> {literal}<script type="text/javascript"> var xmlfile="http://littlepuppiesonline.msidesigns.com/skin1/flash/tickercontent.txt" //path to ticker txt file on your server. //ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot) new ajax_ticker(xmlfile, "ajaxticker1", "someclass", 25000, "fade") </script>{/literal} {if $active_modules.Bestsellers && $config.Bestsellers.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"}<br /> {/if} {include file="customer/main/featured.tpl"}

Here's the tickercontent.txt file. I just want it to rotate the jpgs
Code:
<!--Wrap each ticker cotent inside <div class="message"> tag --> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner1.jpg"></a></div> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner2.jpg"></a></div> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner3.jpg"></a></div> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner4.jpg"></a></div> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner5.jpg"></a></div> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner6.jpg"></a></div> <div class="message"> <a href="http://littlepuppiesonline.msidesigns.com/"><img src="http://littlepuppiesonline.msidesigns.com/skin1/flash/banner7.jpg"></a></div>
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #7  
Old 05-21-2010, 01:38 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: AJAX based flash/gif banner rotetor

I did build it as a simple HTML file and it worked locally on my PC.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #8  
Old 05-21-2010, 01:43 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: AJAX based flash/gif banner rotetor

Try moving the script include from the head.tpl to meta.tpl

Also, check with firebug to see if its loading but just not on the page.
__________________
- Shane Munroe
Reply With Quote
  #9  
Old 05-21-2010, 11:17 PM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: AJAX based flash/gif banner rotetor

Quote:
Originally Posted by minfinger
I did build it as a simple HTML file and it worked locally on my PC.
<script src="{$SkinDir}/flash/ajaxticker.js" type="text/javascript">
/***********************************************
* Ajax Ticker script (txt file source)- ╘ Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script>

The above code must be put before </head> tag but I guess in 4.3 the head.tpl file doesn't have <head> </head> tag. it must be in some other template file. I have not tried 4.3 version so I am not aware in which file <head> </head> tags are there.
Just try to find out that it's there in ustomer/home.tpl or any other template.
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #10  
Old 05-21-2010, 11:25 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: AJAX based flash/gif banner rotetor

<head> stuff is in meta.tpl for 4.3
__________________
- Shane Munroe
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:06 AM.

   

 
X-Cart forums © 2001-2020