Posts tagged with ‘javascript’

Sales Chart plugin

Just a teaser for now.  This is a plugin we're writing to test the internals of the plugin system and make sure it's working like it's supposed to.  So for now, this plugin isn't available.  But it will be soon; most likely shortly after beta 9 is released. 

The Sales Chart plugin adds a menu to your dashboard that lets you view a line chart of your sales for the current week, month, and year; the previous week, month, and year; and all time.  This gives you a quick glance into how well your sales are doing.

Since words don't really work to explain it though, here are a couple of screen shots.

This Week

 

 

This Year

 

The dashboard with this plugin enabled

 

Categories:Plugins
Tags:, , , ,

Opening PayPal in a new window

A couple of users have asked how to have the PayPal button open a new window instead of opening in the same one.  It's fairly easy with a little bit of JavaScript.

Open the thanks.tpl file from whatever theme you're using.  Look for a line with <!--paypalbutton--> in it.  Below that line add the following.

 

<script type="text/javascript">
for (var i=0; i<document.forms.length; i++)
    {
    if (document.forms[i].action.match(/paypal\.com/))
        {
        document.forms[i].target = "_blank";
        }
    }
</script>

 

What this does is loop through any forms (the PayPal link is an HTML form with several hidden fields and one graphic submit button) on the page and if they are submitting to paypal.com the target is changed to _blank which makes the link open a new page.  Any other forms (search boxes, email subscription fields, etc) will not be affected.

Why?

So, why do you need this?  The user that first asked was running ProofBuddy inside a frameset on their site.  For some reason PayPal has issues with this and throws a very nondescript error when you try to access from a framed page.  She needed a way to break out of the frameset.

Some people also just like the idea of opening PayPal in a separate window so that their site is still open.

Categories:Development Blog
Tags:, , ,