This is just a quick post about how to change the “Category” wording on the layered navigation of a site. I needed to change it to “Brand” and it took me a few minutes to locate the correct files as the developer guide lines were not showing up. I thought for this reason I will make a quick note of it here on my blog.
The file you need to look in is:
/shop/app/design/frontend/default/default/template/catalog/navigation/left.phtml
Remember default/default should be changed to your current interface and theme for the site.
In this file around line 46 you should see a line of code looking like this:
__('Category') ?>
Change this to whatever you want to display eg. ‘Brand’. So my line will now look like:
__('Brand') ?>
Save the file and hit refresh and voila! New title in your layered navigation.

Magento
A site we were developing needed to have the wording “My Cart” changed to “My Basket” in the header links of the site.
To do this we made a translate.csv file under “/app/design/frontend/default/default/locale/en_GB/”
The “en_GB” could be whatever locale you are using. Our store is setup for the UK so it is “en_GB” the US would be “en_US”.
Also the template could differ, we were using the default template.
Now in the translate.csv file add the following lines:
“My Cart (%s item)”, “My Basket (%s item)”
“My Cart (%s items)”, “My Basket (%s items)”
“My Cart”, “My Basket”
Save the file and upload it to the location above. Login to the admin and refresh the cache by going to System->Cache Management. Select refresh in the drop down and press “Save Cache Settings”
Refresh your website front end to notice the difference.

Magento
Just a quick post but it is one that I had to use recently so thought I would quickly make a note of it so that it helps others out.
With the new year coming I had to update a sites copyright year which was displayed in the footer. It was a simple enough thing to do but I feared that I would need to be doing it again this time next year.
The solution was to use PHP to output the current year.
echo date("Y");
If your server doesn’t support PHP check see if there are any other server side scripting languages such as ASP, Perl, Python or Ruby etc They all have similar functions for returning the current year.

PHP
Today I needed to remove sound from an a flash video that was playing in the website. I was hoping that I would not have to get the DVD out and re-encode it for the web as this took me quite some time to get it to the required level of quality/size.
After a bit of searching with google I came across FFMPEG which turned made the task really easy.
ffmpeg -i input.flv -an -vcodec copy output.flv
-i is the input fil
-an disables the audio which is really important here.
-vcodec copy ensures that the codec of the input file is used for the output file.
output.flv is the name of the output file.
Hope that you find this useful! I know it saved me some time!

Development, Web
Im uploading this scaffolding class so that hopefully some other people can find use for it. It is based on the excellent tutorial on building a scaffolding class by Ben Hirsch which can be found here http://www.shadow-fox.net/site/tutorial/39-Creating-A-Scaffold-like-Class-in-PHP-or-An-Automatic-CMS-For-a-Table Sadly i can’t seem to find the original post however I’m sure its nothing a quick google can’t fix.
There is a link to the download at the end of this post.
I have used it to get projects going quickly. It can be pointed to a mysql database and can read the tables in etc and generate the CReate Update and Delete (CRUD) similar to how ruby on rails has scaffolding.
It is by no means perfect and could do with some refinements here and there. It is however quite functional in its current state and has support for foreign keys and image uploads.
There are some naming conventions to be adhered to if you want to get the most out of this. However you can quickly go through it and change these to whatever you like.
Here is a list of column names and how the Scaffolding Class reacts to them:
| Column Name |
Data Type |
Scaffolding Output |
| image_url |
varchar(255) |
Image Upload Field |
|
varchar |
Text Input |
|
text |
Textarea |
| “foreigntable_id” |
INT |
Outputs the “name” field from the lookup table “foreigntable” |
|
datetime |
A date/time drop down selector. |
| Last three characters ‘_on’ |
INT |
A Yes/No drop down selector. |
I have used this for many projects to get them off the ground. For simple admin areas it works perfectly.
Would love to hear your thoughts and comments.
Download Scaffolding.zip

Development, PHP
I had the need to backup an entire site and its content when I couldn’t get access to the FTP details quickly. Luckily the site was just static content so I was able to just use one of the many tools available in a regular linux shell.
Here is the code I typed into my terminal:
wget -m --tries=5 "http://www.foo.com"
The “-m” from the Man pages states that it is mirroring where it will follow links around the pages. The “–tries=5″ will stopĀ wget from running into an infinite loop.
I’m not sure how well this will work with dynamic sites it may just capture the HTML of the outputted server side script but at least its better than nothing.
Further options such as:
--referer=www.google.com
For setting the referrer and:
--user-agent=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090717 Fedora/3.5.1-3.fc11 Firefox/3.5.1
For setting the user agent if a particular website is proving tricky to download.

Tools
Hi this is my first post in the way of development on my blog.
I have decided to upload my database class that I use for projects. Its by no means perfect. There is quite a heated debate on Singleton classes themselves. However I like how it works for me. I can query query a database quicklyby simply using:
<?php
$db = Database::getInstance();
$results = $db->query("SELECT * FROM test WHERE name = :name",array(":name" => "matthew"));
print_r($results);
?>
Read more…

PHP
Database Class, PHP, Singleton Database Class