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,… Continue reading Magento defect in running multi-stores

Make a future proof theme for Magento

很久以前做 Magento theme,直接把 default theme 所在目录复制到另一个目录。后来才知道定制 theme 不是这么干的,正确的做法是新建一个目录,要改什么文件就拷贝什么文件过来修改。这样既能个性化,又能向后兼容(如果修改部分跟新版本的 default 不冲突的话)。 Magento 在我做完 theme 后的某个版本开始支持 flat category 和 flat product,我一直无法垂涎这个功能,但一启用页面就是空白。知道今天才定下心来修改我的 theme 下的文件,把我没修改过的文件都删了。其实修改过的文件不多,十个左右,然后比较了新老文件(我修改的文件和对应的新版 default 文件)的差异,添加了一些 default theme 新增的语句,终于可以启用 flat category 和 flat product 啦。 因为产品不多,只有 200 个,感觉快了 3-5%,request per second 从 11 以下跃成 11 以上,Pingdom 测试也得到一个创记录的 2.23 秒(其中 index.php 的完成时间 0.6 秒,但 Pingdom 多次测试结果之间变化较大,大概跟 Pingdom 服务器当时状态有很大关系)。虽然没有体会到 Magento… Continue reading Make a future proof theme for Magento

top.links.phtml in Magento can be safely deleted

Magento 的 default, modern, blank 等 templates 都带有一个文件 top.links.phtml (在 template/page/html),第一眼看上去都会认为它是页面右上角 My Account, My Wishlist, My Cart, Checkout, Log In 的模板,但其实 top links 和 footer links 用的是同一个模板,即 template/page/template/link.phtml。 没有任何地方引用到 top.links.phtml,删了它一点事也没有;如果加载它,反而会出错。我猜 Magento core developers 原想把 top links 和 footer links 做成不同的模板,后来合并了模板,忘了删除一个废弃的文件?

Magento downloader remember server path

我多次把 Magento 从一个服务器移动到另一个服务器,一直认为 Magento 不在意安装路径的改变,因为 Magento 总是在运行时检测安装位置(对比 WordPress 把 server absolute path 保存在数据库里,而且每个上传的文件都要保存一遍,不可取)。但今天我发现我错了:Magento downloader 仍保存有部分 server path 的信息,迁移 Magento 到新服务器后,Magento connect 不能正常工作。 有人提供了以下方法查找替换 downloader 目录下所有文件里的 OLD_PATH 成 NEW_PATH: //shows all files with OLD_PATH element find . -type f -exec grep -q “OLD_PATH” ‘{}’ \; -print //Replaces OLD_PATH string in all occurrences in every file to… Continue reading Magento downloader remember server path

Download Magento via ssh

wget http://www.magentocommerce.com/downloads/assets/1.3.2.3/magento-1.3.2.3.tar.gz If you download Magento from the download page, you see this link http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.tar.gz. But you can not use wget http://www.magentocommerce.com/getmagento/1.3.2.3/magento-1.3.2.3.tar.gz without specifying referrer. Some technique of anti hot link is implemented there.

Do not give customers too many choices

跟各种各样的顾客打交道,自我感觉我还是有较高的“customer oriented”意识,我一直认为这有利于达成交易。 直到有一天,一个供应商突然通知我,某个第二天交货、双面印刷的订单他只印了一面,由于生产环境改变,他无法印另一面。我只有接受既成的事实,一方面安排运输,一方面想去通知客户这个坏消息。退客户一点钱倒是小事,当时我脑袋只想着事先告警好过客户收货以后发现该印两面的只印了一面。 但老板阻止了我通知客户。他认为在客户什么都没有看到的情况下,如果是挑剔的客户,得知这个坏消息可能会在电话里脱口说,“我不要了”;而客户在收货以后十有八九会象我一样接受既成的事实,毕竟产品质量没有问题。 我觉得我光想着给客户最好的服务,忽略了一些客服技巧。老板到底是老板,学习——

mysql_update

When using phpmyadmin, after select a database, then click on Privileges, you might run into a error saying Unknown column ‘Event_priv’ in ‘field list’ The error will go after you run mysql_upgrade in command line. I feel mysql query speed is improved after running “mysql_update”.

Connection speed of sourceforge

Connection speed of the Godaddy server is generally slower than the 1&1 server. It was test proven from Europe and China. However, when connecting to downloads.sourceforge.net, Godaddy is faster. The Godaddy server automatically chooses the mirror site softlayer.dl.sourceforge.net, and the average speed is 8.55M/s. The 1&1 server chooses dfn.dl.sourceforge.net, and the speed is 70K/s. When… Continue reading Connection speed of sourceforge

Gracefully restart Nginx

Follow these 3 steps to gracefully stop and start Nginx without losing any queries. It works like a charm. Test new configuration is correct nginx -t Find the Pid ps -ef | grep “nginx: master process” | grep -v “grep” | awk -F ‘ ‘ ‘{print $2}’ And kill it. Meanwhile, new configuration is already… Continue reading Gracefully restart Nginx