Magento data-install script

Posted by Vladimir Kerkhoff on Stack Overflow See other posts from Stack Overflow or by Vladimir Kerkhoff
Published on 2012-06-21T11:13:46Z Indexed on 2012/09/23 15:38 UTC
Read the original article Hit count: 173

Filed under:

I'm trying to build a data install script that I use to setup a new webstore. This script creates the categories, pages and static blocks and default settings for the specific shop (we use a multistore setup to host the shops). In our dev/staging setup this scripts runs great and all categories are build without any problem. But on our live system this script fails. After some debugging I found the difference is in the Flat catalog usage on the live systems.

The problem with creating the category with the flat tables enabled is in getting the parent path information based on the parentId given:

$parentCategory = Mage::getModel('catalog/category')->load($parentId);

Without flat categories enabled this gives a correct parentCategory, but with flat categories enabled it gives an empty object.

Why is this behaviour with flat categories enabled?

© Stack Overflow or respective owner

Related posts about magento