Magento practice: managing product images on server file system

Magento 自带的管理产品图片的机制简单有效,但每次只能对单个产品进行管理,每次要 http upload 很费时。如果换个角度看,如果要成批更新产品图片,就不那么方便;如果要调用某个产品图片,必须先找到产品才能找到图片,因为 Magento 对上传后的文件进行了 dispretion 处理了文件路径,没有直观的办法可以直接浏览图片。 所以我的做法是,产品图片按产品属性归类,把整个文件夹 ftp 到 Magento 某个位置(或从 Magento 中独立出来,用一个静态文件服务器来管理图片,这样可以提供更方便的文件操作)。 然后在 magento/media/catalog/product 下建一个软连接(假设这个软连接名 static_image_linkedin)到产品图片目录的根。不要在 magento/media/catalog 这一级把 product 建为软连接,因为 Magento 会在 product 下建 cache 目录,从静态文件服务器角度看,这个 cache 是垃圾(我追求完美)。 然后,如果要指定产品使用某图片,必须把image, small_image, thumbnail, media_gallery 对应的值保存为人工指定位置的图片路径,该值的形式如 “/static_image_linkedin/nwf/recycled/green_bag.jpg”。Magento 原值形式如 “/g/r/green_bag.jpg”,我还没做出一个 GUI 帮助完成此项修改,依赖数据库直接操作。 我本有一个想法是修改 magento/app/code/core/Mage/Catalog/Model/Product/Media/Config.php 来改变产品图片目录的根,这样就不需要建软连接。但这样做的缺点是在移交 Magento 给别的 developers 时,我还得多一点额外交代。

Magento extension: Buy X selection of products, Get another Y selection for free

When to use: Magento has a native “buy x get y” sales rule in promotions. Magento’s x and y refer to a same product. For example, if a product offer is “buy 3 get 2”, you have to buy 5 of this product then only pay for 3 of them. Quite often the store owners… Continue reading Magento extension: Buy X selection of products, Get another Y selection for free

Use Magento in foreign trade business

我挺奇怪的,搜了一下竟然没人写过此类话题。怎么把 Magento 应用到外贸企业是我从一开始接触 Magento 就盘旋在我脑袋里的思考点,但却没人讨论过。或许 Magento 天生适合 b2c,或许外贸企业的眼光沉浸于展销会、阿里巴巴? 我不否认拿 Magento 去做外贸业务(我指的是报关出口)是有难度的,需要改造很多地方。今天突然想讲一讲,是因为我理清了一个思路:如何处理询盘 (enquiry)。在外贸实践中,询盘不是一个订单 (order)。这左右了我,老想着 extends Mage_Sales_Model_Quote 或 Mage_Wishlist_Model_Wishlist 去做一个 enquiry model,因为 quote 或 wishlist 都可以说是客户下单前的 enquiry。 但在编程实践中,外贸业务的 enquiry 应该由 extends Mage_Sales_Model_Order 才最适合,因为每个 enquiry 都是一个具体的、有形的客户做的,客户的国别、地址都是报价的考虑要素,Mage_Sales_Model_Quote 或 Mage_Wishlist_Model_Wishlist 都不具备这些要素,只有 Mage_Sales_Model_Order 才具备。所以,最简单的办法是为 order 自定义一些 pending 前状态,如 enquiry, offer, offer-accepted, offer-dead。 今后我会多谈谈我怎么把 Magento 应用到外贸企业的思路。

It’s a shame, but I booked an iPhone4

国内的苹果粉把新出炉的 iPhone4 (水货)爆炒到人民币一万多一台,他们疯了,我本可以无语。但是很多人利用位域优势从英国订 iPhone4 往国内带,有的为了谋利,有的为了摆显,连带我也被折腾进去,我真是无奈。 英国能买到 iPhone4,但是目前每人最多订一台。我老婆的名额被她老板业务需要用掉了,我老婆却还想去摆显。倒不是自己用,一万多的机子,她可以£599平价捎给朋友,而且是最紧俏的时候,她想享受一下拉风的感觉吧。我只能成全她,今天跟着她去苹果店用我的名额订了一台,否则为了苹果我们吵架太不值得。 但是作为一个 anti-appler, 我深为我的行为感到可耻。我对不起富士康跳了楼的员工们,我的订购也间接地延迟了 iPhone 被 Android 取代。虽然我个人已经进入了 Android 时代,但还有广大“劳苦大众”还没有机会认识到这世界上还有比 iPhone 更高级智能、更人性化的产品,我对不起他们。 在这里,我道歉——真诚地,希望你们能感受到。

