Posted: October 21, 2009 at 9:00 am | Tags: Apache
Everyone’s encountered those standard 404 error pages that yield little or no information. Most new systems have this feature built in by default and often times are pretty fancy with informative to funny graphics and lots of options on what to do next but, if your working on updating an old site not using dynamically based web pages then, your going to have to add one manually. For your user’s experience, it’s better to provide a helpful error message and links to where they can continue on their quest for information. You don’t want to scare your visitors away do you? Here’s how to add your own custom 404 error page to your website:
If you don’t already have an .htaccess file in your servers root, go ahead and create one. Now you need to instruct .htaccess where your custom error page is. In this example, I have the 404 document which I created with my editor that provides lots of useful information for users to continue browsing my site. Now add this line to your .htaccess file and that’s it!
ErrorDocument 404 /404.html
Posted: October 19, 2009 at 2:40 pm | Tags: Apache, htaccess
We all hate Leechers. Here’s how to stop them in their tracks from stealing your images and your bandwidth!
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !(^/robots\.txt|\.ico)$
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|pdf)$ [F,L]
Posted: October 13, 2009 at 9:19 am | Tags: PayPal

I’ve been working with PayPal PayFlow Pro a lot lately. But before I got the hang of it, I couldn’t figure out how to create a sandbox account for Payflow.
As it goes, it’s different than setting up a standard sandbox account. To set up a Payflow account for testing, you would walk through the sign up process as if you were signing up for a live Payflow account. Once you get to the section in the sign up process where it is asking for the billing information, just cancel out of the process. This creates a test account for you at this point, which you can access by signing into PayPal Manager with the login and password that you created. The partner will be PayPal.
Posted: October 10, 2009 at 7:38 pm | Tags: Apache, htaccess
Everyone who has tried creating a .htaccess on windows knows that Windows Explorer does not accept the ‘.’ character as the first character of a file. For most of you this may be old stuff, but for the newbies, the quick way to create a file that starts with a ‘.’ is actually pretty simple.
Open notepad and save the document with file name .htaccess with the ’save as type’ set to ‘All Files’; or save the document with file name as “.htaccess” including the quotes. Hope this helps someone!
Posted: September 14, 2009 at 7:27 pm | Tags: Apache, htaccess
Sometimes you may need to redirect http requests on port 80 to (https) on port 443. This can easily be accomplished with .htaccess.
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L]
Posted: August 24, 2009 at 9:00 am | Tags: Magento, PHP
In order to run a SQL query against the Magento database, you first need a resource model then a database connection.
$db = Mage::getResourceSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT 'entity_id' FROM 'catalog_product_entity');
if(!$result) {
return FALSE;
}
$rows = $result->fetch(PDO::FETCH_ASSOC);
if(!$row) {
return FALSE;
}
print_r($row);
Posted: August 21, 2009 at 9:34 am | Tags: Magento
The Magento Database Repair Tool compares 2 databases (reference and target), and updates the target database so it has the same structure as the reference database by doing the following:
- Adds missing tables, or repairs them to have the same engine type and char-set.
- Adds missing fields or repairs them.
- Removes inconsistent data from tables that have broken foreign key references.
- Adds missing foreign keys and indexes.
You can download it here. For a full list of features and instructions, you can refer to this wiki post.
Posted: August 17, 2009 at 9:19 am | Tags: Magento
If you need to add additional fields to Magento’s default contact form, read on! First open the form.phtml file located in your /magento_root/app/design/frontend/YOUR_INTERFACE/YOUR_THEME/template/contacts/form.phtml. So, we are going to add a subject field to this contact form so that customers tell us the subject of their email. Open the file for editing in your favorite editor.
Find this section in the file below (this should be around line 39):
<div class="input-box">
<label for="name"><?php echo Mage::helper('contacts')->__('Name') ?> <span class="required">*</span></label><br />
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="required-entry input-text" type="text"/>
</div>
We are going to add another field above this one for the subject of the email. Copy and paste this code above the block of code (name field) referenced above.
<div class="input-box">
<label for="subject"><?php echo Mage::helper('contacts')->__('Subject') ?> <span class="required">*</span></label><br />
<input name="subject" id="subject" title="<?php echo Mage::helper('contacts')->__('Subject') ?>" value="" class="required-entry input-text" type="text"/>
</div>
As far as Magento is concerned, it doesn’t care what fields we add to this form. It is written in such a way that it accepts all of the field posted for processing and send that out to the transactional e-mail form that you create. Now, go to System->Transactional E-mails in the Magento Admin section. Click “Add New Template” and from the “Template” dropdown box select “Contact Form” then “Load Template”. Under template content you will see:
Name: {{var data.name}}
E-mail: {{var data.email}}
Telephone: {{var data.telephone}}
Comment: {{var data.comment}}
Add your new field before Name: {{var data.name}} so that now it should looks like this:
Subject: {{var data.subject}}
Name: {{var data.name}}
E-mail: {{var data.email}}
Telephone: {{var data.telephone}}
Comment: {{var data.comment}}
Enter a new name under “Template Name” to save your new Template and click on “Save Template”. Now we need to tell Magento to use this new template for the Contact form. Go to System->Configuration and select “Contacts”. Under “Email Options”, select your new template under the “Email Template” dropdown box. Click on “Save Config”.
That’s it!
Posted: August 12, 2009 at 10:57 am | Tags: Magento
Here are some of the best Magento extensions that I’ve come across.
- Magento Live Chat
This free module will provide LiveChat support in Magento.
- Fontis WYSIWYG Editor
This extension gives you the option to enable a JavaScript WYSIWYG editor to specified admin pages. Currently available editors are: TinyMCE and FCKeditor.
- Lazzymonks Twitter
Displays Twitter updates in the menu and allows updates from within the admin panel.
- Events Calendar
With this extension, you can display an events calendar on your website. Events are stored in the database. You can also display the upcoming list of events quickly by calling a block in your template.
- Blog
Full featured blog extension for Magento.
- Raffle
This module gives you basic functionality to run your own raffles.
- Customer Groups Configurable Catalog
This extension enables you to hide categories and products from customers depending on the customer group.
- Exploded Menu
Replaces the standard single column drop down with a multi-column dropdown featuring 2nd and 3rd level menu items.
- Velite Magento Superstage
Functionality, intuitive interaction and product presentation with really high detailed images are the main features.
- Magento EasyLightbox
This small extension will help to install Lightbox widget. Installation and configuration will take approximately 5 minutes. No files are replaced and no codding experience needed to install!
- Magento Exploded Menu
Replaces the standard Magento menu with a multi-column drop down menu system.
Posted: August 10, 2009 at 10:15 am | Tags: Drupal, PHP
I’ve worked with Drupal in the past for several projects and have come across some modules that have become my favorites. Here they are:
- Tiny MCE
This module was the first to integrate Moxiecode’s popular TinyMCE WYSIWYG editor into a Drupal site for editing advance site content.
- Simple News
Simplenews publishes and sends newsletters to lists of subscribers. Both anonymous and authenticated users can opt-in to different mailing lists. HTML email can be send by adding Mime Mail module.
- Views
The Views module provides a flexible method for Drupal site designers to control how lists and tables of content (nodes in Views 1, almost anything in Views 2) are presented. Traditionally, Drupal has hard-coded most of this, particularly in how taxonomy and tracker lists are formatted.
- Panels
The Panels module allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout.
- Content Construction Kit (CCK)
The Content Construction Kit allows you to add custom fields to nodes using a web browser.
- Path Auto
The Pathauto module automatically generates path aliases for various kinds of content (nodes, categories, users) without requiring the user to manually specify the path alias. This allows you to get aliases like /category/my-node-title.html instead of /node/123.
- Five Star
The Five Star voting module adds a clean, attractive voting widget to nodes in Drupal
- Poor Mans Cron
A module which runs the Drupal cron operations without needing the cron application.
- Node Words
This module allows you to set some meta tags for each node, view or panels page.
- Global Redirect
Checks the current URL for an alias and does a 301 redirect to it if it is not being used.
- Page Title
This module gives you granular control over the page title. You can specify patterns for how the title should be structured and, on content creation pages, specify the page title separately to the content’s title.
- XML Sitemap
The XML sitemap module creates a sitemap that conforms to the sitemaps.org specification. The sitemap created by the module can be automatically submitted to Ask, Google, Bing (formerly Windows Live Search), and Yahoo! search engines.
- Print
This module allows you to generate page, email and PDFprinter-friendly versions of any node.
- Username Check
This very simple module allows visitors to check username originality quickly using AJAX request during registration (completing registration form).
- Node Hierarchy
Node Hierarchy allows nodes to be children of other nodes creating a tree-like hierarchy of content.