Lack of ideas to manage javascript in Magento

In Magento System >> Configuration >> Catalog >> Frontend, when List Mode selected value is changed, some fields (i.e. Products per page on Grid allowed values, Products per Page on Grid default value, Products per Page on List allowed values, Products per Page on List default value) are shown/hidden accordingly. I had thought List Mode… Continue reading Lack of ideas to manage javascript in Magento

Lack of EAV framework for php

最近我在仔细研究 Magento EAV 的机理。 Magento 的强大跟 EAV module 的强大有很大关系,花点时间去研究很值得。我还发现 Magento EAV module 中一些不足之处,但我无力改进。于是想借鉴一下其他的 EAV framework 是怎么实现的,悲惨的是,如果说到 EAV php implementation,似乎 Magento EAV 就是唯一一个成熟的开源方案。但 EAV java implementation 倒有一些独立的选择。 这是不是暗示 php 先天不足?尽管 Magento 让 php 在电子商务领域出尽风头,但这很可能是 php 的极致了。

Improve Magento entity setup

Magento 文档鼓励用 entity setup (Mage_Eav_Model_Entity_Setup) 的方式去定义实体。这个类很强大,但我觉得不够灵活,因为无法用它精确控制 attribute, attribute group 和 attribute set。 Attribute group 和 attribute set 是在两个维度分组 attribute,这样来组织 attribute 基本够用。但 setup 这个类添加 attribute 时,有不够周到的逻辑: 如果 $attr[‘user_defined’] == 1 && empty($attr[‘group’]),那么这个 attribute 不会被添加到任何 attribute group 和 attribute set。我觉得更好的逻辑是添加到 general attribute group。 如果 empty($attr[‘user_defined’]) && !empty($attr[‘group’]),那么 $attr[‘group’] 会被忽略,attribute 总是被添加到 general attribute group。 没办法,已经这样啦,提供 install entities array… Continue reading Improve Magento entity setup

Dataflow profile back to work in Magento 1.5.0.0

Magento 1.5.0.0 目前还是 alpha2 版,因为安装到第二步就有一个很明显的 bug,本来想等等再用的。 可是 1.4.2.0 正式版 dataflow profile 跑不起来,一点 “Run Profile in Popup”,出来的 popup 就是空白。我很喜欢用外部编辑器格式化好数据,然后用 dataflow import 到 Magento 数据库。我有很多 modules 也用到 dataflow 来完成初始化,如果 dataflow 跑不起来,会给我造成很大的麻烦。 联想到 Magento 1.5.0.0 在 release note 里说到它对 dataflow 作了改进,我想很可能修正了 1.4.2.0 带来的 bug。两害取其轻,所以我跳过 Magento 1.5.0.0 的全新安装过程,用 1.4.2.0 的数据库让 Magento 1.5.0.0 跑了起来。果然如我所料,dataflow profile 在 1.5.0.0 下工作正常。

Too early to try Magento 1.5.0.0 alpha2

Magento 1.5.0.0 alpha2 出来了,我下载来尝鲜。可是,安装到第二步就进行不下去了。提示是: There was a problem proceeding with Magento installation. Please contact developers with error messages on this page. Notice: Undefined variable: params in /path/to/magento/app/code/core/Mage/Core/Block/Html/Select.php on line 142 这挺令人失望的。

Magento page speed benchmark

There are some website benchmark tools, looking after various aspects of performance. The tool I use most is Apache Benchmark, and parameters are 10 concurrencies, e.g. It reflects the status quo. I have a decent server but the sites are not busy. Since I dived into Magento, I have been spent quite a lot researching… Continue reading Magento page speed benchmark

yum install php-5.3-curl-zend-server

我快被 zend server 搞疯了。不过说到底是我自己不好——新装了一台 Fedora 14,添了 zend.repo 以后忘了运行 过了几天开始用它来调试 Magento。貌似 zend server php 替换了原有的 fedora php,因为 php.ini 是来自 /usr/local/zend/etc。这给我很大程度上一个误导,以为 zend server 已经装好了。 结果 Magento 跑不起来,第一个错误是没有 pdo,我略有纳闷,zend server 怎么不代我完成 pdo 安装?不过没细想,用 解决问题。(不过回想起来,也没搞清楚这到底装了哪个版本的 pdo) 随后发现进不了后台,第二个错误是没有 curl,这下折腾了两个小时,用 说已安装(fedora 把 php-curl 包含在 php-common)。然后我用 当然无济于事。试遍各种可能的命令都不成功,两小时后发觉 zend server 没装过,于是一装 zend server,顺利启动 Magento。 最后说一下,如果非要单独装 zend server 版的 php curl,可以用

Mage_Adminhtml_Controller_action

今天发现,我的所有的 admin controller 都写成了 extends Mage_Adminhtml_Controller_action。虽然不影响使用,我还是想把它改规范的驼峰式 Mage_Adminhtml_Controller_Action。 于是搜索了整个硬盘到底哪些文件里包含 Mage_Adminhtml_Controller_action,结果发现这个笔误还不少。而且不光我写的 modules 里有,Aheadworks, J2t, Plieninger 的代码里也有,最后发现源头是 koukou1985 的 Magento module creator。 看来 Magento module creator 流传甚广。