Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Display Random & Promotion Products in Magento

There are two unused product list blocks in Magento which can be very useful if you push a few buttons, edit few layouts ..

1. Promotion Block located in app\code\core\Mage\Catalog\Block\Product\List\Promotion.php

This is basically built in featured product functionality. It reacts to “promotion” attribute which needs to be created, so let’s click Catalog->Attributes->Manage Attributes->Create New . . . → Read More: Display Random & Promotion Products in Magento

Display default Add to cart quantity in magento

magento系统默认的add to cart框的数量是空的,其实默认的值为1,但是没有显示出来,可以通过这样的方法让magento add to cart 显示默认数量

修改的文件位于你所使用的magento模板文件夹所在的位置。 一般在template/catalog/product/view/addtocart.phtml 把下面的代码替换成下下面的代码就OK

<input name=”qty” class=”input-text qty” id=”qty” maxlength=”12″ value=”<?php echo $this->getMinimalQty($_product) ?>” type=”text” />

and replace it with:

<input name=”qty” class=”input-text qty” id=”qty” maxlength=”12″ value=”<?php if($_product->isSaleable()): ?> <?php echo $this->getMinimalQty($_product)== null?1:$this->getMinimalQty($_product) ?> <?php else: ?> <?php echo $this->getMinimalQty($_product)== null?0:$this->getMinimalQty($_product) ?> <?php endif; ?>” type=”text” . . . → Read More: Display default Add to cart quantity in magento

css hack:html 判断浏览器版本 调用不同的css文件

