<?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>精東·博客 &#187; Magento</title>
	<atom:link href="http://www.wemvc.com/tag/magento/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wemvc.com</link>
	<description>男人的胸怀是委屈撑大的。</description>
	<lastBuildDate>Tue, 10 Jan 2012 04:26:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>magento &#8211; 计划任务（cron job）在magento中的作用和使用教程</title>
		<link>http://www.wemvc.com/1308.html</link>
		<comments>http://www.wemvc.com/1308.html#comments</comments>
		<pubDate>Fri, 25 Jun 2010 19:29:29 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Cron Job]]></category>
		<category><![CDATA[Crontab]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1308</guid>
		<description><![CDATA[      计划任务（cron job）是Magento系统中一个很有用甚至可以说必须使用的功能，而最近在网上跟人聊天发现很多Magento的使用者不知道这个功能或者知道却认为可有可无，我在这里建议各位Magento的使用者，把这个功能使用起来吧。
在之前关于Newsletter的那篇博文我有讲到，要使新闻能按设定的时间自动发送，就必须设置好计划任务（cron job）。计划任务（cron job）简单的来说就是在系统中每隔一段时间来重复操作一件事，比如每隔多少时间清理日志，比如每天提交Sitemap给google等等。

而要设置计划任务（cron job），需要在网站运行的服务器（以linux为例）写一段脚本来定时调用网站根目录下的cron.php文件。下面是我自己使用的服务器的设置方式：

crontab */5 * * * * /usr/bin/php -f /home/yourdomainname/public_html/cron.php

         当然，首先你的服务器得支持cron job你才能使用crontab 这个命令，设置完的效果是服务器每隔5分钟运行一次你的网站根目录下的cron.php文件，cron.php运行时会去检查计划任务时间表中哪些任务的预定时间已经到了，如果到了就立即执行预定的任务，比如提交sitemap，并同时根据各个任务的配置文件或预先设定的任务（特指newsletter）生成新的计划任务时间表。储存这些数据的是数据库中的cron_schedule表，进这个表你会看到一个计划任务的列表:
&#8220;>
要让某个功能按时运行需要在对应的config.xml中设置计划任务，指定要运行的某个类的某个方法，同样以google sitemap为例

 &#60;crontab&#62;
    &#60;jobs&#62;
        &#60;sitemap_generate&#62;
            [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1308.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Magento PDF发票,支持中文,以及修改的办法</title>
		<link>http://www.wemvc.com/1303.html</link>
		<comments>http://www.wemvc.com/1303.html#comments</comments>
		<pubDate>Fri, 25 Jun 2010 19:17:45 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1303</guid>
		<description><![CDATA[今天给大家讲一下我遇到的问题,顺便说下如果让magento的PDF发票支持中文.
Magento生成PDF发票.使用的是zend framework的zend_pdf类.
下面是一个简单的,使用zend framework生成pdf文件的用法.

&#60;?php
...
// 创建一个新的PDF文档.
$pdf1 = new Zend_Pdf&#40;&#41;;
&#160;
// 加载一个现有的PDF文件.
$pdf2 = Zend_Pdf::load&#40;$fileName&#41;;
&#160;
// 从字符串加载并生成PDF文件.
$pdf3 = Zend_Pdf::parse&#40;$pdfString&#41;;

okay..非常简单吧..
    我们先来看如果让magento的PDF支持中文.
首先,我们要明白.Magento为什么不支持中文..   其实zendcart还有joomla都存在这个问题.
是因为这些程序中,使用的文字库并不支持中文.so,我们只需要替换掉就可以了.

此类文件在这里:app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
找到如下的代码:

protected function _setFontRegular&#40;$object, $size = 7&#41;
&#123;
    $font = Zend_Pdf_Font::fontWithPath&#40;Mage::getBaseDir&#40;&#41; . '/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf'&#41;;
    $object-&#62;setFont&#40;$font, $size&#41;;
    return $font;
&#125;
&#160;
protected function _setFontBold&#40;$object, $size = 7&#41;
&#123;
    $font = Zend_Pdf_Font::fontWithPath&#40;Mage::getBaseDir&#40;&#41; . [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1303.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Magento中我的账户访问权限判断</title>
		<link>http://www.wemvc.com/1252.html</link>
		<comments>http://www.wemvc.com/1252.html#comments</comments>
		<pubDate>Wed, 09 Jun 2010 17:05:20 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1252</guid>
		<description><![CDATA[Magento前台用户访问的权限验证有点搞，呵呵，在ZF中我们一般的写法是用ACL，但是Magento的写法有点搞，是直接写在控制器Mage_Customer_AccountController中的，详细请见preDispatch方法。


    /**
     * Action predispatch
     *
     * Check customer authentication for some actions
     */
    public function preDispatch&#40;&#41;
    &#123;
        // a brute-force protection here [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1252.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于Magento的时间/时区问题</title>
		<link>http://www.wemvc.com/1249.html</link>
		<comments>http://www.wemvc.com/1249.html#comments</comments>
		<pubDate>Wed, 09 Jun 2010 16:56:14 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Magento时区]]></category>
		<category><![CDATA[Magento时间]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1249</guid>
		<description><![CDATA[今天同事研究为啥保存的时间不是东八区时间，由此引来的话题。
Magento整个系统中使用UTC时间，即通用协调时(UTC, Universal Time Coordinated)。这样保证在不同的视图或者Store里使用的时间与本地时间一致，在系统配置中可以看到，每个视图或者店铺可以单独设置时区。
Magento在数据库中存贮的都是UTC时间，在渲染视图的时候会显示当前时间。
如果想在视图中获取当前时间，可以使用如下函数：

Mage::getModel&#40;'core/date'&#41;-&#62;date&#40;&#41;;

或者在Grid中使用：

        $this-&#62;addColumn&#40;'customer_since', array&#40;
            'header'    =&#62; Mage::helper&#40;'customer'&#41;-&#62;__&#40;'Customer Since'&#41;,
            //这个是指定该字段是时间字段，在视图输出的时候会自动转成当地时间。
            'type' [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1249.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>深入理解Magento－第十章－数据操作&amp;数据收集器</title>
		<link>http://www.wemvc.com/1229.html</link>
		<comments>http://www.wemvc.com/1229.html#comments</comments>
		<pubDate>Mon, 31 May 2010 18:54:24 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1229</guid>
		<description><![CDATA[在我们开始介绍数据操作前，我们先介绍一个神兵利器&#8212;Varien Data Collections。在最早的时候我们写php通常用Array来做数据收集器，这个小东西可发挥了大作用，要知道如果你想在其他语言中实现Array有多么难过。
例如c、c＋＋。
在php5中，更是发扬了Array，php内置了一些类和接口，允许你创建你自己的数据结构。Magento充分利用了这一点，在使用Varien_Data_Collection来做数据收集的时候，它实现了php内置IteratorAggregate对象迭代器和Countable两个接口。下面是用php内置类ArrayObject的一个例子。

$array = new ArrayObject&#40;&#41;;
class MyCollection extends ArrayObject&#123;&#125;
$collection = new MyCollection&#40;&#41;;
$collection&#91;&#93; = 'bar';

在接下来的文章中，我认为你已经了解ArrayObject、IteratorAggregate、Countable。如果还是很陌生，我建议你先阅读这篇文章PHP5对象迭代(Object Iteration)。当然你不必了解很底层的东西，你只需要知道如何用就可以了。
适合对象：高级开发者
作者：精东
最后修改时间：2010年5月31日
版本：V 0.1.0

在Magento代码中，其实每个Model都有个Collection。了解这些数据收集器是如何工作的是你成为一个真正Magento开发人员的关键点。
下面让我们开始吧，前面我们创建过一个Helloworld模块，现在我们继续用他开始我们接下来的学习。
创建一个数据收集器]]></description>
		<wfw:commentRss>http://www.wemvc.com/1229.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>深入理解Magento－第九章－修改、扩展、重写Magento代码</title>
		<link>http://www.wemvc.com/1187.html</link>
		<comments>http://www.wemvc.com/1187.html#comments</comments>
		<pubDate>Fri, 28 May 2010 20:13:59 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1187</guid>
		<description><![CDATA[作为一个开发者的你，肯定要修改Magento代码去适应你的业务需求，但是在很多时候我们不希望修改Magento的核心代码，这里有很多原因，例如将来还希望升级Magento、还想使用更多的Magento代码。如果你正在寻找修改Magento代码的最佳方式，那么此篇文章将会是一个不错的教程。
适合对象：高级开发者
适合目标：开发者希望自定义修改Magento
当前版本：Magento versions: 1.4.0.1
作者：精东
最后修改时间：2010年7月13日
版本：V 0.3.0
重写Magento模块(Module)
第一步，你需要创建属于你自己代码的命名空间，例如Wemvc，App等，为了方便与大家分享代码，我将空间命名为App。

app/
     code/
            core/
            community/
            local/
           [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1187.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Magento如何使用和设置Cookie&amp;Session</title>
		<link>http://www.wemvc.com/1178.html</link>
		<comments>http://www.wemvc.com/1178.html#comments</comments>
		<pubDate>Thu, 27 May 2010 18:23:16 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1178</guid>
		<description><![CDATA[给大家介绍两个Magento的核心对象－Mage_Core_Model_Cookie &#038; Mage_Core_Model_Session
首先介绍Mage_Core_Model_Cookie，这个对象主要是用来设置Cookie的，里面主要下列方法：

public function getDomain&#40;&#41;;
public function getConfigDomain&#40;&#41;;
public function getPath&#40;&#41;;
public function getLifetime&#40;&#41;;
public function setLifetime&#40;&#41;;
public function getHttponly&#40;&#41;;
public function isSecure&#40;&#41;;
public function set&#40;&#41;;
public function renew&#40;&#41;;
public function get&#40;&#41;;
public function delete&#40;&#41;;

使用起来非常方便，例如设置一个Cookie：

$cookieModel = Mage::getModel&#40;'core/cookie'&#41;;
$cookieModel-&#62;set&#40;$name, $value, $period, $path, $domain, $secure, $httponly&#41;

接下来看Mage_Core_Model_Session，这个对象的使用很简单，Session的设置如下：

Mage::getSingleton&#40;‘core/session’&#41;-&#62;setXXXX&#40;value&#41;;

注意看到是getSingleton，非getModel，两者间的区别从词义可以理解，Session是单实例对象。
]]></description>
		<wfw:commentRss>http://www.wemvc.com/1178.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>通过命令行来添加Magento插件或升级Magento</title>
		<link>http://www.wemvc.com/1165.html</link>
		<comments>http://www.wemvc.com/1165.html#comments</comments>
		<pubDate>Thu, 27 May 2010 16:31:52 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1165</guid>
		<description><![CDATA[大家都熟悉的Magento Connect提供了大量的插件给使用者，还有方便快捷地升级您的Magento，如果您熟悉命令行，其实安装Magento插件只需要一个插件的KEY即可。
像我这个是在升级Magento的核心包，使用了一个默认的KEY：

./pear install magento-core/Mage_All_Latest

很简单吧？呵呵，Magento是我见过最佳的开源软件。
]]></description>
		<wfw:commentRss>http://www.wemvc.com/1165.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>清除Magento缓存的几种方法</title>
		<link>http://www.wemvc.com/1160.html</link>
		<comments>http://www.wemvc.com/1160.html#comments</comments>
		<pubDate>Thu, 27 May 2010 16:25:06 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1160</guid>
		<description><![CDATA[Magento后台叫“刷新”缓存，实际在程序执行上是清除缓存（Cleaning Cache）。
如果你想在后台刷新缓存，很简单，去后台“System > Cache Management”，点击清除全部缓存，或者在列表中选择一项你想清除的缓存。在这里我主要讲的不是后台清除，而是命令行和程序的直接清除。
如果你想通过命令行清除缓存，你需要使用ssh链接你的服务器，打如下命令：

cd /where/your/mangento/root/var/cache
rm -rf *

如果你需要在你的程序中清除缓存，一般是在计划任务中或者其他任何地方需要用这个，请将下列代码加到你的程序中，很简单。

Mage::app&#40;&#41;-&#62;cleanCache&#40;&#41;;

也可以这样写：

Mage::app&#40;&#41;-&#62;getCache&#40;&#41;-&#62;clean&#40;&#41;;

如果你的计划任务脚本不在Magento程序内部，是个外部的执行脚本，那么你可以这样写：

$magento_bootstrap= '/[YOUR MAGENTO PATH]/app/Mage.php';
require_once $magento_bootstrap;
umask&#40;0&#41;;
Mage::run&#40;&#41;;
Mage::app&#40;&#41;-&#62;cleanCache&#40;&#41;;

多说句，呵呵，Magento里的Mage类是个启动器类，在ZendFramwork中称作Bootstrap，是通向Magento的大门。祝你使用Magento愉快～
]]></description>
		<wfw:commentRss>http://www.wemvc.com/1160.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Magento简单的EAV数据查询</title>
		<link>http://www.wemvc.com/1155.html</link>
		<comments>http://www.wemvc.com/1155.html#comments</comments>
		<pubDate>Thu, 27 May 2010 16:09:09 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1155</guid>
		<description><![CDATA[因为Magento使用了EAV数据模型，所以你几乎不能够使用原始的SQL进行查询数据对象集（Collection），这里提供一个简单的方法去查询你想要的数据。

$products = Mage::getModel&#40;'catalog/product'&#41;-&#62;getCollection&#40;&#41;;
$products-&#62;addAttributeToFilter&#40;'sku', '8888'&#41;;
$products-&#62;addAttributeToSelect&#40;'*'&#41;;
$products-&#62;load&#40;&#41;;
foreach &#40;$products as $_product&#41; &#123;
    print_r&#40;$_product-&#62;getData&#40;&#41;&#41;;
&#125;

希望这段代码可以帮助你，这里还有一个关于addAttributeToFilter方法的介绍。
http://docs.magentocommerce.com/Varien/Varien_Data/Varien_Data_Collection_Db.html#_getConditionSql
再写段查询单条数据的代码，下面是个获取用户地址的方法：

&#160;
customer_address_save_before_listener &#40;$event&#41;
&#123;
  $address = $event-&#62;getCustomerAddress&#40;&#41;;
&#160;
  $database_address = Mage::getModel&#40;'customer/address'&#41;-&#62;load&#40;$address-&#62;getId&#40;&#41;&#41;;
&#125;

]]></description>
		<wfw:commentRss>http://www.wemvc.com/1155.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

