Archive for the 'Web Development' Category

osCommerce & PayPal IPN Invoice Error

Wednesday, July 4th, 2007

I’ve just had an email from a customer about an order through one of our osCommerce run shops saying they had placed an order but when they had gone through to PayPal, they received a message saying

“ERROR DETECTED: This invoice has already been paid. For more information, please contact the merchant.”

I checked PayPal and there was no transaction but when checking in osCommerce the customer had placed an order which appeared to be paid for, After a bit of checking I found out what was causing the problem and the fix as well!

It appears that when using the PayPal IPN, it requires a unique Invoice Number for each transaction which isn’t a problem most of the time. We’ve had a problem because we’re using the same PayPal account (email address) for several shops. Unfortunately since we’re using seperate installations of osCommerce and therefore seperate databases for each, there’s sometimes a overlap of invoice numbers.

Luckily we aren’t the first and you can find the solution on this osCommerce Forums Thread

Modify the Page Title of a WordPress Post

Monday, July 2nd, 2007

I’m by no means a SEO expert but I roughly know what I’m doing and I’ve always thought that the default way WordPress displays the page titles for a post is a bit the wrong way round. A post should be optimised for the content on that particular page as opposed to the name of the blog which should mean that the post name should precede the blog name in the title tag, e.g.

<title>This is the post title » Blog Name</title>

You can do this by modifying a line of code within your header file. Go to:

WP root > wp-content > themes > theme_name > header.php

Open this file and replace the code within the title tags with the following:

<title><?php wp_title(’ ‘); ?><?php if(wp_title(’ ‘, false)) { echo ‘ &raquo;’; } ?> <?php bloginfo(’name’); ?></title>

And that should be it!

AJAX Online Document Storage

Friday, June 22nd, 2007

I was asked at work to create a simple filestore online to store various files that needed to be accessed by various members of staff around the country. The basic requirements were:

  • Password protection
  • Checkin and checkout facility for each file
  • Basic usernames to track who has what
  • Windows explorer style folder structure
  • Upload new files, create folders and delete files or folders

Since I’ve been getting in AJAX recently I thought I would do the entire thing using it, obviously with PHP doing the background stuff. There was no real advantage of using AJAX, it was just a new project and was easily done in AJAX.

I’ve finished and tested it all now and everything is working quite well. I’ve just got to comment all the code and then I’m going to stick it all online for download if anyone wants it.

Edit: 17/07/2007
AJAX Document Store Code

phpBB and Image Verification Issues

Thursday, June 14th, 2007

I’ve been having the usual problems with spammers loading my board with registrations and profile with links to porn and viagra sites. I’ve got account activation enabled but couldn’t find the link to Enable Visual Confirmation.

After a bit of searching I found out that the problem was that I had installed a custom template that didn’t support the option in the Admin > Configuration page to allow me to turn it on. After googling I found this article that allows you to check your template for compatibility with visual confirmation. After making a few mods, everything was good.

The only problem now was that they were still showing up in the memberlist which kind of defeated the purpose. A few more searches and I found this post that shows you how to make the mods needed.

All fixed!

Google Adwords in the wrong language

Thursday, May 31st, 2007

Just decided to put Google Adwords on my personal site and for some reason it’s coming up with ads in spanish. Since it’s a small site that I use as my homepage and therefore gets hardly any hits, this could be why but it’s in Google’s cache and so Adwords should know what language its in?

Time to go and investigate!

Edit: 12:45pm
Just been and looked again and now the home page is in English and displaying stuff relavent to the site. Guess the Adwords servers hadn’t looked at the page yet and the default Google advert is for spanish hotels? Random!

osCommerce: PayPal orders are missing

Tuesday, May 15th, 2007

I’ve been running a few shops on osCommerce all of which use PayPal as the only payment method. The problem I’ve been having is that I’ve been getting the confirmation emails from PayPal but when I log into the admin section of the shop, there is no order present, only the customers basic details.

Up until now I have managed as I know mySQL and PHP so have got their address from PayPal and checked the customer_basket table for the products they ordered so could manually create the order in the database without needing to contact the customer.

The last order I received however didn’t include any delivery address information in the PayPal details so I thought I would finally find out what the problem was and get it fixed. After a bit of Googling on a bunch of random bug reports (which I won’t link to as they weren’t very helpful), I found an article that explained it (which I won’t link to as I can’t find it again!).

The problem is that the orders are placed correctly if the user has a PayPal account already but if they use PayPal to pay by credit or debit card, either the session is lost when they return, or the user does not continue back to the site after paying, and so the order is not added to the database.

The solution: install the following module and use that instead of the default PayPal module:

osCommerce PayPal IPN Module v1.0 For 2.2MS2

This places the order before continuing to PayPal so that if something does go wrong, you still have all the information you need. I’ve just installed it and tried it and everything seems to be OK.

Silverlight: What’s the point?

Wednesday, April 18th, 2007

I was just on the Microsoft homepage and noticed a news item saying Silverlight is available for download. Out of curiosity I went for a look around to see what was on the mini-site. In case you didn’t know, Silverlight is Microsofts attemp to get some of Macromedia’s Adobe’s Flash market.