1. < ! --[if !IE]>< ! --> 除IE外都可识别 < ! --< ! [endif]--> 2. < ! --[if IE]> 所有的IE可识别 < ! [endif]--> 3. < ! --[if IE 5.0]> 只有IE5.0可以识别 < ! [endif]--> 4. < ! --[if IE 5]> 仅IE5.0与IE5.5可以识别 < ! [endif]--> 5. < ! --[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 < ! [endif]--> 6. . . . → Read More: css hack:html 判断浏览器版本 调用不同的css文件

国外CMS推荐:MODXCMS

MODX具有强大的功能,灵活的模板引擎,强健的API,有好的SEO。

Modxcms的特点:http://modxcms.com/learn/features.html

高强度的灵活性,框架级的cms web标准化支持 图形化的安装程序 改进的夺款富文本编辑器 css菜单辅助生成 多浏览器支持 强大的Ajax支持 强大的seo支持 等等。。。。。

MODXCMS在某种意义可上可以称之为CMF。

你可以点这里访问官方网站:http://modxcms.com/

对安装环境的要求 系统: Linux X86,X86-64 Mac OS X windows XP Server

HTTP服务: apache1.3.x-2.2.x IIS 6.0 lighttpd Zeus nginx

PHP: 4.3.11+ mod_rewrite GD lib freetype safe_mode off register_globals off memory_limit 32MB以上

MYSQL: 4.1.20以上 excludes version 5.0.51 innoDb storage engine MyISAM storage engine

浏览器要求(网站管理员): . . . → Read More: 国外CMS推荐:MODXCMS

wordpress慢的几个可能原因分析

1.wordpress在windows平台下运行缓慢的原因

网络解答:
在本地装了一个wordpress平台,中文版的,速度很慢,一直都没有搞清楚原因。最开始以为是连接数据库的速度慢造成的,不过直接连mysql的速度还是很快的。今天干脆下了点功夫,逐步跟踪,发现速度原来是在载入中文语言包的时候变慢的。将wp-settings.php中的 load_default_textdomain()这一行注释掉,速度就上来了。
wordpress的语言包是后缀为mo的二进制文件,在windows平台下对这种文件的解析和读取异常缓慢,而在linux平台下却基本感觉不出来。所以,如果要在windows平台下使用wordpress的话,要么直接用英文版,要么直接将中文内嵌到程序中去替代英文。

测试:去掉语言包功能在win下速度提升了一半以上,我晕。

2.边栏按月归档 ARCHIVE的分月列表取消吧,日历取消吧
Continue reading wordpress慢的几个可能原因分析

umd文件结构深度解剖(附手机umd电子书生成算法类|PHP版)

记得刚开始准备做小说下载站时(UMD格式的电子书应该在Nokia机上是相当的流行吧),研究UMD文件,在网上搜不到UMD文件结构说明.费了好大的劲,用反编译工具才找到相关信息.可惜对C#不了解,只能摸到点皮毛,差点就放弃了,后来一个偶然的机会看到2lin兄和Mark兄的结构文章,振奋人心啊,于是对着UE打开标准umd文件的16进制码和2位仁兄的结构分析,用偶熟悉的php,做了一个umd生成类,对umd文件编码。解码应该也很简单的一个求逆运算,就不啰嗦了。 相关关键字节含义:

0x23,也就是字符’#’,这个字符在Umd中被用来作为功能块的分割符。 1.已知的#块(类型也就是#后面的16进制数字) 0×01–文件开始 0×02–标题 0×03–作者 0×04–年 0×05–月 0×06–日 0×07–小说类型 0×08–出版商 0×09–零售商 0x0b–内容长度 0×83–章节偏移 0×84–章节标题,正文 0×81–正文写入完毕 0×82–封面 0×87–PageOffset 0x0c–文件结束 2. 整数编码为littleEndian, 也就是低字节在前,高字节在后,相应的,所有的文本也都是Unicode16 LittleEndian编码的 3. 章节数据块(0×84)后面的第一个数据块是所有章节的标题,按照以下规则排列: [第1章标题文本的字节长度(1byte)][第1章标题unicode文本][第2章标题文本的字节长度(1byte)][第2章标题unicode文本]… 4. 章节数据块(0×84)后面的第二个数据块及以后的数据块是正文文本数据,是用标准zlib算法压缩的 5. 似乎每个数据块的字节大小都在18K以内 6. 似乎正文中的换行(\r\n)都被替换成了unicode段分隔符\u2029,不知道是否跟制作工具有关 7. 封面图片的数据是未压缩的,也就是说直接把数据段复制出来保存成一个jpg文件就可以了

. . . → Read More: umd文件结构深度解剖(附手机umd电子书生成算法类|PHP版)

import products with custom options in Magento

本文介绍的是如何将用户自定义选项批量导入到magento系统中。本文转自blogsbot,由于万能的GFW(再膜拜一下,万岁万万岁),很多人看不到,转一下,分享一下,知识的力量是封杀不住滴!!

Over the past several months I’ve been using Magento on four stores. I’ve run into a few things which have required slight modifications.

Recently I needed to import 200 new products. The products all had between 3 and 4 options. The default Magento import does not allow you to import custom options for products so I customized the import to allow imporing of options.

To add this customization to your magento store first copy app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php
to
app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php.
This will prevent upgrades from overwriting your changes.

Next you need to add some code to “local” version of Product.php (code/local/Mage/Catalog/Model/Convert/Adapter/Product.php). The line numbers below correspond to version 1.3 they may be a bit different in older versions.

At about line 566 you will see:


        foreach ($importData as $field => $value) {

Just above that add:

        $custom_options = array();

Continue reading import products with custom options in Magento

Custom Category Images Listing Block Tutorial

Recently, I just finished coding out a website for a client in Magento. You can view the site at www.3graces.com, it was a full switch from some old legacy asp shopping cart to Magento. Im really happy with the way things turned out and the client is too, Magento just has so many wonderful features built-in.

One feature that I found wasn’t built in was a way to display each sub-category with an image, and its name on a landing page. Magento has a nice feature which allows you to assign an image to a category, but doesnt give you a way to make that show up in a listing somewhere.

I setup 6 main categories, with each having multiple sub-categories and I wanted to have a way to show all those sub-categories to the user on a nice page that was pleasing to the eye. Here is an example: Payot Paris by Category.

To achieve this layout, I created a block called sub_navigation.html and placed it in the following directory: app/design/frontend/3graces/default/template/catalog/navigaton/sub_navigation.html
Continue reading Custom Category Images Listing Block Tutorial

检验中国住房是否过剩的试金石(转)

声明:本文转自新浪(汪华斌)的博客,请勿对号入座

看如今的中国大地,什么上涨幅度最大;恐怕第一的永远是住房。为什么我们社会的住房价格永远持续高涨呢,真的是任治强所说的‘需求决定的供不应求’吗;非也。我们社会如果按照公民每户住房面积一百平米计算,我们社会的住房应该早就供大于求。但为什么供大于求的社会却持续增长房价,而且还持续地供不应求呢。原来我们社会的住房是投资和投机的对象,所以才会出现家有多套住房闲置的比比皆是。正因为如此,所以才没有谁会认为房价真的能降下来;而且全国人民上下普遍认为只会持续增长。为什么,因为现在我们的住房已经是投机与投资的共有平台了;所以它才会刺激价格持续上涨。也正因为如此,我们现在房价成为世界之最;可还是供不应求。既然住房不是老百姓的民生,那么在这样好的形势下;国家就应该有创收的眼光。因为如果现在我们对所有的住房进行梯形纳税,我们国家每年可实现创税四万亿以上;而且还能够一夜之间使我们的房价回归正常。

首先是我们的住房购置税,除中华人民共和国公民在户口所在地可免税一套住房外;其免税面积为一百平米。那么其它人购房或多余的面积,则应该按照住房交易金额纳税百分之五。这样我们一套五百万的商品房,实际的税收就有二十五万。这是一笔多么大的财政收入呀,按每年全国一百万的商品房交易;这就是二千五百多亿的交易税收入,这是住房创收的第一笔来源。

其次是住房闲置税,同样按照总价格的百分之十五计算;这就不管任何形式的住房,只要长期无人居住;就定义为闲置房。按照一套商品房五百万的价格计算,闲置税每年就是七十五万。再加上我们各种各样的小产权房,我们社会的闲置房收入几乎是一个巨大的聚宝盆;它的实际收入应该超过几万亿。因为我们社会现在进入一个老年期,所以继承多套住房的现象比比皆是。现在是因为不交住房闲置税,所以富人是空有多套商品房;老百姓是空有多套破房。就是我们现在的农村,新楼房旁边就是闲置的老旧房。如果我们社会只要是闲置房就全部纳税,我们社会还能有如此多的闲置房吗。现在不仅明星和港澳台老板有多套商品房,而且我们现在的官员同样也有多套商品房。这不仅因为他们把住房作为投资或投机的产品,还因为我们社会不征收闲置税的原因。

Continue reading 检验中国住房是否过剩的试金石(转)

magento 发送Email 某些客户端显示html源码解决

文件位置:app/code/core/Mage/Core/Model/Email/Template.php第350行左右

修改后的文件另存到app/code/Local/Mage/Core/Model/Email/Template.php

if($this->isPlain()) { $mail->setBodyText($text); } else { $mail->setBodyHTML($text); }

替换成以下代码

$boundary = ‘–BOUNDARY_TEXT_OF_CHOICE’; $boundary_location = strpos($text, $boundary); $stext = substr($text, 0, strpos($text, $boundary)); $shtml = str_replace($boundary, ”, substr($text, $boundary_location)); $mail->setBodyText($stext); $mail->setBodyHTML($shtml);

需要在html格式的邮件模板html代码开始的地方加入

–BOUNDARY_TEXT_OF_CHOICE 即可解决问题

def xx(x,y): return (x*y)