Author: 芳草苑主

  • If you missed anything after customising all email templates in Magento

    To double check if you missed anything after customising all email templates in Magento, you can do a File Search on Selected resources (app/locale/(locale_code)/template/email in eclipse with these keywords:

    • (555) 555-0123
    • magento
    • demo

    By the way, eclipse can do Replace on Selected resources, which is an equivalent tool of File & Replace in Folder using Notepad++. I am sure a single linux command can also do the job but I can’t remember the syntax. Let’s just use eclipse, straight forward.

  • Add a section in Magento system configuration

    Want to add a section in Magento system configuration? It seems very easy as mentioned by others. No coding but editing xml files. Magento takes care of the rest. However, it still took me two hours to find the way out. So I think I need tell the world the caveats.

    • A section will not be shown if it is empty (no fields inside). Ditto tab or group.
    • acl must be defined per section in config.xml, otherwise you get Access Denied message.
    • Re-login is required, otherwise you still get Access Denied message.
  • Wysiwyg on individual page basis

    Html wysiwyg editing is good, but the html wysiwyg editors do not always format text as I wish. Sometimes they transforms some characters which I want to keep them intact.

    For example, I wanted to rewrite some of my posts on this blog by hand coding the post. But I must turn off wysiwyg editing in WordPress globally before I can save my post. Another “but” is I do not want to turn it off globally because it is a handy tool for writing some other posts. So I want wysiwyg on and off on individual page basis.

    For another example, Magento 1.4 now has wysiwyg editor built-in. However, it can’t recognise Magento’s mark-up tags for CMS block or CMS page. It wasted me an hour’s work by stripping these tags in a second after I clicked “Save”.

    In short, for people like me enjoying hand coding, I think a wysiwyg on-off attribute for each page basis would give me the best of both worlds.

  • Magento order fulfilment templates

    I said Magento was week at backend, that might be wrong. Of course compared with any accounting or ERP software, Magento is lack of some facilities to control the work flow of order fulfilment. When I dive into Magento backend, I think it should be sufficient for most of business. Most of business do not need an extension to fulfil orders, only need to customise the templates involved.

    Supprisingly, the templates are separated. I mean, Magento does not offer an overall template to generate different but related documents. For example, I must go through all the areas in the following table to change what to show up as order items detail.

      Frontend Backend
      Screen Print Email Screen Pdf
    Order thead          
    tbody          
    tfoot          
    totals          
    Invoice thead          
    tbody          
    tfoot          
    totals          
    Credit Memo thead          
    tbody          
    tfoot          
    totals          
    Shipment thead          
    tbody          
    tfoot          
    totals          

    Separating those templates make the programming less hassle, and the template changer can understand them easily. However, if I am that template changer, I hate copy & paste. As a programmer, I do my best to avoid delivering a program which require people to copy & paste.

    More importantly, if a template changer forgets to go through the above checklist to make a simple change in the order items detail, admin and customer get different view of the same order on screen, in email, or print-out when ordered, invoiced, credited, or shipped. I do not think this approach is acceptable. It is on my agenda to write an extension to make these documents under control.

  • Create FTP users on Godaddy free products

    前文讲到 Godaddy 随域名附送的免费空间非常强大,不嫌广告烦的话,做个个人网站绝对没有问题。

    既然可以建网站,就可以作文件服务器,支持 FTP,能自助创建多达50个 FTP user。

    Create FTP user in Godaddy hosting account
    Create FTP user in Godaddy hosting account

    Godaddy hosting account username / password 本身也是 FTP account。如果是合作伙伴要求上传或下载文件,当然不可以把自己的 username / password 告诉别人,应该分别为他们创建单独的帐号。Godaddy 需要十几分钟完成帐号同步,所以要等帐号状态从 Pending Setup 到 Setup 才能用。

  • Eclipse XML formatter

    Magento 有个我早就知道的 bug:读入 module config.xml 时,class name 必须在和 xml opening tag & closing tag 写在一行上,而且中间不能有 white space。这个 bug 直到最近的 Magento 1.4.0.1 都还有,可能 Magento 认为这不重要,重要的是如何书写 config.xml。所以我写 config.xml 一直都很小心。

    <catalog>
    	<rewrite>
    		<convert_adapter_category>MyNamespace_MyModule_Model_Eav_Convert_Adapter_Category</convert_adapter_category>
    	</rewrite>
    </catalog>
    

    但最近一次写完了 config.xml 下意识地按了 Ctrl + Shift + F 格式化了 config.xml,而这一行很长,eclipse XML formatter 自动把它换行书写了,造成 Magento 无法正确读入 class name。页面出不来了,什么原因?!我花了差不多一天时间才找到原因,一看到是这个原因,我又非常地懊恼——都是因为我懒,没有好好设置 eclipse 为我所用。

    Preferences for Eclipse XML formatter
    Preferences for Eclipse XML formatter

    于是亡羊补牢,我花了几分钟找到设置所在,把 Line width 设定一个足够大的数字就不怕它换行了。Aptana plugin 也带一个 Aptana XML Editor,另有地方设置,这里不多说了。

  • Godaddy PR girl

    godaddy-girl
    Godaddy PR girl

    Godaddy 形象小姐笑得越来越吸引人了,Godaddy offer 也越来越吸引人了。$40 就可以省20%,可惜暂时不想买它什么服务。

  • Hotmail now open for POP3

    微软被人诟病得比较多的地方,一是卖得贵,二是不开放。我觉得卖什么价是微软的事情,只要它觉得有市场,谋求利润最大化不该受到指责;但我深恶痛绝不开放的行为。

    用户在选择一个产品前,不会了解这个产品的所有功能和限制。只有在使用产品的过程中,不停地发掘它的功能也了解到它的限制。如果发掘了一项功能是意料之外的,那就是惊喜,如果了解到一项限制是卖方强加的(不是因为成本高昂或技术不成熟),那就是不给用户自由——希望用“不开放”去限制用户不去选择竞争对手的产品?那是不可能的。我更甚之,如果哪个卖方敢这样干,我立马改投它竞争对手的环抱。

    所以,我说 Google mail 比 Hotmail 好,主要是因为 Google 远比微软开放。

    今天发现,有人博文说 Hotmail 支持 POP3 了。很久没用 Hotmail 了,我也不晓得它什么时候开始支持 POP3。我赶紧试了一下,果然,Google mail 里很轻松地把 Hotmail 帐号添加了进来,而且 Google mail 一见到是 Hotmail 帐号,直接把参数给设置好了。

    Gmail add another account from Hotmail
    Gmail add another account from Hotmail

    看来微软也在进步,不过是不是太迟了点?我从不用 Hotmail 作邮箱 (only as IM),不过还是很高兴看到它支持了开放协议。

  • Gmail search auto complete comes out of labs

    刚刚发现 Gmail 里开启了 auto complete (search suggests),以前还是 Labs 里的一项功能,我并没有启用。这下倒好,Gmail 自说自话启用了,关也关不掉。

  • Better to custom Magento interface from base/default

    Magento 官方推荐以 blank interface 为基础开发个性化的 interface。这说法没错,但有局限性。如果不熟悉 Magento interface 的构成,blank interface 确实一个很好的出发点,如”blank“的名称所言,它没有花里胡哨的背景影响你的构思,如果你是设计师,blank interface 给了你极大的方便。

    但世上难有两全其美的事情——blank interface 方便了设计师,但不方便最终用户(我指后台用户)。设计是一时的,用户是一世的,所以我认为两者有冲突时应该更多地照顾用户。Magento interface 有三层 fall-back 机制,在 System > Configuration > Design 可以设置 theme 和 default theme,系统还有最底层的 fall-back to base/default。

    设想一下,如果基于 blank interface 开发 my_wonderful_theme,那在后台只能设置 theme 为 “my_wonderful_theme”,设置 default theme 为 “blank”。同时,严格按照 Magento 的规范,只把 “blank” 中需要修改的文件拷贝到 “my_wonderful_theme” 中进行修改。最终 “my_wonderful_theme” 保存了一些修改文件。如果全站页面统一使用 “my_wonderful_theme”,则没有问题;可是,Magento 允许个别 cms, category 或 product page 使用不同的 theme,通常会是 “my_wonderful_theme” 局部的变种,这样就有问题了。假设需要对某个 category 下的页面使用 “my_fantastic_theme”,而 “my_fantastic_theme” 只是在“my_wonderful_theme” 基础上修改了 header 部分,但 “my_fantastic_theme” 无法就它所缺的文件 fall-back to “my_wonderful_theme”——很可惜,Magento 只提供了三层 fall-back 机制,假如它就多给一层 fall-back,那就没有我这篇文章了。

    简言之,如果基于 blank interface 开发,那么 cms, category 或 product page 里的 custom design 功能就成了鸡肋。如果设计师/开发者交付一个基于 blank interface 的 theme 和若干变种,用户无法方便地完成切换,这就是个败笔。以后还是以 base/default interface 为起点开发吧,其实也很方便。