OK, I've written a basic script that lets you call a javascript function and pass the beginning and ending dates of the sales, and it will show the banner during the sale dates, and it will show any alternative text outside of the dates.
I would appreciate some testing and any feedback or suggestions.
I would like to put an option at the beginning for selecting the size banner, so that most people with minimal html skills can use it. It's really not that hard though, and you can copy that into a plain html page to test it on your own computer before uploading it to your site.
There is, but personally, I don't like it. It doesn't break lines nicely and ends up blowing out the side of the post. It's [.code] and [./code], without the dots.
I just tested, it works great. I just realized why I can't use it though... I have my custom banner that I'd love to use it with, but I made that banner public a while back, and several people use it.
I update that banner for each sale, and put a generic message in there when there is no sale going on. So even if I use your code, I'm still going to have to update that banner for sales and non-sales alike for those folks that are using it
But it's real slick
The only thing I had to change - you have an extra space up at the very top in that comment code: < !--
Cool. Thanks for the feedback on the "beta" version.
I'm going to go play with it now to add some wicked features. I'll put in one for your banner also. Great service to the CP community, by the way! Don't you love it when people depend on you? hehe....
Features that will be added:
Ability to select with a 1,2,3 or 4 to automatically choose the CP banner size options, along with Daniel's wide banner.
Create some generic off-sale banners for people to use, like "Keep an eye on this space for great deals on our merchandise!" and go ahead and code that in as a default.
Fix the space that Daniel pointed out.
That's all I can think of for now. Maybe a .js version also.
Any features you can think of to add, or anything I've not considered - speak now or, well, speak later.
Just wanted to bump this up to the top for people since the new sale is coming up on the 11th. If you have time, you can put this script in your premium store now and you won't have to worry about missing the sale banners or having those horrid "Support this site" banners while you wait!
Feel free to post any questions. This has been thoroughly tested, and it is running on my store right now.
Wooohoo! First the front page, now stickied? This is turning out to be a banner week! I'm working today on a .js version so people can more easily include it in their pages. I'll update shortly.
This can't be more simple. For those of you that have a premium store, but don't like tinkering with javascript innards, here you go.
I've uploaded the javascript to a .js file. That means you can just call it with this code in your "head" tags. Technically, it doesn't *have* to be there, but it should.
Then, where you want the sale banner to appear, put this code:
<script LANGUAGE="JavaScript"> checkSaleDate("storeid","startdate","enddate","adchoice","Text when no ad shows")
That's almost it! Just make a couple of text replacements so it works for your store as follows:
What the options mean: "storeid" is your own storeid, like "teesed". "startdate" is the first date of the sale. This is when your "Text when no ad shows" is replaced by the ad banner of your choice. The format for this option is "m/d/yyyy", meaning July 2, 2005 would be "7/2/2005" "enddate" is the last day of the sale. Same format as above. "adchoice" is a number. 1 = the 468x60 banner, 2 = the 125x125 banner, 3 = the 120x60 banner, and 4 = Daniel's special 750x40 banner. "Text when no ad shows" is what appears outside of the date range you put for the ad banner to show. This can be text, like "Check this space for specials starting October 2!" or it can be html. For example, you might want to make a graphic banner of the same size as the ad banner you use that says something like "Keep an eye on this space for specials!", then show it, so that last option would be something like "**** src=http://www.photobucket.com/myalbum/image.jpg border=0 width=125 height=125>"
Here's an example:
checkSaleDate("teesed","10/11/2005","10/25/2005","2","Check back Oct. 11 for the fall sale on cold-weather merchandise.")
That's about it. You can still copy that .js source if you want to tweak it. I, for one, don't like linking the banner back to my site. It just doesn't make sense, so I'll be tweaking a different .js file to do that.
Feel free to leave the reference on my church site. I pay for the hosting, and if bandwidth becomes an issue, I'll move it and leave something nice behind warning the shopkeeper to update their script.
This message has been edited. Last edited by: Teesed,
I'm heading to bed - just popped in 'cuz my notifications in my email said you sent me a PM I'll bang it around tomorrow, but I don't see any reason why it shouldn't work. My only concern (warning) would be about putting HTML in that final variable - you (and I know you know this, I mean "you" generally) can't use quotes in any HTML you put in place of that variable. Aside from that, it looks very easy to use.
Don't worry about bandwidth... I host a banner, and it barely makes a dent on my bandwidth. Your .js file is plain text, a fraction of the size