<?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>The Magento Expert</title>
	<atom:link href="http://www.the-mage-expert.com/tag/sku/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.the-mage-expert.com</link>
	<description>Your Magento Commerce Expert</description>
	<lastBuildDate>Tue, 24 Jan 2023 09:37:24 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.6</generator>
	<item>
		<title>Sort order items by SKU</title>
		<link>http://www.the-mage-expert.com/1053/magento-sort-order-items-by-sku-order-detail-page/</link>
		<comments>http://www.the-mage-expert.com/1053/magento-sort-order-items-by-sku-order-detail-page/#comments</comments>
		<pubDate>Tue, 19 Apr 2016 10:54:01 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[product]]></category>
		<category><![CDATA[SKU]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=1053</guid>
		<description><![CDATA[If you want to change the default sorting of the ordered items on the order detail page, go ahead and override app/design/adminhtml/default/default/template/sales/order/view/items.phtml in your theme and replace [crayon-69f1df1fe9604/] with [crayon-69f1df1fe9671/] Done. If you open the detail page of an order&#8230;]]></description>
				<content:encoded><![CDATA[<p>If you want to change the default sorting of the ordered items on the order detail page, go ahead and override <strong>app/design/adminhtml/default/default/template/sales/order/view/items.phtml</strong> in your theme and replace</p>
<p></p><pre class="crayon-plain-tag">&lt;?php $_items = $this-&gt;getItemsCollection() ?&gt;
    &lt;?php $i=0;foreach ($_items as $_item):?&gt;
        &lt;?php if ($_item-&gt;getParentItem()) continue; else $i++;?&gt;
        &lt;tbody class=&quot;&lt;?php echo $i%2?'even':'odd' ?&gt;&quot;&gt;
            &lt;?php echo $this-&gt;getItemHtml($_item) ?&gt;
            &lt;?php echo $this-&gt;getItemExtraInfoHtml($_item) ?&gt;
        &lt;/tbody&gt;
    &lt;?php endforeach; ?&gt;</pre><p></p>
<p>with </p>
<p></p><pre class="crayon-plain-tag">&lt;?php $_items = $this-&gt;getItemsCollection() ?&gt;
    &lt;?php $_sortedItems = array(); ?&gt;
    &lt;?php foreach ($_items as $_item) : ?&gt;
        &lt;?php $_sortedItems[$_item-&gt;getSku()] = $_item;?&gt;
    &lt;?php endforeach;?&gt;
    &lt;?php ksort($_sortedItems); // This is where the sorting by SKU takes place ?&gt;
    &lt;?php $i=0;foreach ($_sortedItems as $_item):?&gt;
        &lt;?php if ($_item-&gt;getParentItem()) continue; else $i++;?&gt;
        &lt;tbody class=&quot;&lt;?php echo $i%2?'even':'odd' ?&gt;&quot;&gt;
            &lt;?php echo $this-&gt;getItemHtml($_item) ?&gt;
            &lt;?php echo $this-&gt;getItemExtraInfoHtml($_item) ?&gt;
        &lt;/tbody&gt;
    &lt;?php endforeach; ?&gt;</pre><p></p>
<p>Done. If you open the detail page of an order with 2+ items, they should be sorted by SKU.</p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/1053/magento-sort-order-items-by-sku-order-detail-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
