CafePress.comShop, sell or create what's on your mind.

Community ForumsChats & WorkshopsEventsNewslettersCP VoiceLearning CenterCafePress Blog
If you're new to the CafePress Community Forums, be sure to read our Forum Guidelines before you post anything.

    Community Forums: Home    CafePress Community Forums  Hop To Forum Categories  General Help & Sharing  Hop To Forums  Premium Shops & Shop Customization    Javascript to show banners only during sale
Page 1 2 3 4 

Closed Topic Closed
Go
New
Find
Notify
Tools
  Login/Join 
Moderator
Picture of Teesed
Posted
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.


Text File Here

File updated: 9/22/2005 11:44 pm

This message has been edited. Last edited by: Teesed,


 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
Hey! I think it worked.

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.


 
Edit or Delete MessageReport This Post
Picture of HecticDMC
Posted Hide Post
Very nice! I haven't tested it yet, but the code looks like it should work no problem.

Oh yeah... and up there in the code, where there is **** - you need to replace those asterisks with this:

<img

This message has been edited. Last edited by: HecticDMC,


~ Daniel M. Clark

Shop: Hectic Studios -¤°¤- Book: Success With CafePress.com

For Affiliates: Review Builders
 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
Hmmm.. can't seem to edit.

OK, edited, and that's where it starts going loopy with how this forum deals with code. There really should be a "code" ubb tag to use... Frowner

I've linked a plain text file to use.


 
Edit or Delete MessageReport This Post
Picture of HecticDMC
Posted Hide Post
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.

http://www.hecticstudios.com/salebanner.gif

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 Wink

But it's real slick Smiler

The only thing I had to change - you have an extra space up at the very top in that comment code:   < !--


~ Daniel M. Clark

Shop: Hectic Studios -¤°¤- Book: Success With CafePress.com

For Affiliates: Review Builders
 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
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.


 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
Update:
Updated the script to allow for choosing what ad size you want, and included Hectic Studios' 750 x 40 banner also.

I'll wait on the "alternate" images. Too much other stuff to do for now. Please test it out and let me know if there are any bugs I haven't found.


 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
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.


 
Edit or Delete MessageReport This Post
Picture of HecticDMC
Posted Hide Post
Stickied. Nice work Jim Smiler


~ Daniel M. Clark

Shop: Hectic Studios -¤°¤- Book: Success With CafePress.com

For Affiliates: Review Builders
 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
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.


 
Edit or Delete MessageReport This Post
Picture of 52tease
Posted Hide Post
thank you for the sticky. Now I can get rid of the notification just to remind me to do this for me store.

(unchecking notifications box....now)
 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
OK, adore me now. Wink

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.

<script LANGUAGE="JavaScript" SRC="http://www.cccmemphis.org/cpsale.js">


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,


 
Edit or Delete MessageReport This Post
Moderator
Picture of Teesed
Posted Hide Post
Again, I've tested it, but wouldn't mind some others doing the same. Daniel, if you still have room and time, feel free to include this one as well.


 
Edit or Delete MessageReport This Post
Picture of HecticDMC
Posted Hide Post
I'm heading to bed - just popped in 'cuz my notifications in my email said you sent me a PM Wink 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 Wink


~ Daniel M. Clark

Shop: Hectic Studios -¤°¤- Book: Success With CafePress.com

For Affiliates: Review Builders
 
Edit or Delete MessageReport This Post
Picture of IHate48
Posted Hide Post
quote:
"adchoice" is a number. 1 = the 468x60 banner, 2 = the 125x125 banner, 3 = the 120x60 banner, and 4 = Daniel's special 750x40 banner.


Options 2,3,and 4 all give me the 125x125 banner. Everything else seems to work fine. Nice idea.


I'm not really a negative person, I just come across that way ;-) ... I hate 48, it's a racing thing, not an age thing... :-)
 
Edit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community Page 1 2 3 4  

Closed Topic Closed

    Community Forums: Home    CafePress Community Forums  Hop To Forum Categories  General Help & Sharing  Hop To Forums  Premium Shops & Shop Customization    Javascript to show banners only during sale

All Content Copyright © 1999-2008 CafePress.com.
All rights reserved. Use of this web site constitutes acceptance of the Terms of Service.
Privacy Policy | Intellectual Property Policy | Content Disclaimer
Always On Top 100 Award Winner
Webby Award Winner 2005
HACKER SAFE certified sites prevent over 99.9% of hacker crime.