161 cards
Linked content

Websites, Stores, Store Views

Here is what can be set at each level:

Default Web Site Store Store View
Product attributes X X
Product prices X X
Product tax class X X
Base currency X X
(Default) display currency X X
Category settings X X
System configuration settings X X X
Root category configuration X
Orders X
Customer sharing X X

Thanks to F...

View Status of EE Mview Changelog Tables

This SQL:

select emm.view_name,
    emm.version_id as metadata_version,
    cl_max_versions.max_version as cl_version,
    (cl_max_versions.max_version - emm.version_id) as behind
from enterprise_mview_metadata emm
left join (
    select 'enterprise_url_rewrite_redirect' as view_name, max(version_id) as max_version from enterprise_url_rewrite_redirect_cl union
    select 'cataloginventory_stock_status_view' as view_name, max(version_id) as max_version from cataloginventory_stock_status_cl union
    select 'enterprise_url...
Linked content

Security problem: {block} has not been whitelisted

This is introduced by either SUPEE-6788, or Magento See the link.


The XMLRPC API parameters always confuse me, they're below:


<?xml version="1.0"?>

Order list:

<?xml version="1.0"?>

Creating a Datetime attribute that stores time

Magento has a Datetime backend model but formats a Zend_Date object without the time. So if you want to store datetime (actually with time) you will need to setup your own backend model.

Here is how i've done it:

class Namespace_Module_Model_Entity_Attribute_Backend_Datetime extends Mage_Eav_Model_Entity_Attribute_Backend_Datetime

     * Prepare date for save in DB
     * @param   string | int $date
     * @return  string
    public function formatDate($dat...

Admin Grids - Filtering A Joined Column

Often, you'll want to add a column to a collection used in a grid, and to do so you'd use _prepareCollection():

protected function _prepareCollection()
    $collection = Mage::getResourceModel($this->_getCollectionClass());

           array('table_alias' => 'some_long_table_name'),
           'main_table.something = table_alias.something',
           array('some_column' => 'table_alias.some_column')


Adding A Column to a Flat Table

Handy to add attributes to sales_flat_order:

        'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
        'length' => 1,
        'comment'=> 'Comment'

UK Tax / VAT Setup Script

This script sets up everything for UK VAT from a default install.

/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;

 * Define VAT band names
define('VAT_STANDARD', 'VAT Standard');
define('VAT_REDUCED', 'VAT Reduced');
define('VAT_ZERO', 'VAT Zero');

 * Remove current rules, rates and product classes
$taxCalculation = Mage::getModel('tax/calculation');
foreach (Mage::getModel('tax/calculation_rule')->g...

Generate Test Products

I took this script from somewhere (sorry I forgot where!) but it didn't work for, so I fixed it up. Really basic, but useful, I used it to test pagination:

require 'app/Mage.php';
for ($i = 0; $i < 100; $i++) {

Get Value of Product Attribute

This resolves the value of the attribute, so rather than supplying you with a value ID, it will supply you with the associated value, via the source model:


Non-Required Category Attribute Not Set in Global Scope

When a category is created whilst in a store scope, and a value is set against an attribute which has is_required set to false, and has a scope more specific than global, then a value is not set against the global scope, resulting in the store scope having a value, but the global scope having no value. This also has the effect of causing the flat category table for the store in question to have a null value for the attribute, even in the store scope that it is set in.

On this install, the attribute in question is display_as_link:



Magento Extension Companies

A work-in-progress, this is a list of companies and thoughts about each.

Company Type Comments
AheadWorks General
Mageworx General
Amasty General
Aitoc General
Magestore General
Xtento General
WebShopApps Shipping
Wyomind General
Fooman General ...

Get Methods of Class

Yes, very dirty, but it works a treat! Save this file in your Magento root directory, then fire up a command line and run whatever.php Mage_Core_Model_App (or some other class) and you should see the output.

Output looks like below:

$ ./classmethods.php Varien_Db_Adapter_Pdo_Mysql
__construct                      Zend_Db_Adapter_Abstract      lib/Zend/Db/Adapter/Abstract.php:43
__destruct                       Varien_Db_Adapter_Pdo_Mysql   lib/Varien/Db/Adapter/Pdo/Mysql.php:30
__sleep                          Zend_Db_Ada...

Getting the Theme In Use

How to get the theme for each component, works on the active store:


Layout Loading and Misc Notes

Layout XML files are loaded here via this stack - here we are loading the layout update for the rwd/default design package, for the CMS home page. I've put a dashed line on the demarcation between layout code and other code:


Magento PHP & HTTPD Timeouts









Resetting File & Folder Permissions

You might want to do this on media or elsewhere, handy cut-and-paste job:

find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;

Or with an xargs version (which should be faster):

find media -type d -print0 | xargs -0 chmod 0755
find media -type f -print0 | xargs -0 chmod 0644
This website uses short-lived cookies to improve usability.
Accept or learn more