<?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; PHP</title>
	<atom:link href="http://www.wemvc.com/category/development/php/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关于刷新索引的代码</title>
		<link>http://www.wemvc.com/1619.html</link>
		<comments>http://www.wemvc.com/1619.html#comments</comments>
		<pubDate>Tue, 10 Jan 2012 04:26:50 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1619</guid>
		<description><![CDATA[在调整Magento的Index，偶然间看到这样一段代码，写得很好，摘录出来分享下。
    /**
     * Reindex all data what this process responsible is
     *
     * @return unknown_type
     */
    public function reindexAll()
    {
        if ($this-&#62;isLocked()) {
 [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1619.html/feed</wfw:commentRss>
		<slash:comments>176</slash:comments>
		</item>
		<item>
		<title>高级应用Magento-订单创建流程及程序代码</title>
		<link>http://www.wemvc.com/1606.html</link>
		<comments>http://www.wemvc.com/1606.html#comments</comments>
		<pubDate>Sat, 05 Nov 2011 09:20:24 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1606</guid>
		<description><![CDATA[
老规矩，直接看代码吧。下面的代码是如何通过程序创建一个完美订单。

&#60;?php
require_once 'app/Mage.php';
&#160;
Mage::app&#40;'default'&#41;;//初始化程序，设置当前店铺
&#160;
$store = Mage::app&#40;&#41;-&#62;getStore&#40;'default'&#41;;
//通过电子邮件获取用户，当然也可以不获取，创建guest订单
$customer = Mage::getModel&#40;'customer/customer'&#41;;
$customer-&#62;setStore&#40;$store&#41;;
$customer-&#62;loadByEmail&#40;'email_address@gmail.com'&#41;;
&#160;
//初始化Quote，Magento的订单是通过Quote来转化过去的
$quote = Mage::getModel&#40;'sales/quote'&#41;;
$quote-&#62;setStore&#40;$store&#41;;
$quote-&#62;assignCustomer&#40;$customer&#41;;//如果有用户则执行这个
&#160;
$product1 = Mage::getModel&#40;'catalog/product'&#41;-&#62;load&#40;166&#41;; /* HTC Touch Diamond */
$buyInfo1 = array&#40;'qty' =&#62; 1&#41;;
&#160;
$product2 = Mage::getModel&#40;'catalog/product'&#41;-&#62;load&#40;18&#41;; /* Sony Ericsson W810i */
$buyInfo2 = array&#40;'qty' =&#62; 3&#41;;
//添加商品到Quote
$quote-&#62;addProduct&#40;$product1, new Varien_Object&#40;$buyInfo1&#41;&#41;;
$quote-&#62;addProduct&#40;$product2, new Varien_Object&#40;$buyInfo2&#41;&#41;;
//设置账单和收货品地址
$billingAddress = $quote-&#62;getBillingAddress&#40;&#41;-&#62;addData&#40;$customer-&#62;getPrimaryBillingAddress&#40;&#41;&#41;;
$shippingAddress = $quote-&#62;getShippingAddress&#40;&#41;-&#62;addData&#40;$customer-&#62;getPrimaryShippingAddress&#40;&#41;&#41;;
//设置配送和支付方式
$shippingAddress-&#62;setCollectShippingRates&#40;true&#41;-&#62;collectShippingRates&#40;&#41;
                -&#62;setShippingMethod&#40;'flatrate_flatrate'&#41;
  [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1606.html/feed</wfw:commentRss>
		<slash:comments>108</slash:comments>
		</item>
		<item>
		<title>Nginx 配置 for Magento</title>
		<link>http://www.wemvc.com/1601.html</link>
		<comments>http://www.wemvc.com/1601.html#comments</comments>
		<pubDate>Fri, 04 Nov 2011 10:08:48 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[服务器]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1601</guid>
		<description><![CDATA[应群众要求，把nginx配置晒出来了，适用于magento程序。主要请看server这段，其他的要针对自己服务器和用途配置。

user  nobody;
worker_processes  1;
&#160;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
&#160;
#pid        logs/nginx.pid;
&#160;
&#160;
events {
    worker_connections  1024;
}
&#160;
&#160;
http {
        include       mime.types;
        default_type  [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1601.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Magento备忘－通过某一个字段来Load对象</title>
		<link>http://www.wemvc.com/1513.html</link>
		<comments>http://www.wemvc.com/1513.html#comments</comments>
		<pubDate>Wed, 19 Jan 2011 07:50:46 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1513</guid>
		<description><![CDATA[Magento提供了灵活的方式去获取一个对象，比如说Load、比如说Collection，等。。。 我们今天说的是Load函数。
很多人将表的主键值传到Mage_Core_Model_Abstract的load函数中去获取对象，而要通过表里面的某一个字段值来获取呢？
看下Load函数：

    /**
     * Load object data
     *
     * @param   integer $id
     * @return  G_Core_Model_Abstract
     */
    public function load&#40;$id, $field=null&#41;
    &#123;
   [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1513.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Magento随笔-关于SalesRule模块的问题</title>
		<link>http://www.wemvc.com/1507.html</link>
		<comments>http://www.wemvc.com/1507.html#comments</comments>
		<pubDate>Tue, 18 Jan 2011 04:16:39 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1507</guid>
		<description><![CDATA[Magento的购物车促销规则和商品促销规则，看起来确实强大。乍一看强大得让人惊叹，不过只是浮云。为什么？因为你会发现，他无法做很多实际的促销活动。
我就拿我所在的服装行业为例:
第一，只能购物车中单个商品进行促销配置，无法进行组合促销。
我们通常会有“买两条牛仔裤，T恤衫50%折扣”。试问如何用Magento实现？ 注意两条牛仔裤是不同款式的。因为几乎不会有顾客同时买同样一条牛仔库（同尺码、同颜色，即同SKU）。估计这个规则卖卖鸡蛋白菜还差不多。
第二，Best Deal不支持，只能用排序和是否停止匹配下一个规则来设置Rule。
什么意思呢？就是最佳折扣方式，比如有一个A “Buy N of X for Z$off” 和 B “Buy N of X get Y at 50% off”两个促销规则同时存在购物车里，那么A、B的应用顺序不一样，最终金额是不一样的，而不是通过SORT简单的配置A在B前面就可以的。虽然不容易做，但是这是一个促销模块应该考虑到的问题。
第三，如果是可配置商品，那么规则只能匹配可配置商品，不能具体匹配到最终购买的简单商品。
直接看代码吧，代码在SalesRule_Model_Quote_Discount里面。看这里 “Child item discount we calculate for parent”

/**
 * Child item discount we calculate for parent
 */
if &#40;$item-&#38;gt;getParentItemId&#40;&#41;&#41; &#123;
    continue;
&#125;

无法匹配子商品。都是问题。。。不过这个问题可以通过简单修改SalesRule_Model_Rule_Condition_Product来实现。

    /**
     * Validate Product Rule Condition [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1507.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Magento备忘-EAV商品表直接取某一字段值</title>
		<link>http://www.wemvc.com/1504.html</link>
		<comments>http://www.wemvc.com/1504.html#comments</comments>
		<pubDate>Fri, 14 Jan 2011 06:14:24 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1504</guid>
		<description><![CDATA[比通过模型LOAD商品模型后再用getData取值快

G::getResourceModel&#40;'catalog/product'&#41;-&#62;getAttributeRawValue&#40;$entityId, $attribute, $store&#41;

getAttributeRawValue函数参考

    /**
     * Retrieve attribute's raw value from DB.
     *
     * @param int $entityId
     * @param int&#124;string&#124;array $attribute atrribute's ids or codes
     * @param int&#124;G_Core_Model_Store $store
     [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1504.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Magento深入理解－Grid报错clause is ambiguous问题</title>
		<link>http://www.wemvc.com/1489.html</link>
		<comments>http://www.wemvc.com/1489.html#comments</comments>
		<pubDate>Fri, 26 Nov 2010 19:47:50 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1489</guid>
		<description><![CDATA[我记得之前没少讲过Grid，今天在写Grid遇到这样一个错误，将解决办法分享下。

SQLSTATE&#91;23000&#93;: Integrity constraint violation: 1052 Column 'increment_id' in where clause is ambiguous

这个错误怎么来的呢，关键是clause is ambiguous。
使用Grid必须要设置一个Collection，往往这个Grid需要联表查询，就是写join语句。请看下面例子：

    protected function _getCollectionClass&#40;&#41;
    &#123;
        return 'sales/order_shipment_grid_collection';
    &#125;
&#160;
    protected function _prepareCollection&#40;&#41;
    &#123;
        $collection [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1489.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Magento深入理解-原来将数据导出Excel&amp;Csv是如此容易</title>
		<link>http://www.wemvc.com/1478.html</link>
		<comments>http://www.wemvc.com/1478.html#comments</comments>
		<pubDate>Mon, 22 Nov 2010 04:24:43 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1478</guid>
		<description><![CDATA[在领教Magento后台Grid强大之后，今天又发现一个更简便的方法，可以将Grid快速导出到CSV或者Excel.
大家可看这个是后台Mage_Adminhtml_Sales_ShipmentController的一段代码，说到家还是Grid的强大，$grid可以直接调用getCsvFile或getCsvFile。

    /**
     * Export shipment grid to CSV format
     */
    public function exportCsvAction&#40;&#41;
    &#123;
        $fileName   = 'shipments.csv';
        $grid     [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1478.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Gap.cn上线实录</title>
		<link>http://www.wemvc.com/1459.html</link>
		<comments>http://www.wemvc.com/1459.html#comments</comments>
		<pubDate>Sun, 07 Nov 2010 14:19:51 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1459</guid>
		<description><![CDATA[历时4个月；
从“ProjectG-Where dream come true.”到“Night is coming in the past, the day soon come.”，
从毛坯到明亮的办公室，
从迎龙转战到3131，
从设计变成产品，
多少个不眠的日夜，多少张尘埃满面的脸庞。
多少滴泪水、又多少行眼泪、多少次争论、如今一切都变得值得。
“Dream has come true!”！

20:30，兄弟姐妹其上线，Messenger的签名一同改为了“Together”.
21:20，所有服务器监控启动，处于待命状态，像是荷枪实弹的勇士，等待令下。
21:54，老丸子：“这里的黎明静悄悄”。
22:30，检查商品，最后一次全部更新商品数据，确保商品数据准确。
23:45，检查商品上线时间。
2010年11月8日 00:30，更新就绪。
00:40，更新结束，Gap.cn正式对外开放。
00:50，一大群人在测试，订单噼里啪啦的掉下来。。。。
01:10，第一位真正的客人下单成功。
]]></description>
		<wfw:commentRss>http://www.wemvc.com/1459.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Performance is Key! &#8211; Notes on Magento’s Performance</title>
		<link>http://www.wemvc.com/1450.html</link>
		<comments>http://www.wemvc.com/1450.html#comments</comments>
		<pubDate>Sun, 19 Sep 2010 09:03:24 +0000</pubDate>
		<dc:creator>精东</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.wemvc.com/?p=1450</guid>
		<description><![CDATA[原文：http://www.magentocommerce.com/blog/comments/performance-is-key-notes-on-magentos-performance/
Magento&#8217;s performance is key.
在过去的几个月中，我们投入大量资源，诊断和优化Magento的性能。现在Magento 1.0的主要功能已经完成，我们很高兴能分享我们的工作和已实现Magento优化方式、和测试的结果。
当软件有了广泛的特点、功能和灵活性的表现，在性能方面肯定需要优化，Magento也没有例外。下面是一些性能优化的方法，在Magento的最新版本出现几个。

Top menu join queries rewritten, top menu block is cached now on per store view level for every active category
Added catalog indexes for layered navigation and search
Added dynamic merge and whitespace remove during JavaScript load
Footer block is cached
Implemented &#60;remove name=&#8221;"&#62; directive in layout xml to avoid  instantiating of unwanted block [...]]]></description>
		<wfw:commentRss>http://www.wemvc.com/1450.html/feed</wfw:commentRss>
		<slash:comments>146</slash:comments>
		</item>
	</channel>
</rss>

