Tag: magento

  • 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 声称在 2,000 个产品时能有 40% 的速度提升,我还是很高兴。

    顺便我把 Magento 从 1.3.2.1 升级成 1.3.2.3,先用的是 magento connect 升级(以前有过一次 magento connect 升级失败的经历,这次想 give magento connect another try,考验一下它)。升级过程没有提示有错误,升级后前台也正常,可后台 system -> configure -> catalog -> frontend -> Use Flat Catalog Category / Use Flat Catalog Product 消失了, system -> configure -> admin 也不见了。只好 ssh tar 解压源文件全部覆盖了 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 NEW_PATH
    find . -type f -print | xargs sed -i -e ’s/OLD_PATH/NEW_PATH/g’

    我试了试,查找替换是成功的,但 magento connect 还是不能工作,还是把 downloader 删了重装一遍来得干脆利落。

  • 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.

  • Magento extensions worth my trying

    I went through Magento Community Extensions, and short listed the following extensions worth my trying.

    MagentoLiveChat

    This module will provide a LiveChat support in Magento.
    It don’t depends third party platform
    It don’t require to fill a form before start a conversation
    It identify automatically registered user
    It provide information about the current page of the customer
    It can provide useful information about transformation rate
    Conversation are archived and available forever
    It support multiple site
    It support multiple operator
    LiveChat behaviour can be customised with advanced configuration options
    Apppearence can be easily customised with css

    YALC – Yet Another Live Chat

    This module was designed as an alternative to Magento Live Chat module. This module will help you integrate your Magento store with Google Talk. YALC – will allow you to use Google Talk service to support your customers. The main advantages of the module Luxe YALC module is:
    1. Reliability. Server, even at the most reliable hosting services less reliable than Google.
    2. Speed. Since the entire load on the transmission of messages rests with the Google Talk service is the work of IM does not affect the speed and load on your server.
    3. Privacy. Communication takes place completely anonymously, ie, your client can not even your Google Account.
    4. You can chat simultaneously with an unlimited number of users.
    5. Increased number of users does not affect the speed of chat.
    6. Free of charge. All you need – register Google Account for your support service.
    7. You do not have to constantly keep running a third-party chat client. You can use for chat your favorite IM
    8. All chat history is stored in Google Account, so you can always revert to it if you have forgotten. Google search helps you quickly find the needle message.

    I do not agree with “Server, even at the most reliable hosting services less reliable than Google”. In April I noticed Google Chatback had been down for several days. My server can be more reliable than that record. Anyway, it does not devalue this extension.

    Magento Community Modules – Chinese Simplified (China) Language Pack

    Chinese Simplified (China) Language Pack

    Customer Groups Configurable Catalog

    This extension enables you to hide categories and products from customers depending on the customer group.

    J2T Points & Rewards

    Points and rewards module

    Magento EasyLightbox

    Magento Easy Lightbox Community Module

    Magento EasyFlags

    This small extension will help to convert default magento store view switcher into nice flag buttons. Installation and configuration will take approximately 5 minutes. No files are replaced and no codding experience needed to install!

    Magento Easy Catalog Images

    Magento Easy Catalog Images Community Module

    Blog

    A Blog build from scratch to work seamlessly in magento.

    Customer Universal Password

    Log in on front as any customer using universal password for administration purposes

    Drupal

    Drupal extension is a set of Core API extensions that offers a full access for Drupal modules to Orders, Catalog and so on.

    This extension, will offer you to TOTALLY bypass Magento front office, using Drupal instead.

    When a new user is created a Magento user is automatically created also.
    Orders can be created from Drupal, cart is managed from Drupal.
    Catalog is syncrhonized, so each Magento Product is a Drupal node that you can push into Views, etc….

    Exploded Menu

    Replaces the standard single column drop down with a multi-column dropdown as used on sites like www.asos.com This style of menu is ideally suited to sites with a large number of categories/sub-categories. Templates and skins are provided for the default and modern themes

    Gift Certificates / Cards

    Allow your customers to purchase and use Gift Certificates.

    Fontis reCAPTCHA

    Adds reCAPTCHA to “Send Email to a Friend”, “Contact Us” and “Account Creation” pages.

    Google Maps Store Locator

    Google Maps Store Locator

    Magento Community Modules – English (United Kingdom) Language Pack

    Magento Community Modules – English (United Kingdom) Language Pack

    Change Attribute Set

    In Magento every product has a fixed attibute set. This module enables you to switch it.

  • Magento Skip Base URL validation before next step

    终于明白 Magento 在安装时问的一个问题是什么意思了:

    Skip Base URL validation before next step

    Check this box only if it is not possible to automatically validate Base URL. 

    如果给 Magento 指定一个 Base Url 在 internet 上不可解析,比如在开发阶段使用一个 Base Url 只在本机或内网内访问,则必须跳过 Base Url validation。

  • Run Magento on GAE

    Google App Engine 不久前开始支持第二种语言 Java,我当时听到这个消息马上开始期盼什么时候 GAE 支持 PHP。

    今天看到 Quercus 项目,它可以让 PHP 运行在 Java 环境,我才意识到不用再期盼在 GAE 跑 PHP 程序,这已成为现实。这下我有事情做了——怎么把 Magento 跑在 GAE 上?

  • Zend Framework lack of datagrid component

    Zend Framework is evolving quickly. Some while ago, it did not have Zend_Paginator, but now it’s there. But a component of paginator is enough for me. I want something like Zend_Datagrid. It’s not there yet.

    pao.fresco has developed Datagrid for Zend Framework. It looks good, but I am not confident using unofficial code.

    Magento also implement its own datagrid, but I do not know how to utilise as part of code outside of Magento.

  • Magento needs more features of ajax

    I can not blame Magento for its slow. It is such a big system aim to fit in all sectors of business. After all, after optimisation, Magento can achieve a decent speed on a entry level of server. However, I think Magento developers should bring more features of ajax into Magento. Fore example, when adding a product to compare, Magento give a success message “Product brah brah successfully added to compare list”. Magento currently reload the page to show the message. It is absolutely not necessary. Why not use ajax?

  • I am with Fedora

    今天 Fedora 11 alpha 发布了。Fedora 10 我还没摸熟呢,Fedora 11 就来了,真让我高兴之中疲于奔命。

    无意中还发现 drupal, mediawiki, planet, wordpress 都包含在 Fedora 发行包中,这是不是跟 Fedora Project 自身使用了这几种技术有关?我的意思是:为什么不包含别的 packages,比如 magento, joomla, etc?

    Fedora 倡导的东西咱就支持一下。不管有用没有,咱全安装了(也就 drupal 暂时派不上用场)。