Google PageRank Last updated:31 January 2013

I’ve never really bothered about Google PageRank, but in an idle moment this morning I thought I’d see how this site is rated. The homepage scores 1, the blog and my most popular page score 2, and my website build page 3. None of these seem very high. This compares with a current Alexa ranking of 124,575, and over 1000 hits one day this week.

Further, my simple crossfade page – my second most popular – scores 0 on Google PageRank (which according to some sources means Google doesn’t know it exists!). But if I search for jquery crossfade, it’s the number one result on Google and has had 3920 hits in the last month.

Google PR remains a bit of a mystery to me….

Opencart Paypal failures/INVALID with foreign characters Last updated:17 September 2012

We’ve had occasional oddities with Paypal (Standard) payments showing as ‘Pending Paypal’ on Opencart, with the Error Log showing an “INVALID” response from the Paypal IPN transaction. However, when we check on Paypal, the transaction has completed without a problem.

Opencart error log

The (seemingly) common factor with the payments that show like this is that originated in a foreign currency, so I’d assumed that was the problem, but in fact some orders from (the same) currencies went through OK. On Saturday I spotted that those that failed all included a ‘non-standard’ character in the customer’s names: é, ø etc. And this suggested an issue with character sets.

So, after a bit of digging, I discovered that Paypal, as a default, sends all IPN responses encoded as win-1252, whereas my website is in utf-8. You can change this, although it isn’t easy to find, via My Profile > My Selling Preferences > Paypal Button Language Encoding (link right at the bottom) and then the ‘More options’ button. Set the encoding used on your website to utf-8 (or whatever you use, obviously…).

Paypal screenshot showing encoding settings

Testing this after making the change means no more failures with non-standard characters.

Opencart 1.5 Mobile Theme – 2 Last updated:29 June 2012

I’ve now pretty much finished developing a mobile theme for Opencart. I’d value any constructive feedback – you can find the test site here (best viewed on a mobile or via a mobile emulator I think). Here’s a few screenshots just to get you interested:

Opencart 1.5 Mobile Theme Opencart 1.5 Mobile Theme Opencart 1.5 Mobile Theme

Feel free to create test accounts, buy products etc etc (although don’t expect your orders to be fulfilled…). At the moment I’ve got a couple of payment options enabled, just so you can see the checkout screens, plus the Featured module on the home page. If there’s anything else particular you’d like to see then let me know via a comment.

A little more detail on what changes have been made is here.

WordPress wp_ajax returning 0 error Last updated:19 June 2012

This morning I spent a little time constructing an ajax call from a front-end page (not an admin page) using wp_ajax. As is my wont, I tested this in Firefox and all was well. I used the WP codex.

Then I tried it in Opera and it failed, no response whatsoever, just a 0 in the ajax response. Seemed odd that Opera should have a problem, tried it in Chrome, same thing. Lots of Googling later, saw loads of similar questions being asked, no answers…

I then looked at the code in wp_ajax, and all became clear…

I had entries in my functions.php as follows:

 add_action('wp_ajax_myfunction', 'myfunction');
 function myfunction() {

So if I pass an action of ‘myfunction’ to wp_ajax it should call the hook at the top of the above code, which in turn calls myfunction(), right? Only if you are logged on to WordPress at the time! If you aren’t logged in, wp_ajax calls the hook wp_ajax_nopriv_myfunction. And that’s why it worked for me in Firefox, because I was also logged on through Firefox. Nowhere is this mentioned in the codex, that I can see.

Having identified this it’s then simple to add another hook to your functions.php:

 add_action('wp_ajax_nopriv_myfunction', 'myfunction');

Hope this saves someone an hour or so…

Opencart 1.5 Mobile Theme – 1 Last updated:28 June 2012

Following on from earlier efforts to create a mobile theme for my existing Opencart store, I’m currently working on creating a mobile theme that will work with Opencart 1.5.

I’m trying to be a little more comprehensive this time and account for most options. The biggest challenge so far is the Opencart 1.5 checkout page which runs on about 840 lines of jQuery (ugh!) on the default theme. I spent some time last week investigating whether this could be made to work without javascript – and have concluded that while this is possible it’s very very unpleasant, so have accepted that I’ll have to assume javascript in this case (unlike where it is relatively straightforward to make the use of javascript an enhancement rather than a necessity). I spent this morning functionalising the jQuery somewhat – so the five separate pieces of code to display name and address field validation errors are now replaced by a single function. I still have 690 lines of javascript though…

At the moment this exercise is of somewhat academic exercise, but if a mobile theme is of any interest to you, let me know via a comment below.