<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Magento中文项目组 &#187; jidda</title>
	<atom:link href="http://www.magentochinese.org/author/jidda/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.magentochinese.org</link>
	<description>专注于Magento中文包,插件,文章教程汉化翻译.</description>
	<lastBuildDate>Thu, 12 Apr 2012 14:18:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>OpenCart在Nginx的SEO伪静态URL重写</title>
		<link>http://www.magentochinese.org/opencart%e5%9c%a8nginx%e7%9a%84seo%e4%bc%aa%e9%9d%99%e6%80%81url%e9%87%8d%e5%86%99/</link>
		<comments>http://www.magentochinese.org/opencart%e5%9c%a8nginx%e7%9a%84seo%e4%bc%aa%e9%9d%99%e6%80%81url%e9%87%8d%e5%86%99/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 13:42:00 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[OpenCart]]></category>
		<category><![CDATA[Rewrite]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Url]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=178</guid>
		<description><![CDATA[前提是在OpenCart后台开始SEO Url,并设置好相关目录和产品的SEO keywords.
apache中,OpenCart已经提供了默认的.htaccess
而在nginx中应该使用一下规则

if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_f...]]></description>
			<content:encoded><![CDATA[<p>前提是在OpenCart后台开始SEO Url,并设置好相关目录和产品的SEO keywords.</p>
<p>apache中,OpenCart已经提供了默认的.htaccess</p>
<p>而在nginx中应该使用一下规则</p>
<pre>
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21")
{
rewrite ^/([^?]*) /index.php?_route_=$1 last;
}
</pre>
<p>重启nginx,即实现了在Nginx下OpenCart的SEO Url</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/opencart%e5%9c%a8nginx%e7%9a%84seo%e4%bc%aa%e9%9d%99%e6%80%81url%e9%87%8d%e5%86%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>修改OpenCart系统发信模板</title>
		<link>http://www.magentochinese.org/%e4%bf%ae%e6%94%b9opencart%e7%b3%bb%e7%bb%9f%e5%8f%91%e4%bf%a1%e6%a8%a1%e6%9d%bf/</link>
		<comments>http://www.magentochinese.org/%e4%bf%ae%e6%94%b9opencart%e7%b3%bb%e7%bb%9f%e5%8f%91%e4%bf%a1%e6%a8%a1%e6%9d%bf/#comments</comments>
		<pubDate>Sat, 28 May 2011 01:50:29 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[OpenCart]]></category>
		<category><![CDATA[模板]]></category>
		<category><![CDATA[邮件]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=173</guid>
		<description><![CDATA[OpenCart系统发新不能像Magento那样方便的在后台修改e-mail的内容模板 但是能够通过修改语言文件修改发信内容. 注册用户成功邮件的模板在语言文件夹的mail/account_create.php中修改. 例如,默认的英文邮件就在catalog/language/english/mail/ccount_create.php文件中.内容如下 // Text $_['text_subject']  = '%s - Thank you for registering'; $_['text_welcome']  = 'Welcome and thank you for registering at %s!'; $_['text_login']    = 'Your account has now been created and you can log in by using your email address and password by visiting our website or at the following URL:'; $_['text_approval']...]]></description>
			<content:encoded><![CDATA[<p>OpenCart系统发新不能像<a href="http://jidda.name/e-commerce/magento" >Magent</a>o那样方便的在后台修改e-mail的内容模板</p>
<p>但是能够通过修改语言文件修改发信内容.</p>
<p>注册用户成功邮件的模板在语言文件夹的mail/account_create.php中修改.</p>
<p>例如,默认的英文邮件就在catalog/language/english/mail/ccount_create.php文件中.内容如下</p>
<pre>
// Text
$_['text_subject']  = '%s - Thank you for registering';
$_['text_welcome']  = 'Welcome and thank you for registering at %s!';
$_['text_login']    = 'Your account has now been created and you can log in by using your email address and password by visiting our website or at the following URL:';
$_['text_approval'] = 'Your account must be approved before you can login. Once approved you can log in by using your email address and password by visiting our website or at the following URL:';
$_['text_services'] = 'Upon logging in, you will be able to access other services including reviewing past orders, printing invoices and editing your account information.';
$_['text_thanks']   = 'Thanks,';
</pre>
<p>里面内容不多做解释了.%s为替换的对应变量,不懂的可以对应着邮件修改.</p>
<p>相应的,此文件夹下的其他文件也为对应的邮件模板.支持html语法.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e4%bf%ae%e6%94%b9opencart%e7%b3%bb%e7%bb%9f%e5%8f%91%e4%bf%a1%e6%a8%a1%e6%9d%bf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Magento获取全部分类代码</title>
		<link>http://www.magentochinese.org/magento%e8%8e%b7%e5%8f%96%e5%85%a8%e9%83%a8%e5%88%86%e7%b1%bb%e4%bb%a3%e7%a0%81/</link>
		<comments>http://www.magentochinese.org/magento%e8%8e%b7%e5%8f%96%e5%85%a8%e9%83%a8%e5%88%86%e7%b1%bb%e4%bb%a3%e7%a0%81/#comments</comments>
		<pubDate>Sat, 28 May 2011 01:38:40 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[全部分类]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=168</guid>
		<description><![CDATA[magento获得全部的菜单分类，这段代码的好处就是可以放在任意的phtml文件中，并且做了诸多的条件判断。我们可以参考灵活运用，供初学者参考。 此段代码来自互联网:http://www.magentocommerce.com/boards/viewthread/24947/P15/ function nodeToArray(Varien_Data_Tree_Node $node) { $result = array(); $result['category_id'] = $node-&#62;getId(); $result['parent_id'] = $node-&#62;getParentId(); $result['name'] = $node-&#62;getName(); $result['is_active'] = $node-&#62;getIsActive(); $result['position'] = $node-&#62;getPosition(); $result['level'] = $node-&#62;getLevel(); $result['children'] = array(); foreach ($node-&#62;getChildren() as $child) { $result['children'][] = nodeToArray($child); } return $result; } function load_tree() { $tree = Mage::getResourceSingleton('catalog/category_tree') -&#62;load(); $store = 1; $parentId = 1;...]]></description>
			<content:encoded><![CDATA[<p>magento获得全部的菜单分类，这段代码的好处就是可以放在任意的phtml文件中，并且做了诸多的条件判断。我们可以参考灵活运用，供初学者参考。</p>
<p>此段代码来自互联网:<a href="http://www.magentocommerce.com/boards/viewthread/24947/P15/" >http://www.magentocommerce.com/boards/viewthread/24947/P15/</a></p>
<pre>
function nodeToArray(Varien_Data_Tree_Node $node) {
$result = array();
$result['category_id'] = $node-&gt;getId();
$result['parent_id'] = $node-&gt;getParentId();
$result['name'] = $node-&gt;getName();
$result['is_active'] = $node-&gt;getIsActive();
$result['position'] = $node-&gt;getPosition();
$result['level'] = $node-&gt;getLevel();
$result['children'] = array();

foreach ($node-&gt;getChildren() as $child) {
$result['children'][] = nodeToArray($child);
}

return $result;
}

function load_tree() {

$tree = Mage::getResourceSingleton('catalog/category_tree')
-&gt;load();

$store = 1;
$parentId = 1;

$tree = Mage::getResourceSingleton('catalog/category_tree')
-&gt;load();

$root = $tree-&gt;getNodeById($parentId);

if ($root &amp;&amp; $root-&gt;getId() == 1) {
$root-&gt;setName(Mage::helper('catalog')-&gt;__('Root'));
}

$collection = Mage::getModel('catalog/category')-&gt;getCollection()
-&gt;setStoreId($store)
-&gt;addAttributeToSelect('name')
//-&gt;addAttributeToSelect('id')
-&gt;addAttributeToSelect('is_active');

$tree-&gt;addCollectionData($collection, true);

return nodeToArray($root);
}

function print_tree($tree, $level) {
$level++;
foreach ($tree as $item) {
echo str_repeat("*", $level) . $item['name'] . '*' . $item['category_id'] . "&lt;br&gt;";
print_tree($item['children'], $level);
}
}

$tree = load_tree();
print_tree($tree['children'], 0);
</pre>
<p>&nbsp;</p>
<p>转载自<a href="http://www.hellokeykey.com" >钥匙的博客:www.hellokeykey.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/magento%e8%8e%b7%e5%8f%96%e5%85%a8%e9%83%a8%e5%88%86%e7%b1%bb%e4%bb%a3%e7%a0%81/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LiveZilla与OpenCart整合</title>
		<link>http://www.magentochinese.org/livezilla%e4%b8%8eopencart%e6%95%b4%e5%90%88/</link>
		<comments>http://www.magentochinese.org/livezilla%e4%b8%8eopencart%e6%95%b4%e5%90%88/#comments</comments>
		<pubDate>Fri, 27 May 2011 08:01:23 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[livezilla]]></category>
		<category><![CDATA[OpenCart]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[模块]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=155</guid>
		<description><![CDATA[LiveZilla的安装方法这里也不说了.如果需要,请看 livezilla在线客服系统安装教程 其实将LiveZilla与OpenCart整合 跟 LiveZilla与Magento整合 方法相同,相对于系统庞大复杂的Magento,与OpenCart整合更加的简单.不过每次换模板,升级模板之类的,都要重新添加一次代码,挺麻烦的.这两天就自己写了个OpenCart添加LiveZilla的插件. &#160; 注意事项 本插件仅适用于LiveZilla的Float Button方法,也就是漂浮图标的显示方式.漂浮的位置由LiveZilla生成的代码控制. 安装方法: 下载并解压缩插件包. 将admin,catalog两个文件夹上传至OpenCart的根目录 后台Extensions-&#62;Module 安装LiveZilla插件,并编辑 Status这个就不说了.肯定是Enable.LiveZilla CODE请填入LiveZilla的Float Button的Script/Code, 显示位置由LiveZilla 的Scrip/Code控制,如图 &#160; 保存以后,到首页刷新一下看效果吧 Module页面LiveZilla插件显示的Position不用理会,默认Left的.呵呵 &#160; LiveZilla插件下载 :]]></description>
			<content:encoded><![CDATA[<p>LiveZilla的安装方法这里也不说了.如果需要,请看 <a title="LiveZilla在线客服系统安装教程" href="http://jidda.name/e-commerce/seo/livezilla%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.html" >livezilla在线客服系统安装教程</a></p>
<p>其实将LiveZilla与OpenCart整合 跟 <a title="LiveZilla与Magento整合" href="http://jidda.name/e-commerce/magento/livezilla%E4%B8%8Emagento%E6%95%B4%E5%90%88.html" >LiveZilla与Magento整合</a> 方法相同,相对于系统庞大复杂的Magento,与OpenCart整合更加的简单.不过每次换模板,升级模板之类的,都要重新添加一次代码,挺麻烦的.这两天就自己写了个OpenCart添加LiveZilla的插件.</p>
<p>&nbsp;</p>
<p><span style="color: #339966;">注意事项</span></p>
<p>本插件仅适用于LiveZilla的Float Button方法,也就是漂浮图标的显示方式.漂浮的位置由LiveZilla生成的代码控制.</p>
<p>安装方法:<span id="more-155"></span></p>
<ol>
<li>下载并解压缩插件包.</li>
<li>将admin,catalog两个文件夹上传至OpenCart的根目录</li>
<li>后台Extensions-&gt;Module<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/oplz01.jpg" class="thickbox no_icon" rel="gallery-155" title="oplz01"><img class="alignnone size-medium wp-image-156" title="oplz01" src="http://jidda.name/wp-content/uploads/2011/05/oplz01-300x165.jpg" alt="" width="300" height="165" /></a></li>
<li>安装LiveZilla插件,并编辑</li>
<li>Status这个就不说了.肯定是Enable.LiveZilla CODE请填入LiveZilla的Float Button的Script/Code, 显示位置由LiveZilla<br />
的Scrip/Code控制,如图<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/oplz02.jpg" class="thickbox no_icon" rel="gallery-155" title="oplz02"><img class="alignnone size-medium wp-image-161" title="oplz02" src="http://jidda.name/wp-content/uploads/2011/05/oplz02-300x191.jpg" alt="" width="300" height="191" /></a>&nbsp;
<p>保存以后,到首页刷新一下看效果吧</p></li>
</ol>
<p><span style="font-size: 12px; line-height: 12px;">Module页面LiveZilla插件显示的Position不用理会,默认Left的.呵呵</span></p>
<p>&nbsp;</p>
<p><span style="font-size: 12px; line-height: 12px;">LiveZilla插件下载 :</span></p>
<p><span style="font-size: 12px; line-height: 12px;">注意：该页面嵌入了下载文件，请访问 <a href="http://jidda.name/e-commerce/opencart/livezilla%E4%B8%8Eopencart%E6%95%B4%E5%90%88.html">该页面</a>下载该文件。<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/livezilla%e4%b8%8eopencart%e6%95%b4%e5%90%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LiveZilla与Magento整合</title>
		<link>http://www.magentochinese.org/livezilla%e4%b8%8emagento%e6%95%b4%e5%90%88/</link>
		<comments>http://www.magentochinese.org/livezilla%e4%b8%8emagento%e6%95%b4%e5%90%88/#comments</comments>
		<pubDate>Thu, 26 May 2011 09:13:36 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[livezilla]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=141</guid>
		<description><![CDATA[此文章仅讲述如何将安装好的LiveZilla与Magento整合,LiveZilla的安装方法这里不再叙述,如果你不知道如何安装LiveZilla请看LiveZIlla在线客服系统安装教程这篇文章. 其实将LiveZilla添加入Magento有很多方法,这里就介绍三个比较普遍的方法. 如果你只想在某个或几个固定页面的显示LiveZilla的图标,那么你可在magento后台创建一个static block,在其中粘贴上LiveZilla提供给你的Script/Code代码 &#60;!-- LiveZilla Chat Button Link Code (ALWAYS PLACE IN BODY ELEMENT) --&#62;&#60;div style="text-align: center; width: 145px;"&#62;&#60;a href="javascript:void(window.open('http://jidda.name/livezilla/chat.php','','width=590,height=610,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes'))"&#62;&#60;img src="http://jidda.name/livezilla/image.php?id=01&#38;amp;type=inlay" width="145" height="69" border="0" alt="LiveZilla Live Help" /&#62;&#60;/a&#62;&#60;div style="margin-top: 2px;"&#62;&#60;a href="http://www.livezilla.net" target="_blank" title="LiveZilla Live Help" style="font-size: 10px; color: #bfbfbf; text-decoration: none; font-family: verdana, arial, tahoma;"&#62;LiveZillaLive Help&#60;/a&#62;&#60;/div&#62;&#60;/div&#62;&#60;!-- http://www.LiveZilla.net Chat Button Link Code --&#62;&#60;!-- LiveZilla Tracking...]]></description>
			<content:encoded><![CDATA[<p>此文章仅讲述如何将安装好的LiveZilla与Magento整合,LiveZilla的安装方法这里不再叙述,如果你不知道如何安装LiveZilla请看<a title="LiveZilla在线客服系统安装教程" href="http://jidda.name/e-commerce/seo/livezilla%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.html" ><span style="color: #00ccff;">LiveZIlla在线客服系统安装教程</span></a>这篇文章.</p>
<p>其实将LiveZilla添加入Magento有很多方法,这里就介绍三个比较普遍的方法.</p>
<p>如果你只想在某个或几个固定页面的显示LiveZilla的图标,那么你可在magento后台创建一个static block,在其中粘贴上LiveZilla提供给你的Script/Code代码</p>
<pre>
&lt;!-- LiveZilla Chat Button Link Code (ALWAYS PLACE IN BODY ELEMENT) --&gt;&lt;div style="text-align: center; width: 145px;"&gt;&lt;a	href="javascript:void(window.open('http://jidda.name/livezilla/chat.php','','width=590,height=610,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes'))"&gt;&lt;img	src="http://jidda.name/livezilla/image.php?id=01&amp;amp;type=inlay"	width="145" height="69" border="0" alt="LiveZilla Live Help" /&gt;&lt;/a&gt;&lt;div style="margin-top: 2px;"&gt;&lt;a href="http://www.livezilla.net"	target="_blank" title="LiveZilla Live Help"	style="font-size: 10px; color: #bfbfbf; text-decoration: none; font-family: verdana, arial, tahoma;"&gt;LiveZillaLive Help&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- http://www.LiveZilla.net Chat Button Link Code --&gt;&lt;!-- LiveZilla Tracking Code (ALWAYS PLACE IN BODY ELEMENT) --&gt;&lt;div id="livezilla_tracking" style="display: none"&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;/* &lt;![CDATA[ */var script = document.createElement("script");script.type="text/javascript";var src = "http://jidda.name/livezilla/server.php?request=track&amp;output=jcrpt&amp;nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);/* ]]&gt; */&lt;/script&gt;&lt;noscript&gt;&lt;img	src="http://jidda.name/livezilla/server.php?request=track&amp;amp;output=nojcrpt"	width="0" height="0" style="visibility: hidden;" alt="" /&gt;&lt;/noscript&gt;&lt;!-- http://www.LiveZilla.net Tracking Code --&gt;
</pre>
<p><span style="color: #00ccff;">切记禁用所见即所得编辑模式</span>并在想要的显示的页面位置引入此static block即可.</p>
<p>如果你想在每个页面的头部或底部加入LiveZilla图标,那么你得找到网站所使用的模板的对应头部或底部文件.一般默认模板的路径在app/design/frontend/base/defaul/template/page/html,头部文件为header.phtml,底部文件footer.pthml<br />
添加livezilla可能需要修改一下html,然后加入</p>
<pre>
&lt;!-- LiveZilla Chat Button Link Code (ALWAYS PLACE IN BODY ELEMENT) --&gt;&lt;div style="text-align: center; width: 145px;"&gt;&lt;a href="javascript:void(window.open('http://jidda.name/livezilla/chat.php','','width=590,height=610,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes'))"&gt;&lt;img	src="http://jidda.name/livezilla/image.php?id=01&amp;amp;type=inlay"	width="145" height="69" border="0" alt="LiveZilla Live Help" /&gt;&lt;/a&gt;&lt;div style="margin-top: 2px;"&gt;&lt;a href="http://www.livezilla.net"	target="_blank" title="LiveZilla Live Help"	style="font-size: 10px; color: #bfbfbf; text-decoration: none; font-family: verdana, arial, tahoma;"&gt;LiveZillaLive Help&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- http://www.LiveZilla.net Chat Button Link Code --&gt;&lt;!-- LiveZilla Tracking Code (ALWAYS PLACE IN BODY ELEMENT) --&gt;&lt;div id="livezilla_tracking" style="display: none"&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;/* &lt;![CDATA[ */var script = document.createElement("script");script.type="text/javascript";var src = "http://jidda.name/livezilla/server.php?request=track&amp;output=jcrpt&amp;nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);/* ]]&gt; */&lt;/script&gt;&lt;noscript&gt;&lt;img	src="http://jidda.name/livezilla/server.php?request=track&amp;amp;output=nojcrpt"	width="0" height="0" style="visibility: hidden;" alt="" /&gt;&lt;/noscript&gt;&lt;!-- http://www.LiveZilla.net Tracking Code --&gt;
</pre>
<p>如果你想在每个页面的两侧显示浮动的LiveZilla,其实方法同上,并且比第二种更简单,因为LiveZilla提供此代码,只需在头部或底部文件任意位置加入LiveZilla的Float Button代码,即可实现</p>
<pre>
&lt;!-- LiveZilla Chat Button Link Code (ALWAYS PLACE IN BODY ELEMENT) --&gt;&lt;div style="display:none;"&gt;&lt;a href="javascript:void(window.open('http://jidda.name/livezilla/chat.php','','width=590,height=610,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes'))"&gt;&lt;img id="chat_button_image" src="http://jidda.name/livezilla/image.php?id=02&amp;amp;type=overlay" width="32" height="112" border="0" alt="LiveZilla Live Help"&gt;&lt;/a&gt;&lt;/div&gt;&lt;!-- http://www.LiveZilla.net Chat Button Link Code --&gt;&lt;!-- LiveZilla Tracking Code (ALWAYS PLACE IN BODY ELEMENT) --&gt;&lt;div id="livezilla_tracking" style="display:none"&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;var script = document.createElement("script");script.type="text/javascript";var src = "http://jidda.name/livezilla/server.php?request=track&amp;output=jcrpt&amp;fbpos=10&amp;fbml=0&amp;fbmt=0&amp;fbmr=0&amp;fbmb=0&amp;fbw=32&amp;fbh=112&amp;nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);&lt;/script&gt;&lt;noscript&gt;&lt;img src="http://jidda.name/livezilla/server.php?request=track&amp;amp;output=nojcrpt&amp;amp;fbpos=10&amp;amp;fbml=0&amp;amp;fbmt=0&amp;amp;fbmr=0&amp;amp;fbmb=0&amp;amp;fbw=32&amp;amp;fbh=112" width="0" height="0" style="visibility:hidden;" alt=""&gt;&lt;/noscript&gt;&lt;!-- http://www.LiveZilla.net Tracking Code --&gt;
</pre>
<p><span style="color: #ff0000;">这里的代码只是一个示例,请使用你自己安装的LiveZilla提供的代码</span>.</p>
<p>进入Magento后台,刷新缓存.再到前台刷新一下,看效果吧,其中可能需要你有一定的HTML/CSS标签基础才能让其更完美</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/livezilla%e4%b8%8emagento%e6%95%b4%e5%90%88/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LiveZilla在线客服系统安装教程</title>
		<link>http://www.magentochinese.org/livezilla%e5%9c%a8%e7%ba%bf%e5%ae%a2%e6%9c%8d%e7%b3%bb%e7%bb%9f%e5%ae%89%e8%a3%85%e6%95%99%e7%a8%8b/</link>
		<comments>http://www.magentochinese.org/livezilla%e5%9c%a8%e7%ba%bf%e5%ae%a2%e6%9c%8d%e7%b3%bb%e7%bb%9f%e5%ae%89%e8%a3%85%e6%95%99%e7%a8%8b/#comments</comments>
		<pubDate>Thu, 26 May 2011 03:14:07 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[livezilla]]></category>
		<category><![CDATA[其他程序及SEO]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=110</guid>
		<description><![CDATA[LiveZilla是功能强大且免费开源的在线客服系统.LiveZilla以强大的功能,卓越的品质,稳定的系统迅速成为最好的网站网店免费开源在线客服解决方案. LiveZilla官方网站:http://www.livezilla.net LiveZilla官方下载地址:http://www.livezilla.net/downloads/en/ LiveZilla的优点: 真正完全免费开源的没有任何功能限制的在线客服软件,没有网站、用户数量限制,亦可用于商业网站. 安装简单,可用于任何网站.(与网站的结合需要一点HTML知识) 支持网络视频对话,让您提供更有特色的服务. 可以清晰的跟踪客户所在地理位置. 不借助第三方平台,在您的网站主机和本地计算机即可安装使用,能够完全自主掌控所有数据. 可定制化程度极高.可自由定制图标、文字、界面、网站上的显示方式. 实时聊天帮助,能提供更人性化的客户服务.提高网站的用户体验.并可以设置多部门的客服,以及能对客服进行评分. 提供访客监控功能.能够监控访客所在的国家地区、浏览器、操作系统、浏览器语言、浏览器分辨率、来自哪个网站、页面关键词和IP. LiveZilla的缺点: 需要在自己的电脑上安装软件. 对网站服务器资源占用较高 LiveZilla安装教程: 下载LiveZIlla安装包,并一直下一步安装LiveZilla(不多说了) 运行LiveZilla Client,点击Edit Server 点击Server Admin创建配置 如果你有一个新网站并未安装Livezilla Server就选择第一个Create New LiveZilla Server,如果此网站以前安装过LiveZilla Server要在本机导入,就选第二个,测试,选择第三个- -这里我们选择第一个Create New LiveZilla Server 填写该网站客服的ID,姓名,邮箱及设置密码 填写此账户的部门,第一次所创建的也有管理权限 上传你的LiveZilla Server至网站服务器,一般来说都选择第一项FTP Upload上传,如果你的网站服务器是在本机,就选择第二项 FTP上传LiveZilla Server设置,见图 点击下一步后,就会出现上传LiveZilla Server的窗口,见图 传输完成后会提示设置文件及文件夹的权限(类UNIX服务器中),直接下一步设置. 填写网站的域名及LiveZilla Server的路径 配置数据库,点击Create Tables创建LiveZilla Server相关的表,跟着提示,LiveZilla Server就算安装完成了 剩下的就是配置LiveZilla的在线图标等,跟着一步一步做,很简单的 选择才建的LiveZilla Server,下一步 输入登录信息,下一步 剩下最后一步,配置LiveZilla在网站显示的代码了~这里不详细解释了,看图 最后一步,在你网站合适的位置加入 Scripts...]]></description>
			<content:encoded><![CDATA[<p>LiveZilla是功能强大且免费开源的在线客服系统.LiveZilla以强大的功能,卓越的品质,稳定的系统迅速成为最好的网站网店免费开源在线客服解决方案.</p>
<p>LiveZilla官方网站:<a title="LiveZilla官方站点" href="http://www.livezilla.net" >http://www.livezilla.net<br />
</a> LiveZilla官方下载地址:<a title="LiveZilla官方下载地址" href="http://www.livezilla.net/downloads/en/" >http://www.livezilla.net/downloads/en/</a></p>
<h3>LiveZilla的优点:</h3>
<ol>
<li> 真正完全免费开源的没有任何功能限制的在线客服软件,没有网站、用户数量限制,亦可用于商业网站.</li>
<li>安装简单,可用于任何网站.(与网站的结合需要一点HTML知识)</li>
<li>支持网络视频对话,让您提供更有特色的服务.</li>
<li>可以清晰的跟踪客户所在地理位置.</li>
<li>不借助第三方平台,在您的网站主机和本地计算机即可安装使用,能够完全自主掌控所有数据.</li>
<li>可定制化程度极高.可自由定制图标、文字、界面、网站上的显示方式.</li>
<li>实时聊天帮助,能提供更人性化的客户服务.提高网站的用户体验.并可以设置多部门的客服,以及能对客服进行评分.</li>
<li>提供访客监控功能.能够监控访客所在的国家地区、浏览器、操作系统、浏览器语言、浏览器分辨率、来自哪个网站、页面关键词和IP.</li>
</ol>
<h3>LiveZilla的缺点:</h3>
<ol>
<li>需要在自己的电脑上安装软件.</li>
<li>对网站服务器资源占用较高</li>
</ol>
<h2>LiveZilla安装教程:</h2>
<ol>
<li>下载LiveZIlla安装包,并一直下一步安装LiveZilla(不多说了)<span id="more-110"></span><br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz001.jpg" class="thickbox no_icon" rel="gallery-110" title="lz001"><img title="lz001" src="http://jidda.name/wp-content/uploads/2011/05/lz001-300x216.jpg" alt="" width="300" height="216" /></a></li>
<li>运行LiveZilla Client,点击Edit Server<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz002.jpg" class="thickbox no_icon" rel="gallery-110" title="lz002"><img class="alignnone size-medium wp-image-116" title="lz002" src="http://jidda.name/wp-content/uploads/2011/05/lz002-300x218.jpg" alt="" width="300" height="218" /></a></li>
<li>点击Server Admin创建配置<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz003.jpg" class="thickbox no_icon" rel="gallery-110" title="lz003"><img class="alignnone size-medium wp-image-118" title="lz003" src="http://jidda.name/wp-content/uploads/2011/05/lz003-300x217.jpg" alt="" width="300" height="217" /></a></li>
<li>如果你有一个新网站并未安装Livezilla Server就选择第一个Create New LiveZilla Server,如果此网站以前安装过LiveZilla Server要在本机导入,就选第二个,测试,选择第三个- -这里我们选择第一个Create New LiveZilla Server<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz004.jpg" class="thickbox no_icon" rel="gallery-110" title="lz004"><img title="lz004" src="http://jidda.name/wp-content/uploads/2011/05/lz004-295x300.jpg" alt="" width="295" height="300" /></a></li>
<li>填写该网站客服的ID,姓名,邮箱及设置密码<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz005.jpg" class="thickbox no_icon" rel="gallery-110" title="lz005"><img class="alignnone size-medium wp-image-121" title="lz005" src="http://jidda.name/wp-content/uploads/2011/05/lz005-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li>填写此账户的部门,第一次所创建的也有管理权限<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz006.jpg" class="thickbox no_icon" rel="gallery-110" title="lz006"><img class="alignnone size-medium wp-image-122" title="lz006" src="http://jidda.name/wp-content/uploads/2011/05/lz006-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li>上传你的LiveZilla Server至网站服务器,一般来说都选择第一项FTP Upload上传,如果你的网站服务器是在本机,就选择第二项</li>
<li>FTP上传LiveZilla Server设置,见图<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz007.jpg" class="thickbox no_icon" rel="gallery-110" title="lz007"><img class="alignnone size-medium wp-image-125" title="lz007" src="http://jidda.name/wp-content/uploads/2011/05/lz007-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li><a href="http://jidda.name/wp-content/uploads/2011/05/lz007.jpg"></a>点击下一步后,就会出现上传LiveZilla Server的窗口,见图<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz008.jpg"><img class="alignnone size-medium wp-image-126" title="lz008" src="http://jidda.name/wp-content/uploads/2011/05/lz008-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li>传输完成后会提示设置文件及文件夹的权限(类UNIX服务器中),直接下一步设置.</li>
<li>填写网站的域名及LiveZilla Server的路径</li>
<li>配置数据库,点击Create Tables创建LiveZilla Server相关的表,跟着提示,LiveZilla Server就算安装完成了<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz009.jpg" class="thickbox no_icon" rel="gallery-110" title="lz009"><img class="alignnone size-medium wp-image-128" title="lz009" src="http://jidda.name/wp-content/uploads/2011/05/lz009-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li>剩下的就是配置LiveZilla的在线图标等,跟着一步一步做,很简单的<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz010.jpg" class="thickbox no_icon" rel="gallery-110" title="lz010"><img class="alignnone size-medium wp-image-131" title="lz010" src="http://jidda.name/wp-content/uploads/2011/05/lz010-295x300.jpg" alt="" width="295" height="300" /></a></li>
<li>选择才建的LiveZilla Server,下一步<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz011.jpg" class="thickbox no_icon" rel="gallery-110" title="lz011"><img class="alignnone size-medium wp-image-132" title="lz011" src="http://jidda.name/wp-content/uploads/2011/05/lz011-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li>输入登录信息,下一步<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz012.jpg" class="thickbox no_icon" rel="gallery-110" title="lz012"><img class="alignnone size-medium wp-image-133" title="lz012" src="http://jidda.name/wp-content/uploads/2011/05/lz012-300x225.jpg" alt="" width="300" height="225" /></a></li>
<li>剩下最后一步,配置LiveZilla在网站显示的代码了~这里不详细解释了,看图<br />
<a href="http://jidda.name/wp-content/uploads/2011/05/lz013.jpg" class="thickbox no_icon" rel="gallery-110" title="lz013"><img class="alignnone size-medium wp-image-134" title="lz013" src="http://jidda.name/wp-content/uploads/2011/05/lz013-300x191.jpg" alt="" width="300" height="191" /></a></li>
<li><a href="http://jidda.name/wp-content/uploads/2011/05/lz013.jpg"></a>最后一步,在你网站合适的位置加入 Scripts / Code,并在自己电脑上登录好LiveZilla Client客户端就可以使用LiveZilla这款强大的在线客服系统了</li>
</ol>
<p>&nbsp;</p>
<h3><a title="LiveZilla与Magento整合" href="http://jidda.name/e-commerce/magento/livezilla%E4%B8%8Emagento%E6%95%B4%E5%90%88.html" >LiveZilla与Magento的整合教程</a></h3>
<h3><a title="LiveZilla与OpenCart整合" href="http://jidda.name/e-commerce/opencart/livezilla%E4%B8%8Eopencart%E6%95%B4%E5%90%88.html" >LiveZilla与OpenCart的整合教程</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/livezilla%e5%9c%a8%e7%ba%bf%e5%ae%a2%e6%9c%8d%e7%b3%bb%e7%bb%9f%e5%ae%89%e8%a3%85%e6%95%99%e7%a8%8b/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>将Magento评论移动至产品页面</title>
		<link>http://www.magentochinese.org/%e5%b0%86magento%e8%af%84%e8%ae%ba%e7%a7%bb%e5%8a%a8%e8%87%b3%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2/</link>
		<comments>http://www.magentochinese.org/%e5%b0%86magento%e8%af%84%e8%ae%ba%e7%a7%bb%e5%8a%a8%e8%87%b3%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2/#comments</comments>
		<pubDate>Fri, 20 May 2011 02:18:48 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=99</guid>
		<description><![CDATA[首先先找到 &#60;block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" &#62; &#60;action method="addTab" translate="title" module="catalog"&#62;&#60;alias&#62;description&#60;/alias&#62;&#60;title&#62;Product Description&#60;/title&#62;&#60;block&#62;catalog/product_view_description&#60;/block&#62;&#60;template&#62;catalog/product/view/description.phtml&#60;/template&#62;&#60;/action&#62; &#60;action method="addTab" translate="title" module="catalog"&#62;&#60;alias&#62;additional&#60;/alias&#62;&#60;title&#62;Additional Information&#60;/title&#62;&#60;block&#62;catalog/product_view_attributes&#60;/block&#62;&#60;template&#62;catalog/product/view/attributes.phtml&#60;/template&#62;&#60;/action&#62; &#60;block type="review/form" name="product.review.form" as="review_form"&#62; &#60;block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before"&#62; &#60;action method="setMayBeInvisible"&#62;&#60;value&#62;1&#60;/value&#62;&#60;/action&#62; &#60;/block&#62; &#60;/block&#62;&#60;/block&#62; 替换为 &#60;block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" &#62;&#60;action method="addTab" translate="title" module="catalog"&#62;&#60;alias&#62;description&#60;/alias&#62;&#60;title&#62;Product Description&#60;/title&#62;&#60;block&#62;catalog/product_view_description&#60;/block&#62;&#60;template&#62;catalog/product/view/description.phtml&#60;/template&#62;&#60;/action&#62;&#60;action method="addTab" translate="title" module="catalog"&#62;&#60;alias&#62;additional&#60;/alias&#62;&#60;title&#62;Additional Information&#60;/title&#62;&#60;block&#62;catalog/product_view_attributes&#60;/block&#62;&#60;template&#62;catalog/product/view/attributes.phtml&#60;/template&#62;&#60;/action&#62;&#60;block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml"&#62; &#60;block type="review/form" name="product.review.form" as="review_form"&#62; &#60;block type="page/html_wrapper" name="product.review.form.fields.before"...]]></description>
			<content:encoded><![CDATA[<p>首先先找到</p>
<pre>&lt;block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" &gt;	&lt;action method="addTab" translate="title" module="catalog"&gt;&lt;alias&gt;description&lt;/alias&gt;&lt;title&gt;Product Description&lt;/title&gt;&lt;block&gt;catalog/product_view_description&lt;/block&gt;&lt;template&gt;catalog/product/view/description.phtml&lt;/template&gt;&lt;/action&gt;	&lt;action method="addTab" translate="title" module="catalog"&gt;&lt;alias&gt;additional&lt;/alias&gt;&lt;title&gt;Additional Information&lt;/title&gt;&lt;block&gt;catalog/product_view_attributes&lt;/block&gt;&lt;template&gt;catalog/product/view/attributes.phtml&lt;/template&gt;&lt;/action&gt;	&lt;block type="review/form" name="product.review.form" as="review_form"&gt;		&lt;block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before"&gt;				&lt;action method="setMayBeInvisible"&gt;&lt;value&gt;1&lt;/value&gt;&lt;/action&gt;		&lt;/block&gt;	&lt;/block&gt;&lt;/block&gt;</pre>
<p>替换为</p>
<pre>&lt;block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" &gt;&lt;action method="addTab" translate="title" module="catalog"&gt;&lt;alias&gt;description&lt;/alias&gt;&lt;title&gt;Product Description&lt;/title&gt;&lt;block&gt;catalog/product_view_description&lt;/block&gt;&lt;template&gt;catalog/product/view/description.phtml&lt;/template&gt;&lt;/action&gt;&lt;action method="addTab" translate="title" module="catalog"&gt;&lt;alias&gt;additional&lt;/alias&gt;&lt;title&gt;Additional Information&lt;/title&gt;&lt;block&gt;catalog/product_view_attributes&lt;/block&gt;&lt;template&gt;catalog/product/view/attributes.phtml&lt;/template&gt;&lt;/action&gt;&lt;block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml"&gt;		&lt;block type="review/form" name="product.review.form" as="review_form"&gt;		&lt;block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before"&gt;			&lt;action method="setMayBeInvisible"&gt;&lt;value&gt;1&lt;/value&gt;&lt;/action&gt;		&lt;/block&gt;	&lt;/block&gt;&lt;/block&gt;</pre>
<p>然后在模板对应位置加入</p>
<pre>&lt;?php echo $this-&gt;getChildHtml('product_review') ?&gt; </pre>
<p><span style="color: #0000ff;">这里有个要注意的地方就是,xml文件中添加模块,必须在你添加的模块里面的父级模块中添加,否则可能出现无法调用模块的问题</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e5%b0%86magento%e8%af%84%e8%ae%ba%e7%a7%bb%e5%8a%a8%e8%87%b3%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prototype的简单Ajax</title>
		<link>http://www.magentochinese.org/prototype%e7%9a%84%e7%ae%80%e5%8d%95ajax-2/</link>
		<comments>http://www.magentochinese.org/prototype%e7%9a%84%e7%ae%80%e5%8d%95ajax-2/#comments</comments>
		<pubDate>Fri, 20 May 2011 02:10:01 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=94</guid>
		<description><![CDATA[function getContents() { var request_url = “test1.html”; // 需要获取内容的url var request_pars = ”;//请求参数 var myAjax = new Ajax.Updater(‘result’, request_url,{ // 将request_url返回内容绑定到id为result的容器中 method : ‘get’, //HTTP请求的方法,get or post parameters : request_pars, //请求参数 onFailure : reportError, //失败的时候调用 reportError 函数 onLoading : loading, //正在获得内容的时候 onComplete : done //内容获取完毕的时候 }); } function loading() { $(‘loading’).style.display = ‘block’; } function...]]></description>
			<content:encoded><![CDATA[<pre>function getContents()
{
var request_url = “test1.html”; // 需要获取内容的url
var request_pars = ”;//请求参数

var myAjax = new Ajax.Updater(‘result’, request_url,{ // 将request_url返回内容绑定到id为result的容器中
method : ‘get’, //HTTP请求的方法,get or post
parameters : request_pars, //请求参数
onFailure : reportError, //失败的时候调用 reportError 函数
onLoading : loading, //正在获得内容的时候
onComplete : done //内容获取完毕的时候
});
}

function loading()
{
$(‘loading’).style.display = ‘block’;
}

function done()
{
$(‘loading’).style.display = ‘none’;
}

function reportError(request)
{
alert(‘Sorry. There was an error.’);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/prototype%e7%9a%84%e7%ae%80%e5%8d%95ajax-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自动获取Magento带前缀的表名</title>
		<link>http://www.magentochinese.org/%e8%87%aa%e5%8a%a8%e8%8e%b7%e5%8f%96magento%e5%b8%a6%e5%89%8d%e7%bc%80%e7%9a%84%e8%a1%a8%e5%90%8d-2/</link>
		<comments>http://www.magentochinese.org/%e8%87%aa%e5%8a%a8%e8%8e%b7%e5%8f%96magento%e5%b8%a6%e5%89%8d%e7%bc%80%e7%9a%84%e8%a1%a8%e5%90%8d-2/#comments</comments>
		<pubDate>Mon, 16 May 2011 09:28:46 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[获取表名]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=65</guid>
		<description><![CDATA[在写插件时，有的用户安装magento时设置了表的前缀，而有的用户没有，如果直接把表名写死在那，是不正确的。 magento提供了获取表名的的一个方法： $tableName = Mage::getSingleton('core/resource')-&#62;getTableName('默认表名');]]></description>
			<content:encoded><![CDATA[<p>在写插件时，有的用户安装<strong>magento</strong>时设置了表的前缀，而有的用户没有，如果直接把表名写死在那，是不正确的。</p>
<p>magento提供了获取表名的的一个方法：</p>
<pre>$tableName = Mage::getSingleton('core/resource')-&gt;getTableName('默认表名');</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e8%87%aa%e5%8a%a8%e8%8e%b7%e5%8f%96magento%e5%b8%a6%e5%89%8d%e7%bc%80%e7%9a%84%e8%a1%a8%e5%90%8d-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS安装Nginx+PHP+MySQL简明教程</title>
		<link>http://www.magentochinese.org/centos%e5%ae%89%e8%a3%85nginxphpmysql%e7%ae%80%e6%98%8e%e6%95%99%e7%a8%8b/</link>
		<comments>http://www.magentochinese.org/centos%e5%ae%89%e8%a3%85nginxphpmysql%e7%ae%80%e6%98%8e%e6%95%99%e7%a8%8b/#comments</comments>
		<pubDate>Thu, 12 May 2011 13:58:06 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WebServer]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=49</guid>
		<description><![CDATA[鉴于现在的VPS越来越便宜,很多人想自己用VPS搭建LNMP环境.现在网上也有LNMP一键安装包,有利有弊吧. 安装好基本的VPS环境后,root登陆centos <pre># vim /etc/yum.repos.d/jidda.name.repo</pre>

 加入以下内容 <pre></pre>

 [CentALT] name=CentALT Packages for Enterprise Linux 5 &#8211;... <a href="http://jidda.name/server/linux/centos%E5%AE%89%E8%A3%85nginxphpmysql%E7%AE%80%E6%98%8E%E6%95%99%E7%A8%8B.html">more <span>&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>鉴于现在的VPS越来越便宜,很多人想自己用VPS搭建LNMP环境.现在网上也有LNMP一键安装包,有利有弊吧.<a href="http://jidda.name/wp-content/uploads/2011/05/linux.png"><img class="alignright size-full wp-image-44" title="linux" src="http://jidda.name/wp-content/uploads/2011/05/linux.png" alt="linux" width="64" height="64" /></a></p>
<p>安装好基本的VPS环境后,root登陆centos</p>
<ol>
<li>[shell]# vim /etc/yum.repos.d/jidda.name.repo[/shell]<br />
加入以下内容<br />
[shell]<br />
[CentALT]<br />
name=CentALT Packages for Enterprise Linux 5 &#8211; $basearch<br />
baseurl=http://centos.alt.ru/repository/centos/5/$basearch/<br />
enabled=1<br />
gpgcheck=0<br />
protect=1<br />
[/shell]<br />
再根据服务器所在地区和网络更换更新源</li>
<li>启用 EPEL repo<br />
如果你是32位系统,输入以下命令<br />
[shell]rpm -ihv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm[/shell]<br />
如果你是64位系统,则输入以下命令<br />
[shell]rpm -ihv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm[/shell]<br />
然后再<br />
[shell]rpm &#8211;import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL[/shell]</li>
<li>安装nginx+php+mysql,输入<br />
[shell]yum -y install nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator mysql-server[/shell]<br />
等待安装完成,更具你自己的需要选择是否更新<br />
[shell]yum -y update[/shell]<br />
OK,整个环境已经配置好了,并且安装了一些php的常用扩展.</li>
<li>设置Nginx,PHP-FPM,MySQL开机启动<br />
[shell]setup[/shell]<br />
勾选开机启动的服务&#8230;<br />
或者<br />
[shell]<br />
chkconfig &#8211;level 345 mysqld on<br />
chkconfig &#8211;level 345 php-fpm on<br />
chkconfig &#8211;level 345 nginx on<br />
[/shell]</li>
<li>启动Nginx,PHP-FPM,MySQL:<br />
[shell]<br />
service mysqld start<br />
service php-fpm start<br />
service nginx start<br />
[/shell]</li>
</ol>
<p>环境已经配好,根据需要修改/etc下的配置文件</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/centos%e5%ae%89%e8%a3%85nginxphpmysql%e7%ae%80%e6%98%8e%e6%95%99%e7%a8%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>配置Nginx+Magento+SSL</title>
		<link>http://www.magentochinese.org/%e9%85%8d%e7%bd%aenginxmagentossl/</link>
		<comments>http://www.magentochinese.org/%e9%85%8d%e7%bd%aenginxmagentossl/#comments</comments>
		<pubDate>Thu, 12 May 2011 12:38:46 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[WebServer]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=23</guid>
		<description><![CDATA[今天一客户想为他运行Magento的vps配置上ssl.这里写一下流程. vps的基本LNMP环境配置和SSL证书的申请这里就不在叙述了,不是本文重点.(点击这里查看基本环境配置) PUTTY连接上VPS并创建储存SSL证书的目录 <pre></pre>

 #mkdir /etc/nginx/certs #cd /etc/nginx/certs #openssl req -new -newkey rsa:2048 -nodes -out... <a href="http://jidda.name/e-commerce/magento/%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AEnginxmagentossl.html">more <span>&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://jidda.name/wp-content/uploads/2011/05/magento.png"><img class="size-full wp-image-38 alignright" title="magento" src="http://jidda.name/wp-content/uploads/2011/05/magento.png" alt="Magento" width="64" height="64" /></a>今天一客户想为他运行Magento的vps配置上ssl.这里写一下流程.</p>
<p>vps的基本LNMP环境配置和SSL证书的申请这里就不在叙述了,不是本文重点.(<a title="CentOS安装Nginx+PHP+MySQL简明教程" href="http://jidda.name/server/linux/centos%E5%AE%89%E8%A3%85nginxphpmysql%E7%AE%80%E6%98%8E%E6%95%99%E7%A8%8B.html">点击这里查看基本环境配置</a>)</p>
<ol>
<li>PUTTY连接上VPS并创建储存SSL证书的目录<br />
[shell]<br />
#mkdir /etc/nginx/certs<br />
#cd /etc/nginx/certs<br />
#openssl req -new -newkey rsa:2048 -nodes -out server.csr -keyout server.key<br />
[/shell]</li>
<li>得到的server.csr给ssl服务商申请到证书<br />
有的服务商是给你两端密匙.自己合并一下.上传至<br />
/etc/nginx/certs</li>
<li>配置Nginx服务器<br />
打开以前网站的配置文件,修改为以下内容<br />
[shell]<br />
server {#这里跳转所有不带www和带www的http至https<br />
listen 80;<br />
server_name www.yourdomain.com yourdomain.com;<br />
if ($host != &#8216;www.yourdomain.com&#8217;){<br />
rewrite ^/(.*)$ http://www.yourdomain.com/$1 permanent;<br />
}<br />
rewrite ^(.*) https://$server_name$1 permanent;&nbsp;
<p>}</p>
<p>server {#带ssl,以及rewrite的magento配置<br />
listen 443 ssl;<br />
server_name www.yourdomain.com;<br />
root /var/www/yourdomain.com;<br />
ssl on;<br />
ssl_certificate /etc/nginx/certs/server.pem;<br />
ssl_certificate_key /etc/nginx/certs/server.key;<br />
ssl_session_timeout  5m;<br />
ssl_protocols  SSLv3 TLSv1;<br />
ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;<br />
ssl_prefer_server_ciphers   on;</p>
<p>location /{<br />
index index.html index.php;<br />
try_files $uri $uri/ @handler;<br />
expires 30d;<br />
}</p>
<p>location ^/minify/{<br />
rewrite ^/minify/([0-9]+)(/.*\.(js|css))$ /lib/minify/m.php?f=$2&amp;d=$1 last;<br />
}</p>
<p>location /app/                { deny all; }<br />
location /includes/           { deny all; }<br />
location /lib/                { deny all; }<br />
location /lib/minify/         { allow all; }<br />
location /media/downloadable/ { deny all; }<br />
location /pkginfo/            { deny all; }<br />
location /report/config.xml   { deny all; }<br />
location /var/                { deny all; }<br />
location /var/export/ {<br />
auth_basic           &#8220;Restricted&#8221;;<br />
auth_basic_user_file htpasswd;<br />
autoindex            on;<br />
}</p>
<p>location  /. {<br />
return 404;<br />
}</p>
<p>location @handler {<br />
rewrite / /index.php;<br />
}</p>
<p>location ~ \.php/ {<br />
rewrite ^(.*\.php)/ $1 last;<br />
}</p>
<p>location ~ \.php$ {<br />
expires        off;<br />
fastcgi_pass   127.0.0.1:9000;</p>
<p>fastcgi_param  HTTPS on;<br />
fastcgi_param  HTTPS $fastcgi_https;<br />
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;<br />
include        fastcgi_params;<br />
}<br />
}<br />
[/shell]</p></li>
<li>重启nginx服务器,OK,大功告成</li>
</ol>
<p>理论上如此配置,已经可以正常运行了.</p>
<p>但是今天如此配置后,重启nginx服务有如下报错<br />
[shell]<br />
[emerg]: SSL_CTX_use_PrivateKey_file(&#8220;/etc/nginx/certs/server.key&#8221;) failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)<br />
configuration file /usr/local/nginx/conf/nginx.conf test failed<br />
[/shell]</p>
<p>网上查了下资料,有说证书未整合成功的居多.这里我直接排除了这个错误</p>
<p>继续谷歌之.发现,其实是由于文件编码错误</p>
<p><span style="color: #0000ff;">由于一直习惯性的保存文件编码为UTF-8,而SSL证书的编码应该为ASCII!</span></p>
<p>另存为ASCII编码,重启nginx,大功告成!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e9%85%8d%e7%bd%aenginxmagentossl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenCart中文手册</title>
		<link>http://www.magentochinese.org/opencart%e4%b8%ad%e6%96%87%e6%89%8b%e5%86%8c/</link>
		<comments>http://www.magentochinese.org/opencart%e4%b8%ad%e6%96%87%e6%89%8b%e5%86%8c/#comments</comments>
		<pubDate>Thu, 12 May 2011 03:45:55 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[OpenCart]]></category>
		<category><![CDATA[中文手册]]></category>

		<guid isPermaLink="false">http://jidda.name/?p=17</guid>
		<description><![CDATA[用户手册 OpenCart OpenCart是国外著名的开源电子商务网站，由英国人Daniel一人独立开发，其社区非常活跃，由各国网友翻译出来的语言包已经达到18种，其中包括中文，俄文，法文，西班牙文，德文，日文等等。 OpenCart的优势在于前台界面的设计非常适合欧美购物者的浏览习惯：简洁，直观，唯美！ 后台也非常的简洁明了，而且功能强大，对于初学者来说非常容易上手，对于大多数经验丰富的网店经营者来说，OpenCart的后台管理功能也基本能满足其需求。OpenCart可以说是最适合国内用户建设外贸网店的程序！ OpenCart的主要特点包括： 1. 网站模版化，用户可自由更换，编辑模版文件 2. 产品评论功能 3. 产品评分功能 4. 可添加下载类产品 5.... <a href="http://jidda.name/e-commerce/opencart/opencart-chinese-user-guide.html">more <span>&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<h1>用户手册<a href="http://jidda.name/wp-content/uploads/2011/05/opencart.jpg"><img class="alignright size-full wp-image-41" title="opencart" src="http://jidda.name/wp-content/uploads/2011/05/opencart.jpg" alt="opencart" width="64" height="64" /></a></h1>
<h3>OpenCart</h3>
<p>OpenCart是国外著名的开源电子商务网站，由英国人Daniel一人独立开发，其社区非常活跃，由各国网友翻译出来的语言包已经达到18种，其中包括中文，俄文，法文，西班牙文，德文，日文等等。<br />
OpenCart的优势在于前台界面的设计非常适合欧美购物者的浏览习惯：简洁，直观，唯美！<br />
后台也非常的简洁明了，而且功能强大，对于初学者来说非常容易上手，对于大多数经验丰富的网店经营者来说，OpenCart的后台管理功能也基本能满足其需求。OpenCart可以说是最适合国内用户建设外贸网店的程序！</p>
<p>OpenCart的主要特点包括：<br />
1. 网站模版化，用户可自由更换，编辑模版文件<br />
2. 产品评论功能<br />
3. 产品评分功能<br />
4. 可添加下载类产品<br />
5. 图片自动调整大小<br />
6. 添加相关产品功能<br />
7. 优惠券（Coupon Code）功能<br />
8. 搜索引擎优化功能</p>
<p>&nbsp;</p>
<p>经本人试用,个人感觉,OpenCart功能满足大部分外贸人群,相比于Magento,可能功能,扩展性等方面有所不足</p>
<p>但是OpenCart的优点在于,对服务器要求很低.速度更Magento不能比拟的.而且试用和二次开发简单.</p>
<p>&nbsp;</p>
<p><a href="http://www.opencartcn.org/documentation" >点击查看在线手册</a></p>
<p><a href="http://opencartcn-org.googlecode.com/files/OpenCart%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C.7z">点击下载离线手册</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/opencart%e4%b8%ad%e6%96%87%e6%89%8b%e5%86%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento1.5中文翻译包-Find_Feed.csv</title>
		<link>http://www.magentochinese.org/magento1-5%e4%b8%ad%e6%96%87%e7%bf%bb%e8%af%91%e5%8c%85-find_feed-csv/</link>
		<comments>http://www.magentochinese.org/magento1-5%e4%b8%ad%e6%96%87%e7%bf%bb%e8%af%91%e5%8c%85-find_feed-csv/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 02:18:42 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[汉化项目]]></category>
		<category><![CDATA[Magento1.5翻译文件]]></category>

		<guid isPermaLink="false">http://www.magentochinese.org/?p=588</guid>
		<description><![CDATA[此文件是Magento1.5中文包中的子文件,如果您对翻译有异议.可以直接在本页面,或者Magento1.5中文包项目页面中发表留言. "%s codes deleted","%s 代码已删除" "%s codes imported","%s 代码已导入" "%s codes not imported","%s 代码未被导入" "%s product in feed.","%s 产品已在 feed 中." "%s product not in feed.","%s 产品不在 feed 中." "Add new","新增" "Attrib. Set Name","设置属性名称" "Attributes map","属性映射表" "Cron Frequency","计划任务频率" "Cron Hour","计划任务时间" "Delete","删除" "Eav code","Eav code" "FTP Password","FTP密码" "FTP Path","FTP路径" "FTP Server","FTP服务器" "FTP Settings","FTP设置" "FTP User","FTP用户名" "FTP: <a href="http://www.magentochinese.org/magento1-5%e4%b8%ad%e6%96%87%e7%bf%bb%e8%af%91%e5%8c%85-find_feed-csv/"><b>...Read the Rest</b></a>]]></description>
			<content:encoded><![CDATA[<p>此文件是<a href="../magento1-5%e6%b1%89%e5%8c%96%e9%a1%b9%e7%9b%ae/">Magento1.5中文包</a>中的<a href="../tag/magento1-5%e7%bf%bb%e8%af%91%e6%96%87%e4%bb%b6/">子文件</a>,如果您对翻译有异议.可以直接在本页面,或者<a href="../magento1-5%e6%b1%89%e5%8c%96%e9%a1%b9%e7%9b%ae/">Magento1.5中文包项目</a>页面中发表留言.</p>
<pre>

"%s codes deleted","%s 代码已删除"
"%s codes imported","%s 代码已导入"
"%s codes not imported","%s 代码未被导入"
"%s product in feed.","%s 产品已在 feed 中."
"%s product not in feed.","%s 产品不在 feed 中."
"Add new","新增"
"Attrib. Set Name","设置属性名称"
"Attributes map","属性映射表"
"Cron Frequency","计划任务频率"
"Cron Hour","计划任务时间"
"Delete","删除"
"Eav code","Eav code"
"FTP Password","FTP密码"
"FTP Path","FTP路径"
"FTP Server","FTP服务器"
"FTP Settings","FTP设置"
"FTP User","FTP用户名"
"FTP: Can't delete files","FTP: 无法删除文件"
"Feed","Feed"
"Feed code","Feed 代码"
"ID","ID"
"Import","导入"
"Import attribute map","导入属性映射表"
"Import code","导入代码"
"In feed","In feed"
"In order to access your FTP account information, you must first register and verify your store in TheFind Merchant Center.  Click &lt;a href=""https://merchant.thefind.com/mc/claim.fhtml""&gt;here&lt;/a&gt; to get started.","为了访问您的FTP账户, 您必须先注册并验证您的TheFind商家中心店. 点击&lt;a href=""https://merchant.thefind.com/mc/claim.fhtml""&gt;这里&lt;/a&gt; 开始."
"Is imported","已导入"
"Item params","项目参数"
"Manage attributes","管理属性"
"Manage items","管理项目"
"Not import","不被导入"
"Not publish","不发布"
"Price","价格"
"Product Name","产品平成"
"Product import","产品导入"
"Publish","发布"
"SKU","SKU"
"Settings","设置"
"The Find","The Find"
"TheFind Feed Filename","TheFind Feed 文件名"
"TheFind feed","TheFind feed"
"Type","类型"
"Unable to process an import. ","无法处理导入. "
"Update TheFind Item when Product is Updated","当产品更新后更新TheFind项目"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/magento1-5%e4%b8%ad%e6%96%87%e7%bf%bb%e8%af%91%e5%8c%85-find_feed-csv/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>将magento评论页面移动到产品页面tabs</title>
		<link>http://www.magentochinese.org/%e5%b0%86magento%e8%af%84%e8%ae%ba%e9%a1%b5%e9%9d%a2%e7%a7%bb%e5%8a%a8%e5%88%b0%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2tabs/</link>
		<comments>http://www.magentochinese.org/%e5%b0%86magento%e8%af%84%e8%ae%ba%e9%a1%b5%e9%9d%a2%e7%a7%bb%e5%8a%a8%e5%88%b0%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2tabs/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 11:58:02 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[教程]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[Lamp]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=102</guid>
		<description><![CDATA[首先先找到 &#60;block type=&#34;catalog/product_view_tabs&#34; name=&#34;product.info.tabs&#34; as=&#34;info_tabs&#34; template=&#34;catalog/product/view/tabs.phtml&#34; &#62; &#60;action method=&#34;addTab&#34; translate=&#34;title&#34; module=&#34;catalog&#34;&#62;&#60;alias&#62;description&#60;/alias&#62;&#60;title&#62;Product Description&#60;/title&#62;&#60;block&#62;catalog/product_view_description&#60;/block&#62;&#60;template&#62;catalog/product/view/description.phtml&#60;/template&#62;&#60;/action&#62; &#60;action method=&#34;addTab&#34; translate=&#34;title&#34; module=&#34;catalog&#34;&#62;&#60;alias&#62;additional&#60;/alias&#62;&#60;title&#62;Additional Information&#60;/title&#62;&#60;block&#62;catalog/product_view_attributes&#60;/block&#62;&#60;template&#62;catalog/product/view/attributes.phtml&#60;/template&#62;&#60;/action&#62; &#60;block type=&#34;review/form&#34; name=&#34;product.review.form&#34; as=&#34;review_form&#34;&#62; &#60;block type=&#34;page/html_wrapper&#34; name=&#34;product.review.form.fields.before&#34; as=&#34;form_fields_before&#34;&#62; &#60;action method=&#34;setMayBeInvisible&#34;&#62;&#60;value&#62;1&#60;/value&#62;&#60;/action&#62; &#60;/block&#62; &#60;/block&#62; &#60;/block&#62; &#60;/block&#62; 替换为 &#60;block type=&#34;catalog/product_view_tabs&#34; name=&#34;product.info.tabs&#34; as=&#34;info_tabs&#34; template=&#34;catalog/product/view/tabs.phtml&#34; &#62; &#60;action method=&#34;addTab&#34; translate=&#34;title&#34; module=&#34;catalog&#34;&#62;&#60;alias&#62;description&#60;/alias&#62;&#60;title&#62;Product Description&#60;/title&#62;&#60;block&#62;catalog/product_view_description&#60;/block&#62;&#60;template&#62;catalog/product/view/description.phtml&#60;/template&#62;&#60;/action&#62; &#60;action method=&#34;addTab&#34; translate=&#34;title&#34; module=&#34;catalog&#34;&#62;&#60;alias&#62;additional&#60;/alias&#62;&#60;title&#62;Additional Information&#60;/title&#62;&#60;block&#62;catalog/product_view_attributes&#60;/block&#62;&#60;template&#62;catalog/product/view/attributes.phtml&#60;/template&#62;&#60;/action&#62; &#60;block type=&#34;review/product_view_list&#34; name=&#34;product.info.product_additional_data&#34; as=&#34;product_review&#34; template=&#34;review/product/view/list.phtml&#34;&#62; &#60;block type=&#34;review/form&#34; [...]]]></description>
			<content:encoded><![CDATA[
<p>首先先找到</p>
<pre class="brush: xml; title: ;">&lt;block type=&quot;catalog/product_view_tabs&quot; name=&quot;product.info.tabs&quot; as=&quot;info_tabs&quot; template=&quot;catalog/product/view/tabs.phtml&quot; &gt;
                	&lt;action method=&quot;addTab&quot; translate=&quot;title&quot; module=&quot;catalog&quot;&gt;&lt;alias&gt;description&lt;/alias&gt;&lt;title&gt;Product Description&lt;/title&gt;&lt;block&gt;catalog/product_view_description&lt;/block&gt;&lt;template&gt;catalog/product/view/description.phtml&lt;/template&gt;&lt;/action&gt;
                	&lt;action method=&quot;addTab&quot; translate=&quot;title&quot; module=&quot;catalog&quot;&gt;&lt;alias&gt;additional&lt;/alias&gt;&lt;title&gt;Additional Information&lt;/title&gt;&lt;block&gt;catalog/product_view_attributes&lt;/block&gt;&lt;template&gt;catalog/product/view/attributes.phtml&lt;/template&gt;&lt;/action&gt;
							&lt;block type=&quot;review/form&quot; name=&quot;product.review.form&quot; as=&quot;review_form&quot;&gt;
							&lt;block type=&quot;page/html_wrapper&quot; name=&quot;product.review.form.fields.before&quot; as=&quot;form_fields_before&quot;&gt;
								&lt;action method=&quot;setMayBeInvisible&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/action&gt;
							&lt;/block&gt;
						&lt;/block&gt;
					&lt;/block&gt;
                &lt;/block&gt;</pre>
<p>替换为</p>
<pre class="brush: xml; title: ;">&lt;block type=&quot;catalog/product_view_tabs&quot; name=&quot;product.info.tabs&quot; as=&quot;info_tabs&quot; template=&quot;catalog/product/view/tabs.phtml&quot; &gt;
                	&lt;action method=&quot;addTab&quot; translate=&quot;title&quot; module=&quot;catalog&quot;&gt;&lt;alias&gt;description&lt;/alias&gt;&lt;title&gt;Product Description&lt;/title&gt;&lt;block&gt;catalog/product_view_description&lt;/block&gt;&lt;template&gt;catalog/product/view/description.phtml&lt;/template&gt;&lt;/action&gt;
                	&lt;action method=&quot;addTab&quot; translate=&quot;title&quot; module=&quot;catalog&quot;&gt;&lt;alias&gt;additional&lt;/alias&gt;&lt;title&gt;Additional Information&lt;/title&gt;&lt;block&gt;catalog/product_view_attributes&lt;/block&gt;&lt;template&gt;catalog/product/view/attributes.phtml&lt;/template&gt;&lt;/action&gt;
					&lt;block type=&quot;review/product_view_list&quot; name=&quot;product.info.product_additional_data&quot; as=&quot;product_review&quot; template=&quot;review/product/view/list.phtml&quot;&gt;
							&lt;block type=&quot;review/form&quot; name=&quot;product.review.form&quot; as=&quot;review_form&quot;&gt;
							&lt;block type=&quot;page/html_wrapper&quot; name=&quot;product.review.form.fields.before&quot; as=&quot;form_fields_before&quot;&gt;
								&lt;action method=&quot;setMayBeInvisible&quot;&gt;&lt;value&gt;1&lt;/value&gt;&lt;/action&gt;
							&lt;/block&gt;
						&lt;/block&gt;
					&lt;/block&gt;
                &lt;/block&gt;</pre>
<p>然后再模板文件的对应位置加上</p>
<pre class="brush: php; title: ;">&lt;?php echo $this-&gt;getChildHtml('product_review') ?&gt; </pre>
<p><span style="color: #ff0000;">这里有个要注意的地方就是,xml文件中添加模块,必须在你添加的模块里面的父级模块中添加,否则可能出现无法调用模块的问题</span>

</p>]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e5%b0%86magento%e8%af%84%e8%ae%ba%e9%a1%b5%e9%9d%a2%e7%a7%bb%e5%8a%a8%e5%88%b0%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2tabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento 1.4.1.1 windows 集成安装包 with APMXE</title>
		<link>http://www.magentochinese.org/magento-1-4-1-1-windows-%e9%9b%86%e6%88%90%e5%ae%89%e8%a3%85%e5%8c%85-with-apmxe/</link>
		<comments>http://www.magentochinese.org/magento-1-4-1-1-windows-%e9%9b%86%e6%88%90%e5%ae%89%e8%a3%85%e5%8c%85-with-apmxe/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 01:19:33 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[Lamp]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=96</guid>
		<description><![CDATA[APMXE&#38;MAGENTO 1.4.1.1 集成包(本来觉得这个东西没什么用不想更新，但是居然有人加我QQ找我要，就再放一次) **************************************************** 版本说明(感谢起源科技制 作的APMXE): # Apache 2.2（完整） # PHP 5.2.9–2（完整） # XCache 2.0.4 # MySQL 5.0（服务端和命令行工具） # phpMyAdmin 3.2 # Magento 1.4.1.1 (集成后台中文语言包) **************************************************** MySQL 默认账号密码:root magento后台地址 http://127.0.0.1/magento/index.php/admin magento后台账号:magentochina密码:1q2w3e4r5t **************************************************** 解压缩后运行apmxe.exe by jidda QQ:23363038 MSN:jidda@live.cn http://www.magentochina.org Windows 7 64bit, Windows xp sp3 32bit 测试通过 注意事项: 1.APACHE默认端口80,请确保安装时系统80端口未被占用(如迅雷) 2.mysql默认端口3306 3.如要卸载,请先把apache和mysql服务停止,直接删除文件夹即可 4.安装包直接用的好压haozip制作,安装完成后会出现假死,不用理会,直接关闭即可 4.apache,php,mysql的配置文件在/etc目录中,修改template文件即可%APMXE%为apmxe.exe所在目录的位置变量 QQ文件中转站下载 提取码（2d001275） 115网络U盘下载]]></description>
			<content:encoded><![CDATA[
<p style="text-align: left;">APMXE&amp;MAGENTO 1.4.1.1 集成包(本来觉得这个东西没什么用不想更新，但是居然有人加我QQ找我要，就再放一次)</p>
<p style="text-align: left;">****************************************************</p>
<p style="text-align: left;">版本说明(感谢起源科技制 作的APMXE):<br />
# Apache 2.2（完整）<br />
# PHP 5.2.9–2（完整）<br />
# XCache 2.0.4<br />
# MySQL 5.0（服务端和命令行工具）<br />
# phpMyAdmin 3.2<br />
# Magento 1.4.1.1 (集成后台中文语言包)</p>
<p style="text-align: left;">****************************************************</p>
<p style="text-align: left;">MySQL 默认账号密码:root</p>
<p style="text-align: left;">magento后台地址</p>
<p style="text-align: left;">http://127.0.0.1/magento/index.php/admin</p>
<p style="text-align: left;">magento后台账号:magentochina密码:1q2w3e4r5t</p>
<p style="text-align: left;">****************************************************</p>
<p style="text-align: left;">解压缩后运行apmxe.exe</p>
<p style="text-align: left;">by jidda<br />
QQ:23363038<br />
MSN:jidda@live.cn</p>
<p>http://www.magentochina.org</p>
<p style="text-align: left;">Windows 7 64bit, Windows xp sp3 32bit 测试通过</p>
<p style="text-align: left;">注意事项:<br />
1.APACHE默认端口80,请确保安装时系统80端口未被占用(如迅雷)<br />
2.mysql默认端口3306<br />
3.如要卸载,请先把apache和mysql服务停止,直接删除文件夹即可<br />
4.安装包直接用的好压haozip制作,安装完成后会出现假死,不用理会,直接关闭即可<br />
4.apache,php,mysql的配置文件在/etc目录中,修改template文件即可%APMXE%为apmxe.exe所在目录的位置变量</p>
<p style="text-align: left;">
</p><p style="text-align: left;"><span style="color: #ff0000;"><a href="http://1.dc.ftn.qq.com/ftn_handler/fc2e0a62b55200d358374a3daf51af58a67a982e51feb67aab5d53f33217fcd2af3ba2cf80316e3c54417cb4e9ecb76d555a5e91b50c41e864850af135e8a6b4/magento%E9%9B%86%E6%88%90%E5%AE%89%E8%A3%85%E5%8C%851411.7z?k=7f64303073ef8fcbec1954311732051a07075656020a53001f535608011f035757011d09080704185706030406545503575d0603312a37585303555e455d8b9a81ad8082e68287c9035001011f054d357b&amp;fr=00&amp;&amp;txf_fid=92ac1d3877b4234f26a41917b43adfd183f6e560" >QQ文件中转站下载</a> 提取码（2d001275）</span></p>
<p style="text-align: left;"><span style="color: #ff0000;"><a href="http://u.115.com/file/f5fb94192f" >115网络U盘下载</a></span></p>

]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/magento-1-4-1-1-windows-%e9%9b%86%e6%88%90%e5%ae%89%e8%a3%85%e5%8c%85-with-apmxe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>prototype的简单Ajax</title>
		<link>http://www.magentochinese.org/prototype%e7%9a%84%e7%ae%80%e5%8d%95ajax/</link>
		<comments>http://www.magentochinese.org/prototype%e7%9a%84%e7%ae%80%e5%8d%95ajax/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 07:49:08 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[开发]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Lamp]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=93</guid>
		<description><![CDATA[function getContents() { var request_url = “test1.html”; // 需要获取内容的url var request_pars = ”;//请求参数 var myAjax = new Ajax.Updater(‘result’, request_url,{ // 将request_url返回内容绑定到id为result的容器中 method : ‘get’, //HTTP请求的方法,get or post parameters : request_pars, //请求参数 onFailure : reportError, //失败的时候调用 reportError 函数 onLoading : loading, //正在获得内容的时候 onComplete : done //内容获取完毕的时候 }); } function loading() { $(‘loading’).style.display = ‘block’; } function [...]]]></description>
			<content:encoded><![CDATA[
<pre class="brush: jscript; title: ;">function getContents()
{
var request_url = “test1.html”; // 需要获取内容的url
var request_pars = ”;//请求参数

var myAjax = new Ajax.Updater(‘result’, request_url,{ // 将request_url返回内容绑定到id为result的容器中
method : ‘get’, //HTTP请求的方法,get or post
parameters : request_pars, //请求参数
onFailure : reportError, //失败的时候调用 reportError 函数
onLoading : loading, //正在获得内容的时候
onComplete : done //内容获取完毕的时候
});
}

function loading()
{
$(‘loading’).style.display = ‘block’;
}

function done()
{
$(‘loading’).style.display = ‘none’;
}

function reportError(request)
{
alert(‘Sorry. There was an error.’);
}</pre>

]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/prototype%e7%9a%84%e7%ae%80%e5%8d%95ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javascript去除数组重复</title>
		<link>http://www.magentochinese.org/javascript%e5%8e%bb%e9%99%a4%e6%95%b0%e7%bb%84%e9%87%8d%e5%a4%8d/</link>
		<comments>http://www.magentochinese.org/javascript%e5%8e%bb%e9%99%a4%e6%95%b0%e7%bb%84%e9%87%8d%e5%a4%8d/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 02:15:43 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Lamp]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=89</guid>
		<description><![CDATA[
js数组去重就是把数组中重复的元素去掉：

Array.prototype.delRepeat=function(){
var newArray=new Array();
var len=this.length;
for (var i=0;i
for(var j=i+1;j
if(this[i]===this[j]){
j=++i;
}
}
newArray.push(this[i]);
}
return newArray;
...]]></description>
			<content:encoded><![CDATA[
<p style="text-align: left;">js数组去重就是把数组中重复的元素去掉：</p>
<p style="text-align: left;">
<pre class="brush: jscript; title: ;">Array.prototype.delRepeat=function(){
var newArray=new Array();
var len=this.length;
for (var i=0;i
for(var j=i+1;j
if(this[i]===this[j]){
j=++i;
}
}
newArray.push(this[i]);
}
return newArray;
}</pre>
</p>
<p style="text-align: left;">但是很明显这里有for循环内嵌了另一个for循环，在大数据量下肯定非常耗时!效率低下!经过查找和高人指点优化了一个新方法：</p>
<p style="text-align: left;">
<pre class="brush: jscript; title: ;">Array.prototype.delRepeat=function(){
var newArray=[];
var provisionalTable = {};
for (var i = 0, item; (item= this[i]) != null; i++) {
if (!provisionalTable[item]) {
newArray.push(item);
provisionalTable[item] = true;
}
}
return newArray;
}</pre>
</p>
<p style="text-align: left;">就是使用一个临时的provisionalTable对象，将数组的值作为provisionalTable对象的键值，如果相应的值不存在就将这个数组的值push到新数组中。</p>
<p style="text-align: left;">效率是提高了，但是有个bug，就是假设数组中换用可转换的数字和字符串，比如数组[6,"6"]这时候就好被去掉一个。悲剧，同时求解决方法。</p>

]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/javascript%e5%8e%bb%e9%99%a4%e6%95%b0%e7%bb%84%e9%87%8d%e5%a4%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自动获取Magento带前缀的表名</title>
		<link>http://www.magentochinese.org/%e8%87%aa%e5%8a%a8%e8%8e%b7%e5%8f%96magento%e5%b8%a6%e5%89%8d%e7%bc%80%e7%9a%84%e8%a1%a8%e5%90%8d/</link>
		<comments>http://www.magentochinese.org/%e8%87%aa%e5%8a%a8%e8%8e%b7%e5%8f%96magento%e5%b8%a6%e5%89%8d%e7%bc%80%e7%9a%84%e8%a1%a8%e5%90%8d/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 01:19:03 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[开发]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[Lamp]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=84</guid>
		<description><![CDATA[在写插件时，有的用户安装magento时设置了表的前缀，而有的用户没有，如果直接把表名写死在那，是不正确的。 magento提供了获取表名的的一个方法： $tableName = Mage::getSingleton('core/resource')-&#62;getTableName('默认表名');]]></description>
			<content:encoded><![CDATA[
<p>在写插件时，有的用户安装magento时设置了表的前缀，而有的用户没有，如果直接把表名写死在那，是不正确的。</p>
<p>magento提供了获取表名的的一个方法：</p>
<pre class="brush: php; title: ;">$tableName = Mage::getSingleton('core/resource')-&gt;getTableName('默认表名');</pre>

]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e8%87%aa%e5%8a%a8%e8%8e%b7%e5%8f%96magento%e5%b8%a6%e5%89%8d%e7%bc%80%e7%9a%84%e8%a1%a8%e5%90%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决 magento contact us 无法发送问题</title>
		<link>http://www.magentochinese.org/%e8%a7%a3%e5%86%b3-magento-contact-us-%e6%97%a0%e6%b3%95%e5%8f%91%e9%80%81%e9%97%ae%e9%a2%98/</link>
		<comments>http://www.magentochinese.org/%e8%a7%a3%e5%86%b3-magento-contact-us-%e6%97%a0%e6%b3%95%e5%8f%91%e9%80%81%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 15:13:41 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[开发]]></category>
		<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[Lamp]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=79</guid>
		<description><![CDATA[解决magento contact us无法发送问题 需要修改的文件 /app/design/frontend/base/default/template/contacts/form.phtml 查找一下代码 &#60;div class=&#34;buttons-set&#34;&#62; &#60;p class=&#34;required&#34;&#62;&#60;?php echo Mage::helper('contacts')-&#62;__('* Required Fields') ?&#62;&#60;/p&#62;&#60;input type=&#34;image&#34; src=&#34;&#60;?php echo $this-&#62;getSkinUrl('images/btn_submit.gif');?&#62;&#34;alt=&#34;&#60;?php echo Mage::helper('contacts')-&#62;__('Submit') ?&#62;&#34;/&#62;&#60;/div&#62; 替换成 &#60;div class=&#34;buttons-set&#34;&#62; &#60;p class=&#34;required&#34;&#62;&#60;?php echo Mage::helper('contacts')-&#62;__('* Required Fields') ?&#62;&#60;/p&#62;&#60;input type=&#34;text&#34; name=&#34;hideit&#34; id=&#34;hideit&#34; value=&#34;&#34; style=&#34;display:none !important;&#34;/&#62;&#60;button type=&#34;submit&#34; title=&#34;&#60;?php echo Mage::helper('contacts')-&#62;__('Submit') ?&#62;&#34;class=&#34;button&#34;&#62;&#60;span&#62;&#60;span&#62;&#60;?php echo Mage::helper('contacts')-&#62;__('Submit') ?&#62;&#60;/span&#62;&#60;/span&#62;&#60;/button&#62; &#60;/div&#62; &#8212;&#8212;&#8212;&#8212;&#8211;另类问题&#8212;&#8211;一下几点是收集的看看有没有对大家有帮助&#8212;&#8212;&#8212;&#8212;&#8212; magento的contact us是一个非常重要的一个功能，当在线客服不在时，客户可以通过contact us发送邮件来联系我们。问题是，总是会出来这样或者那样的问题导致magento下面的这个功能无法使用。 我这边要说明的是一种非常特殊的情况引起的这个问题。但是我在magento论坛上搜索了，碰到的更多的是其它的状况，一起记录一下。 Unable to submit [...]]]></description>
			<content:encoded><![CDATA[
<p>解决magento contact us无法发送问题</p>
<p>需要修改的文件</p>
<p>/app/design/frontend/base/default/template/contacts/form.phtml</p>
<p>查找一下代码</p>
<pre class="brush: xml; title: ;">&lt;div class=&quot;buttons-set&quot;&gt;
&lt;p class=&quot;required&quot;&gt;&lt;?php echo Mage::helper('contacts')-&gt;__('* Required Fields') ?&gt;&lt;/p&gt;&lt;input type=&quot;image&quot; src=&quot;&lt;?php echo $this-&gt;getSkinUrl('images/btn_submit.gif');?&gt;&quot;alt=&quot;&lt;?php echo Mage::helper('contacts')-&gt;__('Submit') ?&gt;&quot;/&gt;&lt;/div&gt;</pre>
<p>替换成</p>
<pre class="brush: xml; title: ;">&lt;div class=&quot;buttons-set&quot;&gt;
&lt;p class=&quot;required&quot;&gt;&lt;?php echo Mage::helper('contacts')-&gt;__('* Required Fields') ?&gt;&lt;/p&gt;&lt;input type=&quot;text&quot; name=&quot;hideit&quot; id=&quot;hideit&quot; value=&quot;&quot; style=&quot;display:none !important;&quot;/&gt;&lt;button type=&quot;submit&quot; title=&quot;&lt;?php echo Mage::helper('contacts')-&gt;__('Submit') ?&gt;&quot;class=&quot;button&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo Mage::helper('contacts')-&gt;__('Submit') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;
&lt;/div&gt;</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;另类问题&#8212;&#8211;一下几点是收集的看看有没有对大家有帮助&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>magento的contact us是一个非常重要的一个功能，当在线客服不在时，客户可以通过contact us发送邮件来联系我们。问题是，总是会出来这样或者那样的问题导致magento下面的这个功能无法使用。</p>
<p>我这边要说明的是一种非常特殊的情况引起的这个问题。但是我在magento论坛上搜索了，碰到的更多的是其它的状况，一起记录一下。</p>
<p><span style="color: #ff0000;">Unable to submit your request. Please, try again later</span></p>
<p>首先引起这个问题的可能性是你在后台没有设置用来接收邮件的邮箱。contact us表单是客户用来提交咨询信息的表单，那这个表单的信息要发送到一个我们指定的邮箱。如果你没有指定邮箱，自然contact us就无法使用。</p>
<p><span style="color: #ff0000;">System -&gt; Configuration -&gt; General -&gt; Contacts</span> 在magento后台的这个地方设置</p>
<p>另外一个发送失败的可能是，由于magento找不到相应的邮件模板。</p>
<p>还有的一个可能是论坛中提到的，升级到magento新版本后出现的问题即1.401版本时。</p>
<p>要么注释掉（不推荐）<span style="color: #ff0000;">app/code/core/Mage/Contacts/controllers/IndexController.php</span>的</p>
<pre class="brush: php; title: ;">if (Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
$error = true;
}</pre>
<p>要么就在模板<span style="color: #ff0000;">app/design/frontend/default/THEME/template/contacts/form.phtm</span>中的form标签下添加：</p>
<pre class="brush: xml; title: ;">&lt;input id=&quot;hideit&quot; style=&quot;display: none !important;&quot; name=&quot;hideit&quot; type=&quot;text&quot; /&gt;</pre>
<p>我碰到的一个特殊情况：因为同一个服务器上的其它网站，包括magento，zen cart的网站，可以正常发信。所以基本上可以排除是邮件服务器的问题。但是结果其实还是邮件服务器的配置问题。</p>
<p>http://www.jidda.me/</p>
<p>不能成功发送邮件的网站都是使用了同一个域名（以abc.com）的邮箱， 如xxx@abc.com , xxxx@abc.com ，我是在跟踪php代码后发现异常是在mail函数执行后丢出的。查看了sendmail的日志后猜测是由于这个域名引起的。abc.com被设定为这台服务器的hostname.而这个域名的邮件记录呢是设置成了指定google.它使用的是google免费企业邮。对于服务器外部发送给这个域名的邮箱时自然使用的是DNS的解析记录，会转到gmail.但是，由服务器发出的就使用了/etc/hosts的解析，这样就当成是发给服务器自己了。而服务器上是没有这些邮件账户的。结果就失败了。邮件服务器需要进一步设置。把邮件转到gmail上去。</p>

]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e8%a7%a3%e5%86%b3-magento-contact-us-%e6%97%a0%e6%b3%95%e5%8f%91%e9%80%81%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>深入理解Magento – 第四章 – 模型和ORM基础</title>
		<link>http://www.magentochinese.org/%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3magento-%e2%80%93-%e7%ac%ac%e5%9b%9b%e7%ab%a0-%e2%80%93-%e6%a8%a1%e5%9e%8b%e5%92%8corm%e5%9f%ba%e7%a1%80-2/</link>
		<comments>http://www.magentochinese.org/%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3magento-%e2%80%93-%e7%ac%ac%e5%9b%9b%e7%ab%a0-%e2%80%93-%e6%a8%a1%e5%9e%8b%e5%92%8corm%e5%9f%ba%e7%a1%80-2/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 15:37:39 +0000</pubDate>
		<dc:creator>jidda</dc:creator>
				<category><![CDATA[聚合]]></category>
		<category><![CDATA[hellokeykey]]></category>
		<category><![CDATA[Lamp]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://jidda.me/?p=76</guid>
		<description><![CDATA[作者：Alan Storm 翻译：Hailong Zhang 第四章 – 模型和ORM基础 对于任何一个MVC架构，模型（Model）层的实现都是占据了很大一部分。对于Magento来说，模型占据了一个更加重要的位置，因为它常常包含了一部分商业逻辑代码（可以说它对，也可以说它错）。这些代码在其他的MVC框架中往往出现在控制器或者帮助函数中。 传统的PHP MVC架构中的模型 本来MVC的定义就不是很清晰，不同的人有不同的看法，而对于模型的定义争议就更多了。在MVC模式被广泛采用之前，PHP程序员往往通过SQL语句直接操作数据库。也有些程序员通过一个SQL抽象层来操作数据库（比如AdoDB）。程序员往往关注SQL语句本身，而不是和数据相关的对象。 虽然直接操作SQL的方式一直被病诟，但是很多PHP框架还是以SQL为中心的。模型层提供了一系列对象，抽象/封装了数据操作，但是程序员最终还是需为模型层对象写SQL语句操作数据库。 还有一些框架回避了SQL，使用了对象关系映射（Object Relational Mapping，ORM）来解决这个问题。使用这个方法的话，程序员不用关注SQL，而只需要和对象打交道。我们可以操作一个对象的属性，当“Save”方法被调用的时候，对象的属性会作为数据自动的被写入数据库。有些ORM框架会根据数据表的信息自动推测对象的属性，也有框架要求用户显示的生命对象属性和表的关系。比较有名的ORM框架有ActiveRecord等等。【译者注：ActiveRecord源自Ruby on Rails，不过现在PHP也有了】 关于ORM的概念，我就解释到这里。但是和许多计算机领域的其他概念一样，ORM的定义也越来越模糊了。我不想在这片文章中讨论关于ORM的争议，所以我说的ORM就是那个最基本的ORM概念。 Magento的模型 Magento理所当然的也追随潮流应用了ORM。虽然Magento自带的Zend框架提供了SQL抽象层，但是在大多数情况下我们将通过Magento自带的模型和我们自己的模型来进行数据访问。他和视图层（View）一样，Magento的模型层也不是简单的ORM，而是一个高度灵活，高度抽象甚至有点令人费解。 解剖Magento的模型 大部分的Magento模型分为两类。第一类是基本的ActiveRecord类型，一张表一个对象的模型。第二类是Entity Attribute Value（EAV）模型。【译者注：EAV翻译成“实体属性值”有点词不达意，还是就叫EAV的好】Magento自己定义了一个数据类型叫做模型集合（Model Collection）。顾名思义，模型集合就是一个对象里面包含了很多模型对象。Magento的创造者Varien团队实现了PHP类库的标准接口，“IteratorAggregate”，“Countable”。这样模型集合就能调用这些方法，这也是模型集合和数组的区别。 Magento的模型并不直接访问数据库。每一个模型都有一个资源模型（Resource Model），每一个资源模型拥有两个适配器（Adapter），一个读，一个写。这样的话逻辑模型和数据库访问就分开了，所以从理论上讲更改底层数据库只需要重写适配器就可以了，所有上层代码都不需要更改。 创建一个基本模型 【译者注：从这一章开始我用我自己的例子替换了Alan的例子】继续我们Hello World的例子。在Hello World模块中创建BlogController.php如下 class Zhlmmc_Helloworld_BlogController extends Mage_Core_Controller_Front_Action { public function indexAction() { echo 'Hello Blog'; } } 访问以下URL http://127.0.0.1/Magento/helloworld/blog 你应该看到“Hello Blog”输出。 创建数据表 我们可以通过Magento自带的方法创建或者修改数据库，但是为了不引入过多新内容，我们暂且手工创建一张表。在你的数据库中执行以下语句 CREATE TABLE `blog_posts` ( [...]]]></description>
			<content:encoded><![CDATA[
<p>作者：<a href="http://alanstorm.com/">Alan Storm</a><br />
翻译：<a href="http://www.zhlmmc.com/">Hailong Zhang</a></p>
<h3>第四章 – 模型和ORM基础</h3>
<p>对于任何一个MVC架构，模型（Model）层的实现都是占据了很大一部分。对于Magento来说，模型占据了一个更加重要的位置，因为它常常包含了一部分商业逻辑代码（可以说它对，也可以说它错）。这些代码在其他的MVC框架中往往出现在控制器或者帮助函数中。</p>
<h4>传统的PHP MVC架构中的模型</h4>
<p>本来MVC的定义就不是很清晰，不同的人有不同的看法，而对于模型的定义争议就更多了。在MVC模式被广泛采用之前，PHP程序员往往通过SQL语句直接操作数据库。也有些程序员通过一个SQL抽象层来操作数据库（比如AdoDB）。程序员往往关注SQL语句本身，而不是和数据相关的对象。</p>
<p>虽然直接操作SQL的方式一直被病诟，但是很多PHP框架还是以SQL为中心的。模型层提供了一系列对象，抽象/封装了数据操作，但是程序员最终还是需为模型层对象写SQL语句操作数据库。</p>
<p>还有一些框架回避了SQL，使用了对象关系映射（Object Relational Mapping，ORM）来解决这个问题。使用这个方法的话，程序员不用关注SQL，而只需要和对象打交道。我们可以操作一个对象的属性，当“Save”方法被调用的时候，对象的属性会作为数据自动的被写入数据库。有些ORM框架会根据数据表的信息自动推测对象的属性，也有框架要求用户显示的生命对象属性和表的关系。比较有名的ORM框架有ActiveRecord等等。【译者注：ActiveRecord源自Ruby on Rails，不过现在PHP也有了】</p>
<p>关于ORM的概念，我就解释到这里。但是和许多计算机领域的其他概念一样，ORM的定义也越来越模糊了。我不想在这片文章中讨论关于ORM的争议，所以我说的ORM就是那个最基本的ORM概念。</p>
<h4>Magento的模型</h4>
<p>Magento理所当然的也追随潮流应用了ORM。虽然Magento自带的Zend框架提供了SQL抽象层，但是在大多数情况下我们将通过Magento自带的模型和我们自己的模型来进行数据访问。他和视图层（View）一样，Magento的模型层也不是简单的ORM，而是一个高度灵活，高度抽象甚至有点令人费解。</p>
<h4>解剖Magento的模型</h4>
<p>大部分的Magento模型分为两类。第一类是基本的ActiveRecord类型，一张表一个对象的模型。第二类是Entity Attribute Value（EAV）模型。【译者注：EAV翻译成“实体属性值”有点词不达意，还是就叫EAV的好】Magento自己定义了一个数据类型叫做模型集合（Model Collection）。顾名思义，模型集合就是一个对象里面包含了很多模型对象。Magento的创造者Varien团队实现了PHP类库的标准接口，“IteratorAggregate”，“Countable”。这样模型集合就能调用这些方法，这也是模型集合和数组的区别。</p>
<p>Magento的模型并不直接访问数据库。每一个模型都有一个资源模型（Resource Model），每一个资源模型拥有两个适配器（Adapter），一个读，一个写。这样的话逻辑模型和数据库访问就分开了，所以从理论上讲更改底层数据库只需要重写适配器就可以了，所有上层代码都不需要更改。<br />
创建一个基本模型</p>
<p>【译者注：从这一章开始我用我自己的例子替换了Alan的例子】继续我们Hello World的例子。在Hello World模块中创建BlogController.php如下</p>
<pre class="brush: php; title: ;">class Zhlmmc_Helloworld_BlogController extends Mage_Core_Controller_Front_Action {
    public function indexAction()
    {
         echo 'Hello Blog';
    }
}</pre>
<p>访问以下URL<br />
<code>http://127.0.0.1/Magento/helloworld/blog</code><br />
你应该看到“Hello Blog”输出。</p>
<h4>创建数据表</h4>
<p>我们可以通过Magento自带的方法创建或者修改数据库，但是为了不引入过多新内容，我们暂且手工创建一张表。在你的数据库中执行以下语句</p>
<pre class="brush: sql; title: ;">CREATE TABLE `blog_posts` (
  `blogpost_id` int(11) NOT NULL auto_increment,
  `title` text,
  `post` text,
  `date` datetime default NULL,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`blogpost_id`)
);</pre>
<p>INSERT INTO `blog_posts` VALUES (1,&#8217;My New Title&#8217;,'This is a blog post&#8217;,&#8217;2009-07-01 00:00:00&#8242;,&#8217;2009-07-02 23:12:30&#8242;);<br />
这里我们创建了一张名为“blog_posts”的表，并填充了一条数据。</p>
<h4>创建模型</h4>
<p>要设置一个模型一共有以下四个步骤</p>
<ol>
<li>启用模型</li>
<li>启用资源模型</li>
<li>在资源模型中添加实体（Entity）。对于简单的模型来说，实体就是数据表的名字</li>
<li>为资源模型设置读、写适配器</li>
</ol>
<p>在进行这些步骤之前，我们先来看假设这些步骤已经做完了，我们怎么用一个模型。在Magento中，我们用以下的方式来实例化一个模型</p>
<pre class="brush: php; title: ;">$model = Mage::getModel('helloworld/blogpost');</pre>
<p>和我们以前讲过的“Mage::getHelper()”的原理类似，这里Magento也是通过全局配置去查找模型的类名。模型的类名和我们以前讲过的块类名一样，都是分组类名。这里参数的前半部分“helloworld”是组名（Group Name），后半部分“blogpost”是半类名（Class Name）【译者注：我将“Class Name”翻译成半类名是为了和类名区分开来】。具体步骤如下</p>
<ol>
<li>从全局配置“/global/models/GROUP_NAME/class”获得基本类名“Zhlmmc_Helloworld_Model”</li>
<li>检查全局配置“/global/models/GROUP_NAME/rewrite/CLASS_NAME”是否设置，如果有那么这个节点的值将被作为类名实例化</li>
<li>否则，最终的类名将是基本类名加上半类名，也就是“Zhlmmc_Helloworld_Model_Blogpost”</li>
</ol>
<h4>启用模型</h4>
<p>修改模块的config.xml</p>
<pre class="brush: xml; title: ;">&lt;global&gt;
    &lt;!-- ... --&gt;
    &lt;models&gt;
        &lt;helloworld&gt;
            &lt;class&gt;Zhlmmc_Helloworld_Model&lt;/class&gt;
            &lt;!--
            need to create our own resource, can't just
            use core_mysql4
            --&gt;
            &lt;resourceModel&gt;helloworld_mysql4&lt;/resourceModel&gt;
        &lt;/helloworld&gt;
    &lt;/models&gt;
    &lt;!-- ... --&gt;
&lt;/global&gt;</pre>
<p>标签&lt;helloworld /&gt;就是组名，也应该和模块名一致。&lt;class /&gt;标签的内容是基本类名，所有Helloworld模块的模型都用这个基本类名,命名方式如下<br />
<code>Packagename_Modulename_Model</code><br />
&lt;resourceModel /&gt;标签指明了这个模块的模型要用哪个资源模型。这个标签的内容是组名加上“mysql4”我们将在后面详细介绍资源模型。</p>
<p>现在让我们来实例化一个模型看看，修改indexAction方法</p>
<pre class="brush: php; title: ;">public function indexAction()
{
    $blogpost = Mage::getModel('helloworld/blogpost');
    echo get_class($blogpost);
}</pre>
<p>清空Magento缓存，刷新页面，你应该看到一个类似这样的异常（请先打开Magento的<a href="http://alanstorm.com/magento_log_and_developer_mode" >开发模式</a>）</p>
<pre class="brush: php; title: ;">include(Zhlmmc\Helloworld\Model\Blogpost.php) [&lt;a href='function.include'&gt;function.include&lt;/a&gt;]: failed to open stream: No such file or directory</pre>
<p>原因很简单，就是Magento尝试去实例化“Zhlmmc_Helloworld_Model_Blogpost”，但是它在Helloworld模块的文件夹里面找不到这个类。所以我们现在来创建这个类<br />
File: app/code/local/Zhlmmc/Helloworld/Model/Blogpost.php</p>
<pre class="brush: php; title: ;">class Zhlmmc_Helloworld_Model_Blogpost extends Mage_Core_Model_Abstract
{
    protected function _construct()
    {
        $this-&gt;_init('helloworld/blogpost');
    }
}</pre>
<p>刷新页面，你应该看到页面上显示“Zhlmmc_Helloworld_Model_Blogpost”。所有的模型都必须继承“Mage_Core_Model_Abstract”类。这个抽象类强制你实现一个方法“_construct”（注意：这个不是PHP的构造行数“__construct”）。这个方法应该调用父类已经定义好的“_init”方法，参数是资源模型的URI，也就是我们要告诉模型使用哪个资源模型。我们将在解释资源模型的时候再解释这个URI。</p>
<h4>启用资源模型并添加实体</h4>
<p>好了，我们设置好了模型，下面我们要为模型设置资源模型。资源模型才是真正和数据库对话的组件。在模型的配置中，有一段这样的代码</p>
<pre class="brush: xml; title: ;">&lt;resourceModel&gt;helloworld_mysql4&lt;/resourceModel&gt;</pre>
<p>&lt;resourceModel /&gt;的值将被用来实例化资源模型。我们不需要显式的调用资源模型，但是当一个模型需要访问数据库的时候，Magento会自动实例化一个资源模型来使用。</p>
<pre class="brush: php; title: ;">Mage::getResourceModel('helloworld/blogpost');</pre>
<p>这里“helloworld/blogpost”就是我们给模型的“_init”传入的参数。“helloworld”是组名，“blogpost”是模型的半类名。“Mage::getResourceModel”方法将以“helloworld/blogpost”为URI在全局配置中找到&lt;resourceModel&gt;标签的值，在这里是“helloworld_mysql4”。然后Magento会用URI“helloworld_mysql4/blogpost”去实例化资源模型类。实例化的过程和我们前面讲的模型的实例化是一样的，所以我们也需要在config.xml中添加资源模型的声明</p>
<pre class="brush: xml; title: ;">&lt;global&gt;
    &lt;!-- ... --&gt;
    &lt;models&gt;
        &lt;!-- ... --&gt;
        &lt;helloworld_mysql4&gt;
           &lt;class&gt;Zhlmmc_Helloworld_Model_Resource_Mysql4&lt;/class&gt;
        &lt;/helloworld_mysql4&gt;
    &lt;/models&gt;
&lt;/global&gt;</pre>
<p>这里我们可以看到，资源模型的声明也是放在&lt;models /&gt;下面的。有点搞，但是也不必深究了，Magento就这么定义的。&lt;class /&gt;标签的值是所有资源模型类的基本类名，命名方式如下<br />
<code>Packagename_Modulename_Model_Resource_Mysql4</code><br />
好了，我们已经配置了资源模型，我们来试试装载一些数据。修改indexAction如下</p>
<pre class="brush: php; title: ;">public function indexAction()
{
    $params = $this-&gt;getRequest()-&gt;getParams();
    $blogpost = Mage::getModel('helloworld/blogpost');
    echo(&quot;Loading the blogpost with an ID of &quot;.$params['id'].&quot;&lt;br/&gt;&quot;);
    $blogpost-&gt;load($params['id']);
    $data = $blogpost-&gt;getData();
    var_dump($data);
}</pre>
<p>清空Magento缓存，访问下面的页面<br />
<code>http://127.0.0.1/Magento/helloworld/blog/index/id/1</code><br />
你应该看到一个类似下面这样的异常</p>
<pre class="brush: php; title: ;">include(Zhlmmc\Helloworld\Model\Resource\Mysql4\Blogpost.php) [function.include]: failed to open stream: No such file or directory</pre>
<p>我想你看到这里也明白了，我们要为模型添加一个资源类，添加如下文件<br />
File: app/code/local/Zhlmmc/Helloworld/Model/Resource/Mysql4/Blogpost.php</p>
<pre class="brush: php; title: ;">class Zhlmmc_Helloworld_Model_Resource_Mysql4_Blogpost extends Mage_Core_Model_Mysql4_Abstract
{
    protected function _construct()
    {
        $this-&gt;_init('helloworld/blogpost', 'blogpost_id');
    }
}</pre>
<p>这里“_init”方法的第一个参数这个资源模型将要使用的数据表的URI，第二个参数是数据表中的列名。这个列的内容必须唯一，往往是数据表的主键。</p>
<h4>为资源模型添加实体</h4>
<p>刷新页面，你是不是得到下面的异常？<br />
<code>Can't retrieve entity config: helloworld/blogpost</code><br />
那是因为我们的资源文件现在还是一个空壳，并没有和数据库联系起来。现在我们来把资源模型和我们的表联系起来，修改config.xml如下</p>
<pre class="brush: xml; title: ;">&lt;global&gt;
    &lt;!-- ... --&gt;
    &lt;models&gt;
        &lt;!-- ... --&gt;
        &lt;helloworld_mysql4&gt;
           &lt;class&gt;Zhlmmc_Helloworld_Model_Resource_Mysql4&lt;/class&gt;
           &lt;entities&gt;
               &lt;blogpost&gt;
                   &lt;table&gt;blog_posts&lt;/table&gt;
               &lt;/blogpost&gt;
           &lt;/entities&gt;
        &lt;/helloworld_mysql4&gt;
    &lt;/models&gt;
&lt;/global&gt;</pre>
<p>我们前面设置了资源模型使用的数据表的URI是“helloworld/blogpost”，那么Magento会把“helloworld”作为组名，“blogpost”作为实体名，也就是&lt;blogpost&gt;。在Magento的简单模型中（也就是继承Mage_Core_Model_Mysql4_Abstract的模型），一个实体对应一张数据表。我们的数据表是“blog_posts”，所以这里&lt;table /&gt;标签的内容就是“blog_posts”。</p>
<p>清空Magento缓存，再次刷新页面，你应该看到以下内容</p>
<pre class="brush: php; title: ;">Loading the blogpost with an ID of 1
array(5) { [&quot;blogpost_id&quot;]=&gt; string(1) &quot;1&quot; [&quot;title&quot;]=&gt; string(12) &quot;My New Title&quot; [&quot;post&quot;]=&gt; string(19) &quot;This is a blog post&quot; [&quot;date&quot;]=&gt; string(19) &quot;2009-07-01 00:00:00&quot; [&quot;timestamp&quot;]=&gt; string(19) &quot;2009-07-02 23:12:30&quot; }</pre>
<h4>设置读写适配器</h4>
<p>在上面的例子中，我们已经可以从数据库中取数据了，但是我们却没有为资源模型设置读写适配器，怎么回事呢？原因很简单，那就是因为Magento会为没有适配器的资源模型启用默认适配器。我们也可以显式的配置默认的适配器</p>
<pre class="brush: xml; title: ;">&lt;global&gt;
    &lt;!-- ... --&gt;
    &lt;resources&gt;
        &lt;helloworld_write&gt;
            &lt;connection&gt;
                &lt;use&gt;default_write&lt;/use&gt;
            &lt;/connection&gt;
        &lt;/helloworld_write&gt;
        &lt;helloworld_read&gt;
            &lt;connection&gt;
                &lt;use&gt;default_read&lt;/use&gt;
            &lt;/connection&gt;
        &lt;/helloworld_read&gt;
    &lt;/resources&gt;
&lt;/global&gt;</pre>
<p>在&lt;resources /&gt;标签下面有两个部分，一个读，一个写。标签名字中的“hellworld”是我们定义的组名【译者注：在资源模型的“_init”函数中传入的数据表的URI “helloworld/blogpost”的前半部分就是适配器名字的前半部分】。从这里我们也可以看出来一个资源组对应一对适配器。清空Magento缓存，刷新浏览器，你应该看到和刚才相同的页面。【译者注：如果你去全局配置中找“core_read”你会发现“default_read”，然后是“default_setup”</p>
<pre class="brush: xml; title: ;">&lt;default_setup&gt;
    &lt;connection&gt;
        &lt;model&gt;mysql4&lt;/model&gt;
        &lt;initStatements&gt;SET NAMES utf8&lt;/initStatements&gt;
        &lt;type&gt;pdo_mysql&lt;/type&gt;
        &lt;host&gt;localhost&lt;/host&gt;
        &lt;username&gt;root&lt;/username&gt;
        &lt;password&gt;admin&lt;/password&gt;
        &lt;dbname&gt;zend-magento&lt;/dbname&gt;
        &lt;active&gt;1&lt;/active&gt;
    &lt;/connection&gt;
&lt;/default_setup&gt;</pre>
<p>这才是最终和数据库连接的详细信息。如果你再往下深究，你会发现全局配置有这么一段</p>
<pre class="brush: xml; title: ;">&lt;resource&gt;
    &lt;connection&gt;
        &lt;types&gt;
            &lt;pdo_mysql&gt;
                &lt;class&gt;Mage_Core_Model_Resource_Type_Db_Pdo_Mysql&lt;/class&gt;
            &lt;/pdo_mysql&gt;
        &lt;/types&gt;
    &lt;/connection&gt;
&lt;/resource&gt;</pre>
<p>所以，“Mage_Core_Model_Resource_Type_Db_Pdo_Mysql”才是最终连接数据库的类。如果我们更换数据库的话，我们要重写一个相似的类来连接别的数据库。</p>
<h4>基本模型操作</h4>
<p>所有的模型最终都继承自类“Varien_Object”。这个类属于Magento的系统类库，不属于Magento的核心模块。你可以在以下位置找到这个类<br />
<code>lib/Varien/Object.php</code><br />
Magento模型的数据保存在“_data”属性中，这个属性是“protected”修饰的。父类“Varian_Object”定义了一些函数用来取出这些数据。我们上面的例子用了“getData”，这个方法返回一个数组，数组的元素是“key/value”对。【译者注：其实就是数据表中一行的数据，“key”就是列名，“value”就是值】我们可以传入一个参数获取某个具体的“key”的值。</p>
<pre class="brush: php; title: ;">$model-&gt;getData();
$model-&gt;getData('title');</pre>
<p>还有一个方法是“getOrigData”，这个方法会返回模型第一次被赋予的值。【译者注：因为模型在初始化以后，值可以被修改，这个方法就是拿到那个最原始的值</p>
<pre class="brush: php; title: ;">$model-&gt;getOrigData();
$model-&gt;getOrigData('title');</pre>
<p>“Varien_Object”也实现了一些PHP的特殊函数，比如神奇的“__call”。你可以对任何一个属性调用“get, set, unset, has”方法</p>
<pre class="brush: php; title: ;">$model-&gt;getBlogpostId();
$model-&gt;setBlogpostId(25);
$model-&gt;unsetBlogpostId();
if($model-&gt;hasBlogpostId()){...}</pre>
<p>这里的方法名中的属性名字符合<a href="http://en.wikipedia.org/wiki/CamelCase" >“camelcase”命名规则</a>【译者注：简单的说就是Java的命名规则，每个单词的第一个字母大写，第一个字母可以大写也可以小写】。为了有效的利用这些方便的方法，我们在定义数据表列名的时候要用小写，并用下划线作为分隔符，比如“blogpost_id”。在最近的Magento版本中，这个规则已经被弱化，为了实现PHP的“ArrayAccess”接口</p>
<pre class="brush: php; title: ;">$id = $model-&gt;['blogpost_id'];
$model-&gt;['blogpost_id'] = 25;
 //etc...</pre>
<p>也就是说，你会在Magento中同时看到这两种技巧的使用。</p>
<h4>Magento中的CRUD操作</h4>
<p>Magento模型通过“load, save, delete”三个方法来支持基本的Create，Read，Update和Delete操作。我们在上面已经使用过“load”方法了。这个方法的参数就是要装在的数据记录的“id”。</p>
<pre class="brush: php; title: ;">$blogpost-&gt;load(1);</pre>
<p>“save”方法可以用来创建新数据或者修改已有数据。我们在BlogController.php中添加如下方法</p>
<pre class="brush: php; title: ;">public function createNewPostAction()
{
    $blogpost = Mage::getModel('helloworld/blogpost');
    $blogpost-&gt;setTitle('Code Post!');
    $blogpost-&gt;setPost('This post was created from code!');
    $blogpost-&gt;save();
    echo 'post created';
}</pre>
<p>访问以下URL<br />
<code>http://127.0.0.1/Magento/helloworld/blog/createNewPost</code><br />
现在你数据表中应该有两条数据了。下面来修改一条数据</p>
<pre class="brush: php; title: ;">public function editFirstPostAction()
{
    $blogpost = Mage::getModel('helloworld/blogpost');
    $blogpost-&gt;load(1);
    $blogpost-&gt;setTitle(&quot;The First post!&quot;);
    $blogpost-&gt;save();
    echo 'post edited';
}</pre>
<p>最后，我们来删除一条数据</p>
<pre class="brush: php; title: ;">public function deleteFirstPostAction()
{
    $blogpost = Mage::getModel('helloworld/blogpost');
    $blogpost-&gt;load(1);
    $blogpost-&gt;delete();
    echo 'post removed';
}</pre>
<h4>模型集合</h4>
<p>上面的例子我们只是演示了对单个数据操作，现在我们来看看如何同时操作多条记录。我们上面已经讲过，每个Magento的模型都有一个独特的模型集合。这些模型集合实现了PHP的“IteratorAggregate”和“Countable”接口，也就是他们可以作为“count”函数的参数，并且可以在“for each”语句中使用。</p>
<p>现在让我们来看看如何使用模型集合，在Blog控制器中添加如下方法</p>
<pre class="brush: php; title: ;">public function showAllBlogPostsAction()
{
    $posts = Mage::getModel('helloworld/blogpost')-&gt;getCollection();
    foreach($posts as $blog_post)
    {
        echo '&lt;h3&gt;'.$blog_post-&gt;getTitle().'&lt;/h3&gt;';
        echo nl2br($blog_post-&gt;getPost());
    }
}</pre>
<p>访问如下URL<br />
<code>http://127.0.0.1/Magento/helloworld/blog/showAllBlogPosts</code><br />
你应该看到以下异常</p>
<pre class="brush: php; title: ;">include(Zhlmmc\Helloworld\Model\Resource\Mysql4\Blogpost\Collection.php) [function.include]: failed to open stream: No such file or directory</pre>
<p>我想你不会被这个异常吓到，已经熟门熟路了。我们需要添加一个PHP类，定义Blogpost的模型集合。每个模型都有一个“protected”属性“_resourceCollectionName”【译者注：从父类“Mage_Core_Model_Abstract”继承来的】。这个属性的值是这个模型对应的模型集合的URI。<br />
<code>protected '_resourceCollectionName' =&gt; string 'helloworld/blogpost_collection'</code><br />
在默认情况下，这个值是模型的URI加上“_collection”。Magento把模型集合也看做是一种资源（Resrouce），所以运用资源模型的命名规则，模型集合的全名是<br />
<code>Zhlmmc_Helloworld_Model_Resource_Mysql4_Blogpost_Collection</code><br />
然后我们要创建如下文件<br />
File: app/code/local/Zhlmmc/Helloworld/Model/Resource/Mysql4/Blogpost/Collection.php</p>
<pre class="brush: php; title: ;">class Zhlmmc_Helloworld_Model_Resource_Mysql4_Blogpost_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
    protected function _construct()
    {
            $this-&gt;_init('helloworld/blogpost');
    }
}</pre>
<p>这里的参数是模型的UR，用来I来初始化模型集合。刷新页面，你应该看到数据库中的Blog都显示出来了。</p>
<h4>总结</h4>
<p>首先我要恭喜你，到这里你已经创建并配置了你的第一个Magento模型。在后面的章节中我们将讲解Magento的另外一种模型Entity Attribute Value Model。</p>
<p>在这章开始的时候，我撒了一个小谎。其实在Magento中，并不是所有的模型都继承自“Mage_Core_Model_Abstract”。在Magento最初的版本中，这个抽象类并不存在。所以有很多模型是直接继承自“Varien_Object”。不过这些并不影响我们创建Magento模型，了解一下就可以了，方便阅读Magento的代码。</p>
<p>原文链接:<a href="http://www.zhlmmc.com/?p=659">http://www.zhlmmc.com/?p=659</a></p>

]]></content:encoded>
			<wfw:commentRss>http://www.magentochinese.org/%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3magento-%e2%80%93-%e7%ac%ac%e5%9b%9b%e7%ab%a0-%e2%80%93-%e6%a8%a1%e5%9e%8b%e5%92%8corm%e5%9f%ba%e7%a1%80-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

