Fixed: Postcode validation does not work in Admin Create Order screen

Edition: Magento Community

Recently I hit upon a problem where, in the Admin Create Order screen (Admin > Sales > Orders > Create New Order), I selected a postcode-optional country and left the postcode field blank, but Magento was still validating the field and spitting out an error message:

Billing Address: "Zip/Postal Code" is a required value.
Shipping Address: "Zip/Postal Code" is a required value.

So why was Magento trying to validate a field that it shouldn’t?

After much digging, it turned out that the postcode attribute of the customer_address entity was missing the data_model Mage_Customer_Model_Attribute_Data_Postcode, which is what checks the config and tells Magento to validate the postcode or not.

Fixing it then was rather simple – just add the class group name ‘customer/attribute_data_postcode’ to the data_model field in the customer_eav_attribute table of the database.

Magento: Create Free Shipping Rule

In Admin panel:

  1. Create a new Shopping Cart Price Rule.
  2. On the conditions tab, specify your conditions.
  3. On the Actions tab, set ‘Free Delivery’ to something other than ‘No’
  4. Save rule.
  5. Enable Free Shipping shipping method in System > Configuration.
  6. Set Minimum Order Amount to something ridiculously high.
  7. Save configuration.
  8. Test your rule.

Install Magento over SSH

Installing the sample data (this has to be done first, if you want it)

tar -zxvf magento-sample-data-
mv magento-sample-data-* magento/media/
mv magento-sample-data- magento/data.sql
chmod -R o+w media var
mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < data.sql chmod o+w var var/.htaccess app/etc rm -rf magento/ magento-sample-data- magento- magento-sample-data- data.sql

Installing Magento

tar -zxvf magento-
mv magento/* magento/.htaccess .
chmod -R o+w media var
chmod o+w app/etc
rm -rf magento/ magento-

Five Minute Guide: Join data from two tables in one collection using filters

Let’s say you have related information in two separate tables in Magento, e.g. news articles and authors. You can get a collection of news items easily enough with:
But how can you get the author information in the same collection? Here’s where collection filters come in handy. They basically allow you to add joins to a collection.

In your Block class, instantiate the collection and call the filter, passing the author ID:

class News_Block_Article_List extends Mage_Core_Block_Template {

* Get all articles associated with author
* @param $authorId
public function getArticles( $authorId ) {
return Mage::getModel( 'news/articles' )->getCollection()->addAuthorFilter( $authorId );

Then define the addAuthorFilter() method in your Resource Model:

class News_Model_Resource_Article_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {

* Filter news articles by author
* @param $authorId
* @return $this
public function addAuthorFilter( $authorId ) {
$this ->addFilter( 'author_id', array( 'eq' => $authorId), 'public');

return $this;

* Hook for operations before rendering filters
protected function _renderFiltersBefore() {
if ( $this->getFilter( 'author_id' ) ) {
array( 'na' => $this->getTable( 'news/authors' ) ),
array( '*' )