Categories


Archives


Recent Posts


Categories


Code as a Second Language

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Subtitle: Why Magento sometimes makes people crazy.

Pop quiz. What does this bit of code do? Hint: It’s used on the catalog search page, and “query” means the text a user entered

Mage::helper('catalogsearch')->isMinQueryLength()

If you said

returns true if the search text is of the minimum query length

You’d be logically right, but 100% wrong. This method returns true if the query text is too short

My guess is this method was written by a non-native english language speaker, and something got lost in the translation.

Copyright © Alan Storm 1975 – 2018 All Rights Reserved

Originally Posted: 25th July 2013