说来懊恼,为了让Magento product list能够显示自定义属性的值,我查看了magento wiki 和 forum 上几十个帖子,众说纷纭,我也不知道哪个是对的,或者哪个针对当前1.1.8可用。一个个实验下来,排列组合了不下100种可能,比如: 有人说layout add this line: my_attribute,另有人说是my_attribute 有人说要用$_product->getMyAttribute(),也有人说用$_product->getAttribute(‘my_attribute’),也有人说用$_product->getData(‘my_attribute’),也有人说用$_product->getAdditionalData(‘my_attribute’),还有人说用$_product->getResource()->getAttribute(‘my_attribute’)->getFrontend()->getValue($_product)) 还有人说Create separate module for your customization, Name it ‘Mycustomization’ (can be changed). Then do this: 1. Create file app/etc/modules/Mycustomization.xml 2. Create folder app/code/local/Mycustomization and inside it app/code/local/Mycustomization/etc/ 3. Create file app/code/local/Mycustomization/etc/config.xml Once done on the frontend in all product collections you will… Continue reading Clear Magento cache is essential after layout xml update
Day: December 15, 2008
Email encoder for not being spidered
我用Email encoder很久了。以前总是去别人网站上运算一下,拿来就用。如今觉得加密算法很多,我应该筛选一下,并作一个适合我自己的常用的工具。 因为跟javascript 字符串加解密有关,我首先找到一段程序,试运行了一下,相当不错,据说还支持中文字符串加密以及中文密码。 function Encrypt(str, pwd) { if(str==””)return “”; str = escape(str); if(!pwd || pwd==””){ var pwd=”1234″; } pwd = escape(pwd); if(pwd == null || pwd.length <= 0) { alert(“Please enter a password with which to encrypt the message.”); return null; } var prand = “”; for(var i=0; i<pwd.length; i++) { prand += pwd.charCodeAt(i).toString();… Continue reading Email encoder for not being spidered