Author: 芳草苑主

  • Zend Framework in Magento

    The library of Zend Framework included in Magento under lib folder is not the genuine Zend Framework. Although I don’t know why Magento did that, I do know:

    • If I replace Magento lib/Zend with genuine ZF, Magento throws errors.
    • If I put geninue ZF in php include_path, Magento appends it to its own include_path, and Magento runs into fussy status. I notice email facility stops working. There may be more functionalities affected.
    • I have loads of code extending Zend_Form. I was intended to reuse them in Magento without rewriting. However, Zend_Form depends on Zend_View, which is not handy in Magento.

    As one of caveats I’ve got from Magento, is whenever possible, avoid touching Zend classes directly.

  • Signs

    It is my first time put Flash Video on my blog. Although I do not like Flash, I hope you enjoy the video.

  • Badass and Caveats

    学到两个英文单词,Badass and Caveats,字典里不容易查到。

    Badass 竟然是褒义词,意思是很优秀的、非常好的。我看了金山词霸的翻译,是错的。

    如果把注意事项翻译为 Caveats 就很地道。可惜,拿 Google translate 英译中得到“注意事项”,但中译英只得到“notes“。

  • Evil iphone data roaming

    不久前细数了 iphone 若干桩罪,如今又多出一桩:

    老婆带着 iphone 回了一趟中国,结果弄出了近300镑的数据费。iphone 是个老虎机,这数据漫游费我也没意识到,不然我会事先提醒老婆。不过,O2 iphone 出厂设置就是这种老虎机设置(data roaming on),我觉得它居心叵测。

  • Why is it funny for Wong Fook Hing Book Store?

    今天一个英国朋友发给我一个笑话,是一幅图——黄福兴书店(Wong Fook Hing Book Store)。我 google 了 Wong Fook Hing 好久,学了很多背景知识,也没发现它的好笑之处,看来对英国文化还是不够了解。

  • Magento database fetch mode

    I was used to write $modelName->column_name to get attribute value in database. It requires $resource->_getReadAdapter()->setFetchMode(Zend_Db::FETCH_OBJ);.

    However, it is not Magento’s default fetch mode (default is Zend_Db:FETCH_ASSOC). Whenever fetch mode is changed, it must be changed back to the default after using it. Otherwise, method getCollection() of ALL models will stop working. There may be other side effects if you leave the adapter’s fetch mode changed.

  • Beauty Ady

    小女有个跟安以轩音似的名字,但我给她取名时,我并不知道安以轩的存在,因为好久不看中国电视剧了。最近无意中发现竟然有个美女叫安以轩,而且身为圈内人士,名声却是例外地好,太让我高兴了。我衷心祝福她,当然啦,也祝福小女。

    收集了几张安以轩的照片摆显摆显。我本不喜欢芳草苑太花俏,下载了 Nextgen Gallery 一直没有 activate,今天破个例——Nextgen Gallery 挺好的。

    Adorable Ady

    Image 1 of 8

  • We can not argue with PayPal

    我用 PayPal 多年,但还是得不时应付意想不到的新情况。

    因为 PayPal 不是我公司的主 PSP,我也不是 PayPal 帐户的日常管理者,所以当我注意到7月底一笔交易被标注上 Reversal 时已经是8月底了。当时忙,没去理会。这笔交易虽然被 reversed,但没有通知我们有 dispute,在 Resolution Centre 也找不到这条记录,直接就被 reversed。可能当时 PayPal 有发邮件,但我不是 PayPal 邮件的接收者,大概那信跟一般的到款扣款通知太相似,我同事收到也没警觉(PayPal 的大部分信我们都不看)。9月底我有空了,想起这桩事,打电话给 PayPal 问原因。

    我以前知道 PayPal 独创了 eCheque,顾客在 PayPal 余款不够时仍可以下单,款项由 PayPal 从顾客的银行帐户里划,PayPal 划款成功后再转给我们,通常需要5到7个工作日。我们的 bookkeeper 恨死了 eCheque,因为它给帐目处理带来了极大的麻烦——这时题外话。

    eCheque 虽然麻烦,但还是安全的。可我以前不知道,顾客在 PayPal 余款不够时还有另一种付款办法,就是 instant payment。仍是由 PayPal 从顾客的银行帐户里划,但 PayPal 即时就划款给我们,如同顾客用 PayPal 余款付款。如果日后 PayPal 从顾客的银行帐户里划款失败,PayPal 就把钱从卖家帐上 reverse 过去。必须是 bank account verified 的顾客才能用 instant payment。如果卖家对 reversal 有异议,必须在 reversal 之日起7日提出。

    一切都是 PayPal 定的规矩,不给人 argue 的余地。我是一个喜欢规矩的人,没有规矩不成方圆嘛,尤其欣赏美妙的规矩,比如数学的定理、Magento 的框架——又扯远了。PayPal 定的规矩,大部分是合理的,否则 PayPal 也不会做大。但这次被它的规矩套进去,我总有点不是滋味(虽然不是我的钱),只能敬告我自己:PayPal 邮件要封封读,或者帐户要日日看。

  • Surcharge on card payment in Magento

    I just searched for a solution to surcharge customers for a certain PSP in Magento. The only thing I could find a module which priced at USD 49. I also found a lot of argument about whether card payment surcharge is illegal or against PSP’s policy, to which I do not care. What I do care is a free and easy solution to do the job.

    Looking at Promotions -> Shopping Cart Price Rules, we can give discount for some kinds of payment method. But the discount can not be minus, which makes it work as surcharge. However, Magento only validates discount must be positive when saving a shopping cart price rule to database. It does not validate again when applying this rule. Therefore, we can make up a rule, enter discount with a positive value, then change the value to minus in database. That’s all you need to do to surcharge customers.

    By the way, I think Magento validation on discount limits its usability. Why not use the salesrule module for both promotions and surcharges? I really like to see the menu Promotions be replaced by Sales Rules. (The word salesrule is already being used as table name and in script.)

  • PayPal Spoof

    PayPal Looks Like Phishing
    An email from PayPal: looks like phishing

    I had an email from PayPal a while ago. I believe it was sent by some careless staff of PayPal.

    PayPal always remind people aware of phishing emails. At the bottom of the email, it says – How do I know this is not a spoof email? Spoof or ‘phishing’ emails tend to have generic greetings such as “Dear PayPal member”. Email from PayPal will always address you by your first and last name.

    However, this particular email address me “Dear First Name Last Name”.