The reason they are going after this area of the software marketplace now is mainly due to the so-called Web 2.0. Major websites such as YouTube, Myspace and a whole host of other major sites are using Flash for their content and that has to annoy Microsoft.

The only problem is that the reason these sites use Flash is because everyone has it, around 98% of people on the internet. Microsoft will have to start from scratch with, erm… 0%. It’s going to be months or maybe a year or so before enough people have the plugin installed so that developers will even consider using it to develop content for their sites.

In my opinion Microsoft has got it wrong again, as they usually do when it comes to the internet. Nobody needs or wants another Rich Internet Application plugin and although I’m sure there’ll be extra functionality for IE users and APIs for .NET and IIS, we already have all this technology in one form or another. There really is no need for this - the internet should be built upon open, cross platform standards, not more propriatry software…. like eBooks maybe.

My bet is that Microsoft will do everything they can to use their Windows monopoly to get as many copies of the plugin out there and then try and use that user-base to pull people into becoming paying customers of various bits of software.

HTML5 is on it’s way

Friday, April 13th, 2007

In the past I’ve always been a bit lazy about keeping up with the cutting edge of standards and making sure the sites I develop are using the latest technologies. Part of the reason is because I’m so busy I have to wait until a technology goes mainstream enough that it get wind of it and to not use it would be to fall behind, or when I need to use it go get over the latest development speedbump.

The second reason is that the majority of the customers for the site that takes up most of my time are all in the NHS which used to refuse to get their PCs updated from Netscape 4 and IE5, so I had to be delibrately behind standards-wise.

Recently though, what with the emphasis on security, spam, viruses etc, everyone seems to be moving on to the latest browsers (ok - IE6 & FF1), plus the workload has been easing up a little so I’ve been moving some of the less updated sites from their older layouts to div/css style designs.

While I was doing this I thought I’d nip over to the W3C and find out what was progressing as far as the “next version” was concerned. Turns out it’s called Web Applications 1.0, but everyone seems to be calling it HTML5. I haven’t had chance to read the entire spec (it’s a bit to big), but having a glance around it there’s quite a bit in there that I like.

The emphasis as I see it seems to be on providing tags and elements to be used specifically for certain sections of the page. There are elements such as:

  • nav (for navigation),
  • article for the page’s main content or a blog post for example
  • section to break a page into… sections.

This should help a lot for larger sites when they’re creating templates for different areas of sites and also for SEO as it allows the search engines to identify which areas are considered “most important” by the developer without having to rely on only H1 and Title tags (I know there’s more to it than that - don’t start in the comments). I like this approach and it ahould be very yseful for most of the sites I develop.

The second thing I noticed was there was no tags in there for styling - everything to do with the asthetics of a page can now be left to CSS. Brilliant!

I also notced a few more onWhatever event handlers in there which I haven’t thought of any uses for yet but I’m sure I will over time. I like these as it means that we can develop more Web 2.0 type stuff without having to rely on flash, Java or other such technologies.

All in all, I like the progress thats been made but ordinarily I’d just forget about it now. That is until I noticed this on Slashdot saying that Apple, Opera and Mozilla are pushing for this standard to be adopted. That means that if it is, all the major browsers (apart from IE) will be motivated to get the standard built in, which should in turn push Microsoft to follow suit about 15 years later…

Re-apply to TradeDoubler Denied Program

Thursday, April 5th, 2007

I tried to apply to The Trainline affiliate programme on TradeDoubler and got refused for some unknown reason. It’s not as if it was for this blog, my other blog about drunkeness or even the adult goods store. Nope, it was for our NHS training business’ website. Who knows why they would think this was unsuitable to be an affiliate!

I went for a look around for other train ticket affiliate programs but for UK travel, it was pretty slim pickings so I decided to find out if you can apply again to the same program. Turns out you can by setting up another site in your settings… blah blah blah - read about it in the FAQ

Lets see what they say this time. If they say no, I’m getting the bus in a few weeks when I go to Newcastle instead of giving them my money!

Postcodes to Google Maps on your website

Wednesday, March 21st, 2007

In past projects I’ve used MultiMap links to give directions and maps to postcodes but for a new part of the Medicology site I wanted to embed maps within the webpage. As MultiMap don’t let you do this within charging I went in search of a free solution and came up with Google Maps.

Using the default Google Maps API you can only include maps based on longitude and latitude and not on a UK postcode. After a bit of searching I found a brilliant blog post on Tom Anthony’s site that shows you how to use a few JavaScript functions to center the map on a postcode and then place a marker there as well. After following the tutorial I got the map in place but I wanted to extend it so that as the page loads it automatically centers on the postcode and places the marker there.

To keep the code clean I put the map in an iFrame and the only PHP involved is to output the postcode into the page as a JavaScript variable. The rest is done purely through JavaScript and the Google Maps API. You can see it at the Medicology Venue pages. If you want to use it, go view the page source and save the JavaScript file. It’s easy enough to implement on your own site. Job done!