<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Howto: Repackageable custom extension development in Magento &#8211; Part 5 &#8211; CRUD &#8211; Retrieve</title>
	<atom:link href="http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/feed/" rel="self" type="application/rss+xml" />
	<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/</link>
	<description>WARNING: excessive use of this site will increase MP at the expense of HP</description>
	<lastBuildDate>Thu, 15 Sep 2011 22:33:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Lakshyami</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-1793</link>
		<dc:creator>Lakshyami</dc:creator>
		<pubDate>Wed, 22 Jun 2011 11:28:58 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-1793</guid>
		<description>Hi,
Thank you very much for the great module. This helped me a lot. Can you help me to create more sub menus under Twits tab? I create two sub menus.  Don&#039;t know how to do rest. Actually don&#039;t know how to load different layouts for them. Please help me.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thank you very much for the great module. This helped me a lot. Can you help me to create more sub menus under Twits tab? I create two sub menus.  Don&#8217;t know how to do rest. Actually don&#8217;t know how to load different layouts for them. Please help me.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muzafar Ali</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-1279</link>
		<dc:creator>Muzafar Ali</dc:creator>
		<pubDate>Mon, 14 Jun 2010 11:46:26 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-1279</guid>
		<description>Hi,
thanks for sharing a beautiful article</description>
		<content:encoded><![CDATA[<p>Hi,<br />
thanks for sharing a beautiful article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-1024</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Mon, 04 Jan 2010 17:52:44 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-1024</guid>
		<description>Thnak you!  I was struggling with a grid whos collection had a join which resulted in an ambigous column in the where clause.  While not directly addressing this issue your example used the &quot;filter_index&quot; property which was exactly what I was looking for!</description>
		<content:encoded><![CDATA[<p>Thnak you!  I was struggling with a grid whos collection had a join which resulted in an ambigous column in the where clause.  While not directly addressing this issue your example used the &#8220;filter_index&#8221; property which was exactly what I was looking for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gaweee</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-697</link>
		<dc:creator>gaweee</dc:creator>
		<pubDate>Sun, 02 Aug 2009 05:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-697</guid>
		<description>&lt;strong&gt;Hi 23,&lt;/strong&gt;
what you&#039;re looking for is relatively tricky i assume. Magento&#039;s way of piecing the &lt;code&gt;Sales Orders&lt;/code&gt; and &lt;code&gt;Invoices&lt;/code&gt; together is quite complicated.
I have not dived that deep into the &lt;code&gt;models&lt;/code&gt; manipulation yet so i&#039;m uncertain how to do the advanced grouping/reporting required.
But it should be doable. Where possible you&#039;ll have to learn to work with the &lt;code&gt;model&#039;s collection&lt;/code&gt; and &lt;code&gt;filters&lt;/code&gt;, then go the rest of the way by your own calculations.  =)
For example you can get a &lt;code&gt;collection&lt;/code&gt; of &lt;code&gt;sales invoices&lt;/code&gt;, filter them by date, then add up the totals together. to get your periodic revenue, then go into the items to calculate the periodic cost and finally get the profit.
Sounds easier than it really its. =p</description>
		<content:encoded><![CDATA[<p><strong>Hi 23,</strong><br />
what you&#8217;re looking for is relatively tricky i assume. Magento&#8217;s way of piecing the <code>Sales Orders</code> and <code>Invoices</code> together is quite complicated.<br />
I have not dived that deep into the <code>models</code> manipulation yet so i&#8217;m uncertain how to do the advanced grouping/reporting required.<br />
But it should be doable. Where possible you&#8217;ll have to learn to work with the <code>model's collection</code> and <code>filters</code>, then go the rest of the way by your own calculations.  =)<br />
For example you can get a <code>collection</code> of <code>sales invoices</code>, filter them by date, then add up the totals together. to get your periodic revenue, then go into the items to calculate the periodic cost and finally get the profit.<br />
Sounds easier than it really its. =p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 23</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-693</link>
		<dc:creator>23</dc:creator>
		<pubDate>Fri, 31 Jul 2009 08:37:09 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-693</guid>
		<description>hey gaweee -
thanks for your advices. my problem is that I can not find the depending collection.php or the place where I have to put the code in. I am also not able to find a fitting sql query, which I can manipulate like &quot;SELECT &#039;cost&#039; FROM ...&quot; or how to accumulate the costs over a specific time (i.e. monthly costs / profit) and calculate the periodic profit. 

I expect that I am too dumb to understand the needed framework and programming knowledge.
gaweee - do you have a donate-button somewhere on your page and 10mins time? :)
regards.</description>
		<content:encoded><![CDATA[<p>hey gaweee -<br />
thanks for your advices. my problem is that I can not find the depending collection.php or the place where I have to put the code in. I am also not able to find a fitting sql query, which I can manipulate like &#8220;SELECT &#8216;cost&#8217; FROM &#8230;&#8221; or how to accumulate the costs over a specific time (i.e. monthly costs / profit) and calculate the periodic profit. </p>
<p>I expect that I am too dumb to understand the needed framework and programming knowledge.<br />
gaweee &#8211; do you have a donate-button somewhere on your page and 10mins time? <img src='http://t.wits.sg/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gaweee</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-692</link>
		<dc:creator>gaweee</dc:creator>
		<pubDate>Thu, 30 Jul 2009 18:57:08 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-692</guid>
		<description>&lt;strong&gt;Hey 23,&lt;/strong&gt;
There are some events of a &lt;code&gt;Grid&lt;/code&gt; that gets triggered after loading the &lt;code&gt;Collection&lt;/code&gt; &lt;code&gt;_afterLoad&lt;/code&gt; or something. you can always override those methods and manipulate the &lt;code&gt;Model&lt;/code&gt;&#039;s &lt;code&gt;Collection&lt;/code&gt; into the &lt;code&gt;Grid&lt;/code&gt;&#039;s data. then point the right &lt;code&gt;Index&lt;/code&gt; there. But that&#039;s a really dirty way to do it.

The right way is to use &lt;code&gt;Grid&lt;/code&gt; &lt;code&gt;Filters &lt;/code&gt;and &lt;code&gt;Renderers&lt;/code&gt;. Example:
&lt;pre lang=&quot;php&quot;&gt;
getValue();
		return array(&#039;like&#039;=&gt;&#039;%&#039;.$this-&gt;_escapeValue($value).&#039;%&#039;);
	}
}
&lt;/pre&gt;

As well as
&lt;pre lang=&quot;php&quot;&gt;
getRequest_path();
		$sefurl = Mage::helper(&#039;twit/data&#039;)-&gt;removePrefix($sefurl,  Mage::getStoreConfig(&#039;twit/seo/some_url_prefix&#039;));
		$sefurl = Mage::helper(&#039;twit/data&#039;)-&gt;removeSuffix($sefurl,  Mage::getStoreConfig(&#039;twit/seo/some_url_suffix&#039;));
		
		return $sefurl;
	}
}
&lt;/pre&gt;

Then you can add the column in the &lt;code&gt;Grid &lt;/code&gt;this way:
&lt;pre lang=&quot;php&quot;&gt;
	$this-&gt;addColumn(&#039;request_path&#039;, array(
            &#039;header&#039;        =&gt; Mage::helper(&#039;twit&#039;)-&gt;__(&#039;URL&#039;),
            &#039;align&#039;         =&gt; &#039;left&#039;,
            &#039;width&#039;         =&gt; &#039;150px&#039;,
            &#039;filter_index&#039;  =&gt; &#039;request_path&#039;,
            &#039;index&#039;         =&gt; &#039;request_path&#039;,
            &#039;type&#039;          =&gt; &#039;text&#039;,
            &#039;filter&#039;		=&gt; &#039;twit/some_module_main_grid_filter_url&#039;,
            &#039;renderer&#039;  	=&gt; &#039;twit/some_module_main_grid_renderer_url&#039;,
            &#039;escape&#039;        =&gt; true,
        ));
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p><strong>Hey 23,</strong><br />
There are some events of a <code>Grid</code> that gets triggered after loading the <code>Collection</code> <code>_afterLoad</code> or something. you can always override those methods and manipulate the <code>Model</code>&#8216;s <code>Collection</code> into the <code>Grid</code>&#8216;s data. then point the right <code>Index</code> there. But that&#8217;s a really dirty way to do it.</p>
<p>The right way is to use <code>Grid</code> <code>Filters </code>and <code>Renderers</code>. Example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">getValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'like'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'%'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_escapeValue<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'%'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As well as</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">getRequest_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sefurl</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twit/data'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removePrefix</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sefurl</span><span style="color: #339933;">,</span>  Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twit/seo/some_url_prefix'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sefurl</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twit/data'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removeSuffix</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sefurl</span><span style="color: #339933;">,</span>  Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twit/seo/some_url_suffix'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$sefurl</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then you can add the column in the <code>Grid </code>this way:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'request_path'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'header'</span>        <span style="color: #339933;">=&gt;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'URL'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'align'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'left'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'width'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'150px'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'filter_index'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'request_path'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'index'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'request_path'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'type'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'filter'</span>		<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'twit/some_module_main_grid_filter_url'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'renderer'</span>  	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'twit/some_module_main_grid_renderer_url'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'escape'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: 23</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-686</link>
		<dc:creator>23</dc:creator>
		<pubDate>Tue, 28 Jul 2009 10:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-686</guid>
		<description>Hi - Thanks a lot for your awesome howtos! Nice job!

My question is the following:
I try to expand the sales report by two columns in order to show the cost and calculate the net profit.
The changes in the app/code/local/mage/adminhtml/block/report/sales/sales/grid.php worked well.
I added the following lines:

        $this-&gt;addColumn(&#039;cost&#039;, array(
            &#039;header&#039; =&gt; Mage::helper(&#039;sales&#039;)-&gt;__(&#039;cost&#039;),
            &#039;index&#039; =&gt; &#039;cost&#039;,
            &#039;type&#039; =&gt;&#039;currency&#039;
        ));
        
        $this-&gt;addColumn(&#039;profit&#039;, array(
            &#039;header&#039; =&gt; Mage::helper(&#039;sales&#039;)-&gt;__(&#039;net profit&#039;),
            &#039;index&#039; =&gt; &#039;shipping_description&#039; //shipping_discription for testing purposes ;)
        ));

I would like to know which entries for &#039;index&#039; are available in this report and how to expand the corresponding collection.php to fetch the product relevant costs and calculate the net profit and paste it in a var.

Maybe somebody would help me :(
Kind Regards,
23</description>
		<content:encoded><![CDATA[<p>Hi &#8211; Thanks a lot for your awesome howtos! Nice job!</p>
<p>My question is the following:<br />
I try to expand the sales report by two columns in order to show the cost and calculate the net profit.<br />
The changes in the app/code/local/mage/adminhtml/block/report/sales/sales/grid.php worked well.<br />
I added the following lines:</p>
<p>        $this-&gt;addColumn(&#8216;cost&#8217;, array(<br />
            &#8216;header&#8217; =&gt; Mage::helper(&#8216;sales&#8217;)-&gt;__(&#8216;cost&#8217;),<br />
            &#8216;index&#8217; =&gt; &#8216;cost&#8217;,<br />
            &#8216;type&#8217; =&gt;&#8217;currency&#8217;<br />
        ));</p>
<p>        $this-&gt;addColumn(&#8216;profit&#8217;, array(<br />
            &#8216;header&#8217; =&gt; Mage::helper(&#8216;sales&#8217;)-&gt;__(&#8216;net profit&#8217;),<br />
            &#8216;index&#8217; =&gt; &#8216;shipping_description&#8217; //shipping_discription for testing purposes <img src='http://t.wits.sg/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
        ));</p>
<p>I would like to know which entries for &#8216;index&#8217; are available in this report and how to expand the corresponding collection.php to fetch the product relevant costs and calculate the net profit and paste it in a var.</p>
<p>Maybe somebody would help me <img src='http://t.wits.sg/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
Kind Regards,<br />
23</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tight</title>
		<link>http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento-part-5-crud-retrieve/comment-page-1/#comment-269</link>
		<dc:creator>tight</dc:creator>
		<pubDate>Tue, 21 Apr 2009 14:03:56 +0000</pubDate>
		<guid isPermaLink="false">http://t.wits.sg/?p=173#comment-269</guid>
		<description>I got an error while filtering results.
Removing prefix &quot;dt.&quot; in filter_index&#039;s value of $this-&gt;addColumn solved the problem.</description>
		<content:encoded><![CDATA[<p>I got an error while filtering results.<br />
Removing prefix &#8220;dt.&#8221; in filter_index&#8217;s value of $this-&gt;addColumn solved the problem.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