Demystify 1and1 cloud server

漫天都是“云服务”,但真让我有云的感觉的服务目前只有 Google 一家。最近买了 1&1 cloud server,如果要评满意程度的话,只能是 5 out of 10 (购前期望过高)。 我原以为基于云的服务器可以一劳永逸、无限扩张,哪知 1&1 cloud server cpu core, memory, hard disk 都有上限,cpu core 最多买 4 个,其实就相当于单个 quad core cpu。 1&1 cloud server 性能也一般,或许还不如 vps,唯一优势就是比同等性能的 dedicated server 便宜一些。

Magento extension: rcah 0.1.1 is released

Magento store owners are having a challenge when using rcah 0.1.0, especially for homepage. The nature of homepage is CMS, most content of it static. Store owners want their visitors (especially first time visitors) to read static content on the homepage, but static content become obstacles filling in the central area of the page when… Continue reading Magento extension: rcah 0.1.1 is released

When does php apc refresh cache data?

I did this experiment with php apc: In php.ini I set include_path = /first/include/path:/second/include/path, but do not put a file in /first/include/path or /second/include/path, create test.php as simple as this It will run into a fatal error. This error is obvious. Then I create the file tobeincluded.php in /second/include/path, test.php now runs all right. Then… Continue reading When does php apc refresh cache data?

Published
Categorized as 小小草 Tagged

Magento does not remove storeview data when scope changes

今天我做了个有趣的实验: 首先 Manage Attributes,设置某 product attribute ‘my_attr’ scope 为 Store view 然后 Manage Products,为 my_attr 设置 default value ‘aaa’,再设置 store view (假设 storeId = 2) value ‘bbb’ 然后 Manage Attributes, 把 my_attr scope 改为 Global 然后 Manage Products,Choose Store View (storeId = 2),这时仍可见 my_attr 显示值 ‘bbb’。It means although my_attr scope is changed to ‘Global’, but… Continue reading Magento does not remove storeview data when scope changes

Skype banned Fring

不久前注意到我的 fring addon 里 skype 突然就不见了,我没上心去究其原因。今天在 fring 官网看到: 我搜了几则关于 fring skype 的消息,就明白了——skype 把 fring 给禁了。 我用 fring 就是因为手机上用不了 skype:在 iphone 上装 fring 是因为无需 jail break 就能通过 fring 中转的 skype 支持 voip over 3g;在 android 上装是因为 skype 的开发速度太慢,刚用 android 时 skype 根本没有 skype for android。今天我又重新上 skype 去看,倒是开始支持某些 android 手机,可惜我的 g1 仍不支持。所以,在我看来,skype 禁了 fring 有点损人不利己。 这让我对 skype… Continue reading Skype banned Fring

Published
Categorized as 杂草 Tagged

What is Google Wave?

董总问我,什么是 Google Wave? 这问题问得好,我一时不晓得怎么回答,我知道他问这个问题不是问 Google Wave 的定义。要泛泛了解 Google Wave,何必问我,去看看 Google Wave Help 或者上 YouTube 看几个入门的 video 就可以。 那么换句话问,在各种交流方式层出不穷的今天,Google Wave 有什么独到的地方?我们已经有了 email (of course I refer to Gmail), IM, SNS;Google 通讯产品也出了不少,gmail, gtalk, orkut, voice, buzz, 现在又出了 wave。很多产品,比如 facebook, twitter 据称很火爆的产品我都没来得及用。这也说明一个问题,大部分产品都有独到的地方,即便火爆,但它们无法象 email 一样不可或缺,从而改变世界。 就功能而言,Google Wave 高出 gmail 很多,比如即时、自主、互动,等等特性,在 Google Wave introduction 里都有提及,不用我多说。我自己在使用 gmail 时碰到的问题是:尽管gmail很智能,但无法按自定义的、更多的线索归类。我想 Google Wave 更灵活,能弥补… Continue reading What is Google Wave?