Magento defect in running multi-stores

First I want to declare – I love Magento very much!

但再完美的东西也是有缺陷的。正是因为 Magento 接近完美,所以改正它缺陷的愿望也强烈些。Magento website – store – storeview 3-tier 的模型逻辑分明,可是 Magento 在解释模型时用词不一致,造成最终用户和开发者如果是同一人的话思维混乱:

最终用户:website – store – storeview

These terms are used in documentation, and designer’s guide.

开发者:website – group – store

These terms are used in php code, and database table/field names.

这还是小毛病,关键是根据访问域名(或别的条件)加载不同的 website, store, storeview 时,我能看到的所有的指导都是叫我们修改 index.php,用一个条件选择 Mage:run(‘code’) 取代 Mage:run()。这样每次升级 Magento 都要特殊照顾一下 index.php,不符合 Magento 自己提倡的安全升级的原则。

其实如果是根据 base url 决定加载不同的 website, store, storeview,database 里已有对应的资料,就不能让 Magento 自己去选择加载,何必要用 php 再写一遍?因为 Magento overwrite 规则在 index.php 和 Mage.php 以后生效,所以我不欣赏修改 index.php 和 Mage.php 任何一部分。看来看去,只有 Mage_Core_Model_App 才是切入点,要写一个 Company_Core_Model_App 才能让 Magento 自动加载不同的 website, store, storeview。

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *