1

Converting the Default URL Separator to Dashes in Lemonstand

Posted (Updated ) in Database, PHP

When it comes to online shopping carts, LemonStand is the hot new thing. Still in beta, this piece of software boasts a surprisingly large feature set and high level of customization options usually only seen in much larger CMS’s. The one narking issue I’ve had with it so far is its choice of URL separator – preferring underscores over dashes. After speaking to the very polite and friendly developer behind LemonStand, a solution was quickly devised.

To convert the default URL separator from underscores to dashes simply add the following line of code to your config/config.php file.

$CONFIG['URL_SEPARATOR'] = '-';

‘…but what about all my existing pages and products!’ I hear you ask; well there’s a solution for that too. Upon looking at the database, a fix was quickly attained. This involves modifying the database directly (for the time being) but at least it’ll get the job done. Use this SQL:

UPDATE shop_products SET url_name=REPLACE(url_name, '_', '-');

Obviously this just fixes your products – you’ll need to find each relevant table and perform the same command on them to fully convert your site.

Update 3 Jun 2010: I’ve received word from the author behind LemonStand that he’ll be publishing an update later today changing the default URL separator from underscores to dashes. The change will not affect any existing installations and only apply to new installations. For developers wishing to change the default separator on new pages on existing installations, the fix above still applies. This is great news that I’m sure many developers out there will be pleased with.