Magento 1.5 以后就允许修改订单地址了,Plieninger_Editable module 就没必要存在了,留着它反而会出错。
当年想找一个修改订单地址的方案,就找到了 Plieninger_Editable,一用就用了一年。虽然一直不满意它的界面,一直想自己写一个,但一直忙于其他事务。现在跟它说 bye bye,还是很感谢它的。
Magento 1.5 以后就允许修改订单地址了,Plieninger_Editable module 就没必要存在了,留着它反而会出错。
当年想找一个修改订单地址的方案,就找到了 Plieninger_Editable,一用就用了一年。虽然一直不满意它的界面,一直想自己写一个,但一直忙于其他事务。现在跟它说 bye bye,还是很感谢它的。
某些 php 函数的返回值毫无规律可循。比如
is_numeric("123")
返回 true;
is_numeric(" 123")
(前导空格)返回 true;而
is_numeric("123 ")
(后导空格)返回 false。
php 有灵活的语法,但每遇这种情况,我总是羡慕其他语言的严谨。
Where and how to change the code?
At first, I thought overriding Mage_Catalog_Model_Product_Type_Configurable::getOrderOptions().
Original code
$options['product_calculations'] = self::CALCULATE_PARENT;
change to
$options['product_calculations'] = self::CALCULATE_CHILD;
However, it does not work.
Then I tried to observe the event tax_rate_data_fetch and modify the rateRequest object. But inside rateRequest there is no reference to quoteItem. Only product tax_class_id is there. In the observer class, I do not know when to modify it without reference to quoteItem.
At last, I had to modify the code in class Mage_Tax_Model_Sales_Total_Quote_Tax. There are several places to change depends on System Configuration. Change where is appropriate.
Original code
$taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId());
change to
if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) { $child = current($item->getChildren()); $taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId()); } else { $taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId()); }
It is not a neat approach. Let me know if you have a better idea.
Magento 里还是有不少 bugs,我能看出来的就不少。可是我一直懒于 report bug,总觉得我都能发现的 bug,大把有人发现。
今天心血来潮,大概受“莫以善小而不为”驱使,平生第一次 report bug to Magento。事关 js/mage/adminhtml/product.js 文件里第406 行(Magento 1.5.0.1), 有个笔误,把 readonly 写成了redonly。Associated Products tab of Configurable Products 受此影响,本应只读模式的文本框仍可输入数据。
非常小的错误。
今后我把我的发现记载下来。
You might have noticed, some tools from jQuery are not fully functional recently. That could be caused by jQuery disabling hotlinks. jQuery UI theme switcher is affected. I call it a bug because jQuery team did not make necessary arrangement before enforcement of hotlink policy.
Nevertheless, how to reinstate thumbnails in jQuery UI theme switcher while waiting for jQuery team to release a hotlink compatible theme switcher? Easy, with my code – Themeswitcher Launcher.
jQuery(function($){ $('body').prepend('<div id="msdk-themeswitcher"></div>'); $('#msdk-themeswitcher').themeswitcher(); var srcStart = "http://jqueryui.com/themeroller/images/"; $('img[src^="http://jqueryui.com/themeroller/images/"]').each( function() { this.src = this.src.replace(srcStart, "http://static.jquery.com/ui/themeroller/images/"); }); });
Themeswitcher Launcher just does a simple job: replacing images source in theme switcher to another source static.jquery.com, which still allow hotlinking. You can replace with your domain if you host these images.
To save your time, I packaged jQuery UI theme switcher with my Themeswitcher Launcher. Please note I changed jQuery UI theme switcher slightly because I need it for Magento sites. I put function themeswitcher() into jQuery namespace to be standard jQuery plugin, so it can be working with javascript prototype framework.
Download msdk-themeswitcher-launcher.js.tar.gz
For those who are interested in my Magento modules: jQuery UI theme switcher and my Themeswitcher Launcher are integrated into my Msdk (Magento SDK) module – it is just an advertisement.
Linux is an excellent OS. Today something again proved my choice.
I was looking for a solution to convert Excel xls to csv format. This conversion is required by a Magento dataflow project.
Magento native dataflow comes with an XML Excel parser. For some reasons, it does not convert my xls files. I think it may be due to limited functionality of Magento XML Excel parser class, or encoding problem.
I need something which can reliably convert xls files from 3rd parties, which we have no control over how they produce xls files.
I was thinking of another php independent class called ExcelReader. However, ExcelReader goes beyond what I need. All I need is convert xls to csv, make ready for dataflow.
After a day’s research, finally xls2csv caught my attention. I would have found it earlier if I had searched by “linux command line convert xls to csv” earlier. It runs perfectly well on Fedora and CentOS as I tested.
Installation is straight forward. Run
yum install catdoc
FYI, yum install xls2csv, installs something totally different. I have not figured out what it is.
有志开发网店的好手、生手请留言。工作地杭州。
很多网站的促销都是做得不到位的。就是 Godaddy 难免也会有这错那错。比如我刚用它的一个 31% off no minimum voucher code 续了三个域名,付完钱以后她还在喋喋不休说再给个 20% off minimum $45。
当然 Godaddy 整体促销还是不错的,我写这些只是提醒自己不要犯类似的错误。
很久以前什么都不懂的时候,觉得能自己做 DNS server,为自己的域名解析,是件很了不起的事情。再加那是 ISP 的 Domain Manager 对批量域名的更新支持不足,而自己的 DNS server 能 GUI 和 command line 并举,满足我对批量操作的要求。
今非昔比。我倾向于放弃自行解析,重回 ISP nameservers 的环抱。这主要是基于以下考虑:
作为一个前期测试,今天先把一个域名交给 Godaddy nameservers 解析,试用一周,如满意就全盘放弃自己的 DNS。
今天终于把一台服务器从 Fedora 10 升到了 Fedora 14,一开始想用 yum 升级(在 fedora upgrader 的帮助下),尝试跳级升级的,不成功。然后用 Fedora 自身的 major upgrade,分别尝试了跳级升级和不跳级升级,都不成功,最后卡在 Fedora 11 拷贝完升级文件但进不了图形界面完成升级,彻底动弹不得。很懊恼,早知如此还不如一开始就全新安装,就是想绕开重建 server 的麻烦,但这看来是绕不开的。
稍后我列出此次升级的 checklist(以前陆续也写过,但有两年没干这活了,变化还是很大)。
此次升级损失了 DNS slave zones 的文件。本以为主 Server 有备份,但主 Server 几次搬家,什么时候把那些文件搬丢了也没印象了。
升级的起因是我需要 php ssh2,却发现 Zend Server 暂不支持。不想经历自行往 Zend Server 添加 php ssh2 的麻烦,就想回到 Fedora 管理下的 php。不久前说过,我觉得 Zend Server 是鸡肋,这下更坚定我的看法。