<?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>mandagreen.com &#187; Magento</title>
	<atom:link href="http://mandagreen.com/category/magento/feed/" rel="self" type="application/rss+xml" />
	<link>http://mandagreen.com</link>
	<description>Refresh your vision</description>
	<lastBuildDate>Sun, 06 May 2012 18:33:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Workaround for attribute store labels not being displayed in Magento</title>
		<link>http://mandagreen.com/workaround-attribute-store-labels-not-displayed-magento/</link>
		<comments>http://mandagreen.com/workaround-attribute-store-labels-not-displayed-magento/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 16:10:45 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=275</guid>
		<description><![CDATA[Here&#8217;s a quick workaround for a rather strange issue &#8211; sometimes, calling $attribute->getStoreLabel() returns null, although everything looks fine in the admin and in the database. It might be something that is slipping my mind, or it might be a bug, not really sure. However, I had to deal with it and come up with [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick workaround for a rather strange issue &#8211; sometimes, calling <code>$attribute->getStoreLabel()</code> returns <code>null</code>, although everything looks fine in the admin and in the database. It might be something that is slipping my mind, or it might be a bug, not really sure. However, I had to deal with it and come up with a fix, so I&#8217;d thought I&#8217;d share.</p>
<pre class="brush: php; title: ; notranslate">
$_aIds = array();
foreach( $prod-&gt;getAttributes() as $attribute ) {
	//need the attribute_id which is missing from the attribute object
	if( !isset($_aIds[$attribute-&gt;getAttributeCode()]) ) {
		$_aIds[$attribute-&gt;getAttributeCode()] = $attribute-&gt;getIdByCode('catalog_product', $attribute-&gt;getAttributeCode());
	}

	//if there's not store_label try to set it
	if( !$attribute-&gt;getStoreLabel() ) {
		$labels = $attribute-&gt;getResource()-&gt;getStoreLabelsByAttributeId( $_aIds[$attribute-&gt;getAttributeCode()] );
		if( array_key_exists(Mage::app()-&gt;getStore()-&gt;getStoreId(), $labels)) {
			$attribute-&gt;setStoreLabel( $labels[Mage::app()-&gt;getStore()-&gt;getStoreId()] );
		}
		else {
			$attribute-&gt;setStoreLabel( $attribute-&gt;getFrontendLabel() );
		}
	}
}
// end workaround
</pre>
<p><em>Applies to Magento 1.5.x</em></p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/workaround-attribute-store-labels-not-displayed-magento/' addthis:title='Workaround for attribute store labels not being displayed in Magento ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/workaround-attribute-store-labels-not-displayed-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Patching the Magento USPS module</title>
		<link>http://mandagreen.com/patching-the-magento-usps-module/</link>
		<comments>http://mandagreen.com/patching-the-magento-usps-module/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 10:30:52 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=253</guid>
		<description><![CDATA[Since their last update on Jan 3rd, 2011 USPS has stopped working on all of my Magento distro&#8217;s. The reason for that is a change in USPS&#8217; response XML values. Magento has its part of blame here, first for not patching it immediately (which again shows how much they care about the CE users) and [...]]]></description>
			<content:encoded><![CDATA[<p>Since their last update on Jan 3rd, 2011 USPS has stopped working on all of my Magento distro&#8217;s. The reason for that is a change in USPS&#8217; response XML values. Magento has its part of blame here, first for not patching it immediately (which again shows how much they care about the CE users) and second for not coding it properly in the first place &#8211; they&#8217;re using the method name (i.e. Express Mail) to see if that method is allowed from the admin, instead of using the CLASSID attribute. </p>
<p>This issue has been reported on magentocommerce.com <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=10631">bug tracking system</a> and it&#8217;s also discussed in the <a href="http://www.magentocommerce.com/boards/viewthread/215963/">forum</a>. USPS makes it clear that they&#8217;ll discontinue all API versions prior RateV4 ad IntlRateV2:<br />
<em>&#8220;All Rate Calculator API integrators are encouraged to migrate to the latest API versions (RateV4, IntlRateV2):<br />
RateV4 and IntlRateV2 will be the only Rate Calculator API versions to offer the full range of new products and functionality<br />
Rate, RateV2, RateV3 and IntlRate will be retired in May 2011, requiring all integrators to migrate to the latest versions&#8221;</em></p>
<p>As explained on the forums, the fix is quite simple, as USPS only added the &amp;lt;sup&amp;gt;&amp;reg;&amp;lt;/sup&amp;gt; which is the encoded (twice <img src='http://mandagreen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) version of the registered sign in a sup tag. Magento values are defined without those so when the code tries to match them it fails. All you have to do is clean that string and you&#8217;re good to go. I don&#8217;t like to modify core files so the fix involves copying <code>app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php</code> to <code>app/code/local/Mage/Usa/Model/Shipping/Carrier/</code> and working on the local version of Usps.php. Strip the special chars:</p>
<pre class="brush: php; title: ; notranslate">
$mailService = str_replace('&amp;reg;', '', strip_tags(htmlspecialchars_decode(htmlspecialchars_decode((string)$postage-&gt;MailService))));
</pre>
<p>and </p>
<pre class="brush: php; title: ; notranslate">
$svcDescription = str_replace('&amp;reg;', '', strip_tags(htmlspecialchars_decode(htmlspecialchars_decode((string)$service-&gt;SvcDescription))));
</pre>
<p>&nbsp;</p>
<p>Here&#8217;s the archive with the patch. Just download it and unzip it in the root of your Magento distribution. <a href="http://mandagreen.com/downloads/usps-fix-mage1420.zip" title="Download - ">Download USPS patch for Magento 1.4.2.0 (8.59 kB)</a></p>
<p>&nbsp;</p>
<p><strong>Note:</strong> This patch applies to Magento CE 1.4.2.0. For all other versions you will have to do it manually as explained above.</p>
<p>&nbsp;</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/patching-the-magento-usps-module/' addthis:title='Patching the Magento USPS module ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/patching-the-magento-usps-module/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Anatomy of a Magento extension</title>
		<link>http://mandagreen.com/anatomy-of-a-magento-extension/</link>
		<comments>http://mandagreen.com/anatomy-of-a-magento-extension/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 12:35:54 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=229</guid>
		<description><![CDATA[Magento Commerce has been on the OSS &#8220;market&#8221; for a while now and I see more and more developers, designers and of course store owners migrating their ecommerce sites to Magento or installing it for their new stores. I&#8217;ve been coding on Magento since its beta 0.6 version, actually my first integration was based on [...]]]></description>
			<content:encoded><![CDATA[<p>Magento Commerce has been on the OSS &#8220;market&#8221; for a while now and I see more and more developers, designers and of course store owners migrating their ecommerce sites to Magento or installing it for their new stores. I&#8217;ve been coding on Magento since its beta 0.6 version, actually my first integration was based on this beta. I&#8217;ve been advised not to use the beta and they were right. However, I had my reasons for recommending it, using it and somehow advocating for that fresh, promising open source piece of software. In the meanwhile, it turned out I was right &#8211; it&#8217;s one of the most complete, scalable &#038; feature-rich free ecommerce solution. Not the easiest to integrate or use, not the smoothest or lightweight, but it&#8217;s come a long way and it still have room for improvements. </p>
<p>One of the things I liked from the start (as a developer) was the ability to extend it in a very simple and loosely coupled way (unlike other solutions). Adding the OOP and design patterns made it perfect for my way of thinking. And I think this is the way to go for any major application, even if it might seem cluttered or with a steep learning curve at a first glance. I remember one of the first problems I faced was module creation &#8211; I was adding all my code in the core/Mage folder, I was overwriting a lot of the core code although I knew it was bad and so on. However, once I understood how to create a module, things became clearer and much simpler. So here&#8217;s a beginner&#8217;s guide to creating a new module. Although it&#8217;s meant for beginners, you should know the basic folder layout (skins, library, js, apps).<br />
<Br /></p>
<p>All Magento code resides in <code>app/code</code> and the <code>lib</code> folder. If you check <code>app/code</code> you&#8217;ll notice three subfolders: <code>community</code>, <code>core</code>, <code>local</code>. You should be adding your stuff in local or community (usually only when it is a community contribution). So let&#8217;s create our first module. I&#8217;ll use the namespace mandagreen and the module will be called HelloWorld. For this I need to create the following folders under <code>app/code/local</code>:<br />
<strong>Mandagreen/HelloWorld</strong></p>
<p>To keep things simple, in this example we&#8217;ll be creating one Block, one Helper and one Model &#8211; no controllers &#038; no Resource Models. Here&#8217;s where each of these will reside:<br />
blocks &#8211; <code>app/code/local/Mandagreen/HelloWorld/Block</code><br />
helpers &#8211; <code>app/code/local/Mandagreen/HelloWorld/Helper</code><br />
models &#8211; <code>app/code/local/Mandagreen/HelloWorld/Model</code></p>
<p>Create these three folders and then also create a new <code>etc</code> folder. The structure will then look like this:</p>
<pre class="brush: plain; title: ; notranslate">
    app/code/local/Mandagreen/HelloWorld/Block
    app/code/local/Mandagreen/HelloWorld/etc
    app/code/local/Mandagreen/HelloWorld/Helper
    app/code/local/Mandagreen/HelloWorld/Model
</pre>
<p>The <code>etc</code> folder holds configuration information &#8211; in this case we&#8217;ll focus only on the module configuration file, which is <code>config.xml</code>. Let&#8217;s create it and start adding some xml into it:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;config&gt;
	&lt;modules&gt;
		&lt;Mandagreen_HelloWorld&gt;
			&lt;version&gt;0.0.1&lt;/version&gt;
		&lt;/Mandagreen_HelloWorld&gt;
	&lt;/modules&gt;

	&lt;global&gt;
		&lt;models&gt;
			&lt;helloworld&gt;
				&lt;class&gt;Mandagreen_HelloWorld_Model&lt;/class&gt;
			&lt;/helloworld&gt;
		&lt;/models&gt;

		&lt;blocks&gt;
			&lt;helloworld&gt;
				&lt;class&gt;Mandagreen_HelloWorld_Block&lt;/class&gt;
			&lt;/helloworld&gt;
		&lt;/blocks&gt;

		&lt;helpers&gt;
			&lt;helloworld&gt;
				&lt;class&gt;Mandagreen_HelloWorld_Helper&lt;/class&gt;
			&lt;/helloworld&gt;
		&lt;/helpers&gt;
	&lt;/global&gt;

	&lt;frontend&gt;
		&lt;layout&gt;
			&lt;updates&gt;
				&lt;helloworld&gt;
					&lt;file&gt;mg_helloworld.xml&lt;/file&gt;
				&lt;/helloworld&gt;
			&lt;/updates&gt;
		&lt;/layout&gt;

		&lt;translate&gt;
			&lt;modules&gt;
				&lt;Mandagreen_HelloWorld&gt;
					&lt;files&gt;
						&lt;default&gt;Mandagreen_HelloWorld.csv&lt;/default&gt;
					&lt;/files&gt;
				&lt;/Mandagreen_HelloWorld&gt;
			&lt;/modules&gt;
		&lt;/translate&gt;
	&lt;/frontend&gt;
&lt;/config&gt;
</pre>
<p>That&#8217;s a lot, isn&#8217;t it? <img src='http://mandagreen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  No worries, I&#8217;ll explain. Under the main node (<code>config</code>), youll usually need the global node. The <code>modules</code> node is being used to hold mode info about the current module, maybe dependencies and so on. The <code>frontend</code> node is usually used for defining layout handlers and translation files, but they can do more than that. In this example, we&#8217;re gonna have our own layout file called mg_helloworld.xml &#8211; you can use any name on it (as long as it&#8217;s unique), but I prefer to namespace it as well. Also, I&#8217;ve defined a translation file <code>Mandagreen_HelloWorld.csv</code> which needs to be created in <code>app/locale/en_US</code> (or whatever your default locale is). </p>
<p>The <code>global</code> node defines all the classes you&#8217;ll be using, in this case helpers, models and blocks. You can see that they are defined the same way, but in different locations: &lt;helpers /&gt;, &lt;models /&gt; and &lt;blocks /&gt;. Let&#8217;s use the helpers node as an example.</p>
<pre class="brush: xml; title: ; notranslate">
		&lt;helpers&gt;
			&lt;helloworld&gt;
				&lt;class&gt;Mandagreen_HelloWorld_Helper&lt;/class&gt;
			&lt;/helloworld&gt;
		&lt;/helpers&gt;
</pre>
<p>The <code>helloworld</code> node defines a handle and you should be careful to always use unique names. If you&#8217;re not sure if a certain name exist, namespace it (mghelloworld for example). This handle will be used to instantiate models, call helpers or use blocks using the Magento factory. For example, for models, you&#8217;ll be using <code>Mage::getModel('helloworld/modelname');</code> instead of <code>new Mandagreen_HelloWorld_Model_Modelname();</code>. Same with helpers, inside a block template &#8211; <code>$this->helper('helloworld')->someMethod();</code>.<br />
The other node, <code>class</code> is being used to define the namespace of the class name. In the example above, the name of the Modelname class has to being with <code>Mandagreen_HelloWorld_Helper</code>. A few examples might help:</p>
<ul>
<li><code>Mandagreen_HelloWorld_Model_Salute</code>, will be found in <code>Mandagreen/HelloWorld/Model/Salute.php</code> and can be accessed via <code>Mage::getModel('helloworld/salute')</code></li>
<li><code>Mandagreen_HelloWorld_Model_Salute_Hi</code>, will be found in <code>Mandagreen/HelloWorld/Model/Salute/Hi.php</code> and can be accessed via <code>Mage::getModel('helloworld/salute_hi')</code></li>
<li><code>Mandagreen_HelloWorld_Helper_Help</code>, will be found in <code>Mandagreen/HelloWorld/Model/Help.php</code> and can be accessed via <code>Mage::helper('helloworld/help')</code></li>
</ul>
<p>Now that we explained the config file, let&#8217;s move on to actually creating the <strong>classes </strong>and code. I&#8217;ll use the example above and create the following files:</p>
<p><strong>Mandagreen/HelloWorld/Block/Standard.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class Mandagreen_HelloWorld_Block_Standard extends Mage_Core_Block_Template {
    function getSomething() {
          return Mage::getModel('helloworld/salute')-&gt;getName();
    }
}
</pre>
<p><strong>Mandagreen/HelloWorld/Helper/Help.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class Mandagreen_HelloWorld_Helper_Help extends Mage_Core_Helper_Abstract {
    function shouldSayHi() {
          return true;
    }
}
</pre>
<p><strong>Mandagreen/HelloWorld/Model/Salute.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class Mandagreen_HelloWorld_Model_Salute extends Mage_Core_Model_Abstract { //or Varien_Object or none
    function getName() {
          //do some heavy logic here
          return 'John';
    }
}
</pre>
<p>One more file is required for the translations to work with this module &#8211; a &#8220;default&#8221; Data helper, defined in <strong>Mandagreen/HelloWorld/Helper/Data.php</strong> like this:</p>
<pre class="brush: php; title: ; notranslate">
class Mandagreen_HelloWorld_Helper_Data extends Mage_Core_Helper_Abstract {}
</pre>
<p>We have the classes but we also need to use them in a template, so let&#8217;s create <code>standard.phtml</code> in <code>app/design/frontend/default/default/template/helloworld</code> (create all additional folders if needed). Also, create <code>mg_helloworld.xml</code> under <code>app/design/frontend/default/default/layout</code>.</p>
<p>For the template, things are very easy:</p>
<pre class="brush: php; title: ; notranslate">
&lt;div style=&quot;background: red; padding: 20px;&quot;&gt;
	&lt;?php if( $this-&gt;helper('helloworld/help')-&gt;shouldSayHi() ): ?&gt;
	Hello &lt;?php echo $this-&gt;getSomething(); ?&gt;
	&lt;?php else: ?&gt;
	Can't say anything...
	&lt;?php endif; ?&gt;
&lt;/div&gt;
</pre>
<p>while for the layout we&#8217;ll use this approach:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;layout version=&quot;0.1.0&quot;&gt;
    &lt;default&gt;
        &lt;reference name=&quot;content&quot;&gt;
            &lt;block type=&quot;helloworld/standard&quot; name=&quot;helloworld&quot; template=&quot;helloworld/standard.phtml&quot; after=&quot;-&quot; /&gt;
        &lt;/reference&gt;
    &lt;/default&gt;
&lt;/layout&gt;
</pre>
<p>This should display &#8220;Hello John&#8221; at the end of the content area on most of the pages, including the homepage. But wait, before you try that you&#8217;ll have to enable the module in <code>app/etc/modules</code>. Create a file called <code>Mandagreen_HelloWorld.xml</code> with the following code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;config&gt;
    &lt;modules&gt;
        &lt;Mandagreen_HelloWorld&gt;
            &lt;active&gt;true&lt;/active&gt;
            &lt;codePool&gt;local&lt;/codePool&gt;
        &lt;/Mandagreen_HelloWorld&gt;
    &lt;/modules&gt;
&lt;/config&gt;
</pre>
<p>Clear all magento cache and refresh the page &#8211; your first module, up and running! And here&#8217;s the archive for this tutorial &#8211; <a href="http://mandagreen.com/downloads/helloworld.zip" title="Download - ">Download Hello World Magento Module (2.99 kB)</a></p>
<p>Further/recommended reads:</p>
<ul>
<li><a href="http://www.php.net/manual/en/language.namespaces.rationale.php">Namespaces Rationale</a></li>
<li><a href="http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table">Custom Module with Custom Database Table</a></li>
<li><a href="http://unirgy.com/wiki/uscaffold">uScaffold extension by Unirgy</a></li>
</ul>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/anatomy-of-a-magento-extension/' addthis:title='Anatomy of a Magento extension ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/anatomy-of-a-magento-extension/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding Customer Comments as Order Status Comments using Magento &amp; OneStepCheckout</title>
		<link>http://mandagreen.com/customer-comments-as-order-status-comments-magento-onestepcheckout/</link>
		<comments>http://mandagreen.com/customer-comments-as-order-status-comments-magento-onestepcheckout/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 10:08:13 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[onestepcheckout]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=218</guid>
		<description><![CDATA[A few days ago I got an email from someone asking me about adding the default customer comments in OneStepCheckout (<a href="http://www.onestepcheckout.com/">www.onestepcheckout.com</a>) as regular order comments. I thought I'd share this quick &#038; simple hack with everyone, so here's what you have to d]]></description>
			<content:encoded><![CDATA[<p>A few days ago I got an email from someone asking me about adding the default customer comments in OneStepCheckout (<a href="http://www.onestepcheckout.com/">www.onestepcheckout.com</a>) as regular order comments. I thought I&#8217;d share this quick &#038; simple hack with everyone, so here&#8217;s what you have to do:<br />
Open app/code/local/Idev/OneStepCheckout/Helper/Data.php, and after </p>
<pre class="brush: php; title: ; notranslate">$observer-&gt;getEvent()-&gt;getOrder()-&gt;setOnestepcheckoutCustomercomment($orderComment);</pre>
<p>add this line:<br />
<del>$observer->getEvent()->getOrder()->setState( Mage_Sales_Model_Order::STATE_NEW, true, $orderComment, false );</del></p>
<pre class="brush: php; title: ; notranslate">$observer-&gt;getEvent()-&gt;getOrder()-&gt;setState(
    $observer-&gt;getEvent()-&gt;getOrder()-&gt;getStatus(),
    true,
    $orderComment,
    false
);</pre>
<p>This will add the comments on the regular comments/statuses thread, as well as a customer comment. If you want to disable customer comments, just comment the original code. </p>
<p>Actually, this approach should also work with the out-of-the-box Magento one step checkout. Add an input on the last step, create a listener for
<pre class="brush: plain; title: ; notranslate">checkout_type_onepage_save_order</pre>
<p> and use the same piece of code:</p>
<pre class="brush: php; title: ; notranslate">$observer-&gt;getEvent()-&gt;getOrder()-&gt;setState( $observer-&gt;getEvent()-&gt;getOrder()-&gt;getStatus(), true, $this-&gt;_getRequest()-&gt;getPost('order_comments'), false );</pre>
<p><ins><strong>Note: </strong>Tested on Magento 1.4.1.0 &#038; 1.4.1.1</ins></p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/customer-comments-as-order-status-comments-magento-onestepcheckout/' addthis:title='Adding Customer Comments as Order Status Comments using Magento &amp; OneStepCheckout ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/customer-comments-as-order-status-comments-magento-onestepcheckout/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Introducing Magento CSS &amp; JS Minifier</title>
		<link>http://mandagreen.com/introducing-magento-css-js-minifier/</link>
		<comments>http://mandagreen.com/introducing-magento-css-js-minifier/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 11:24:28 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=196</guid>
		<description><![CDATA[As the title says, I&#8217;m glad to announce my first public Magento extension (not yet added in the Connect repository). During my 3 years experience with Magento, I&#8217;ve worked on a lot of custom extensions, improvements &#38; fixes, but most of them were client-specific, plus they weren&#8217;t designed to have a backend interface (with a [...]]]></description>
			<content:encoded><![CDATA[<p>As the title says, I&#8217;m glad to announce my first public Magento extension (not yet added in the Connect repository). During my 3 years experience with Magento, I&#8217;ve worked on a lot of custom extensions, improvements &amp; fixes, but most of them were client-specific, plus they weren&#8217;t designed to have a backend interface (with a few exceptions). This one, however, is entirely configurable from the Admin and it&#8217;s both simple and effective.</p>
<p>&nbsp;</p>
<h2>What it does</h2>
<p>This quick optimizer parses all javascript &amp; css files included on a page and removes all unnecessary characters. The most simple step is to remove spaces, tabs and new lines &#8211; but there&#8217;s more than just that. Of course, for small files compression is insignificant, but when you work with almost 600KB and around 30 requests, you can save a lot. Here&#8217;s a quick math on one of my Magento installs:<br />
<a class="thickbox" href="http://mandagreen.com/download/minifier.png"><img class="alignright size-thumbnail wp-image-199" style="border: 1px solid #d0d0d0; margin-top: 5px;" title="minifier" src="http://mandagreen.com/download/minifier-150x150.png" alt="" width="150" height="150" /></a></p>
<p><strong>Javascript</strong> &#8211; 26 requests, 479 KB<br />
<strong>CSS</strong> &#8211; 4 requests, 102 KB</p>
<p><strong>With Magento&#8217;s default merging enabled:</strong><br />
<strong>Javascript</strong> &#8211; 1 request, 360 KB (not sure why this is smaller then the 26 summed up, but nvm)<br />
<strong>CSS</strong> &#8211; 1 request, 108.2 KB (same for this one too, but again, nvm)</p>
<p>We&#8217;ve already saved 28 requests, which means less overhead &#8211; quicker download times for user, less stress on the server.</p>
<p><strong>With the Minifier enabled:</strong><br />
<strong>Javascript</strong> is 255 KB, which means almost 47% compression<br />
<strong>CSS</strong> is 92 KB, which means almost 10% compression</p>
<p>&nbsp;</p>
<h2>Advantages</h2>
<ul>
<li>Faster loading times</li>
<li>Less stress on the server and on bandwith</li>
<li>Improving <a href="http://code.google.com/speed/page-speed/" target="_blank">PageSpeed</a> score with 4-8 points</li>
<li>Checking 4 to-do&#8217;s from the <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html" target="_blank">Web Performance Best Practices Guide</a></li>
</ul>
<p>&nbsp;</p>
<h2>Disatvantages</h2>
<ul>
<li>Need to write javascripts very careful, adding a semicolon after almost everything</li>
<li>Have to rewrite of Mage_Core_Model file</li>
<li>Have to override two Magento methods</li>
<li>Additional processing time (insignificant in my opinion)</li>
</ul>
<p>&nbsp;</p>
<h2>Credits</h2>
<p>This plugin wouldn&#8217;t exist if it weren&#8217;t for these two outstanding PHP projects:<br />
Joe Scylla&#8217;s <a href="http://code.google.com/p/cssmin/" target="_blank">CssMin</a><br />
Ryan Grove&#8217;s <a href="http://wonko.com/post/a_faster_jsmin_library_for_php" target="_blank">JsMin</a><br />
Big thanks to both of them.</p>
<p>&nbsp;</p>
<h2>Download &amp; Install</h2>
<p><a class="thickbox" href="http://mandagreen.com/download/minifier-screenshot.png"><img class="alignright size-thumbnail wp-image-206" style="border: 1px solid #d0d0d0; margin-top: 5px;" title="minifier-screenshot" src="http://mandagreen.com/download/minifier-screenshot-150x150.png" alt="" width="150" height="150" /></a><br />
First, <a href="http://mandagreen.com/downloads/oxygen_minifier.zip" title="Download - Magento Minifier takes the merged javascript and css files and minifies them, removing white spaces, new lines and other chars, resulting in a smaller file. Compression is usually around 20% for javascripts and 15-25% for css.">Download Minifier for Magento (10.54 kB)</a>, then unzip it and copy the app/ folder to your Magento root folder.</p>
<p>Logout from the admin if you&#8217;re already logged in, then login. Go to Cache Management, click on the &#8220;Fulsh cache storage&#8221; button, then go to Configuration &gt; Developer and enable all the options, as shown in the attached screenshot. Go back to Cache Management and this time click on the &#8220;Flush Javascript/CSS cache&#8221;.</p>
<p>Go to your store frontend and behold, you&#8217;re now using compressed js&#8217;s and css&#8217;s.</p>
<p>Works on Magento 1.4+</p>
<p style="clear: both;">
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/introducing-magento-css-js-minifier/' addthis:title='Introducing Magento CSS &amp; JS Minifier ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/introducing-magento-css-js-minifier/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to export customers from orders between certain dates in Magento</title>
		<link>http://mandagreen.com/how-to-export-customers-from-orders-between-certain-dates-in-magento/</link>
		<comments>http://mandagreen.com/how-to-export-customers-from-orders-between-certain-dates-in-magento/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:54:28 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=189</guid>
		<description><![CDATA[Last week a client who runs his store on Magento Commerce asked me how he could export a list of customers who purchased between certain dates in August. Of course, I first went to the Administration area and tried several approaches (order reports, customer reports, data export). Unfortunately nothing worked, so I had to write [...]]]></description>
			<content:encoded><![CDATA[<p>Last week a client who runs his store on Magento Commerce asked me how he could export a list of customers who purchased between certain dates in August. Of course, I first went to the Administration area and tried several approaches (order reports, customer reports, data export). Unfortunately nothing worked, so I had to write a script or a plain SQL and run it from the CLI. I preferred a straight query, rather than a script, and I tried not to use sub-selects. Here&#8217;s the adapted part, where I&#8217;ve added some variables to keep all the attribute id&#8217;s:</p>
<pre class="brush: sql; title: ; notranslate">
SET @etID := (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'order_address');
SET @atFn := (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = @etID);
SET @atLn := (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'lastname' AND entity_type_id = @etID);
SET @atEmail := (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'customer_email');

SET @startDate := '2010-08-06 00:00:00';
SET @endDate := '2010-08-13 23:59:59';

SELECT o.increment_id, e.value as email, ln.value as lastname, fn.value as firstname
FROM sales_order o
INNER JOIN sales_order_varchar e ON e.entity_id = o.entity_id AND attribute_id = @atEmail
INNER JOIN sales_order_entity lne ON lne.parent_id = o.entity_id AND lne.entity_type_id = @etID
INNER JOIN sales_order_entity_varchar ln ON ln.entity_id = lne.entity_id AND ln.attribute_id = @atLn
INNER JOIN sales_order_entity_varchar fn ON fn.entity_id = lne.entity_id AND fn.attribute_id = @atFn
WHERE o.created_at BETWEEN @startDate AND @endDate
GROUP BY o.increment_id
ORDER BY o.increment_id DESC;
</pre>
<p>The only problem is when the Shipping Name is different than the Billing Name &#8211; there&#8217;s no control over that, as we&#8217;re grouping by increment_id. This could easily be fixed in a PHP script, but the approach there should be different (using collections). </p>
<p>Hope this helps anyone, as it did the trick for me.</p>
<p><em>Solution tested under Magento 1.4.0.1</em></p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/how-to-export-customers-from-orders-between-certain-dates-in-magento/' addthis:title='How to export customers from orders between certain dates in Magento ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/how-to-export-customers-from-orders-between-certain-dates-in-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;Catalog Price Rules&#8221; cart issue in Magento 1.4.1.0</title>
		<link>http://mandagreen.com/fixing-catalog-price-rules-cart-issue-in-magento-1-4-1-0/</link>
		<comments>http://mandagreen.com/fixing-catalog-price-rules-cart-issue-in-magento-1-4-1-0/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 10:28:00 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=185</guid>
		<description><![CDATA[After recently upgrading one of my stores running Magento Commerce I found out the the latest version (at this time 1.4.1.0) had a major bug. Don&#8217;t want to sound too harsh, but unfortunately Magento&#8217;s support was again awful &#8211; there have been one thread on the forum and one issue in their bug tracking system [...]]]></description>
			<content:encoded><![CDATA[<p>After recently upgrading one of my stores running Magento Commerce I found out the the latest version (at this time 1.4.1.0) had a major bug. Don&#8217;t want to sound too harsh, but unfortunately Magento&#8217;s support was again awful &#8211; there have been one <a href="http://www.magentocommerce.com/boards/viewthread/173429/">thread on the forum</a> and one <a href="http://www.magentocommerce.com/bug-tracking/issue/?issue=9382">issue in their bug tracking system</a> for a while now (almost two weeks if not more) and still no update, although as I said the bug has quite an impact &#8211; even tweet&#8217;ed the problem to <a href="http://twitter.com/magento">@magento</a> and haven&#8217;t gotten any reply (again it&#8217;s not the first time). Yes, the product is free, yes it&#8217;s open source, but I think a bit of transparency and better communication could come to their advantage.</p>
<h2>Bug details/behavior</h2>
<p>So, updated from 1.4.0.1 to 1.4.1.0, everything looks fine, catalog price rules are being applied in the catalog (categories and product pages), but when adding the product to the cart the quote item price was the regular price not the special one. </p>
<h2>Solution/Fix</h2>
<p>After a few hours playing with the rules, observer and other core elements I found the problem. A big &#8220;thank you&#8221; goes to &#8220;myself&#8221; who posted the second comment for the issue mentioned above. The problem was within the CatalogRule Observer, when fetching the ID of the Customer Group. Here&#8217;s how to fix it:</p>
<p>1 &#8211; create the following folders in your Magento distro: <code>app/code/local/Mage/CatalogRule/Model</code><br />
2 &#8211; copy <code>app/code/core/Mage/CatalogRule/Model/Observer.php</code> to <code>app/code/local/Mage/CatalogRule/Model</code><br />
3 &#8211; open the new/copied file and go to line 105. Change this code:</p>
<pre class="brush: php; title: ; notranslate">
        if ($observer-&gt;hasCustomerGroupId()) {
            $gId = $observer-&gt;getEvent()-&gt;getCustomerGroupId();
        } elseif ($product-&gt;hasCustomerGroupId()) {
            $gId = $product-&gt;hasCustomerGroupId();
        } else {
            $gId = Mage::getSingleton('customer/session')-&gt;getCustomerGroupId();
        }
</pre>
<p>to:</p>
<pre class="brush: php; title: ; notranslate">
        if ($observer-&gt;hasCustomerGroupId()) {
            $gId = $observer-&gt;getEvent()-&gt;getCustomerGroupId();
        } elseif ($product-&gt;hasCustomerGroupId()) {
            $gId = $product-&gt;getCustomerGroupId();
        } else {
            $gId = Mage::getSingleton('customer/session')-&gt;getCustomerGroupId();
        }
</pre>
<p>To be more precise, you have to change hasCustomerGroupId to getCustomerGroupId on line 105.</p>
<p>You can now enjoy your store again!</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/fixing-catalog-price-rules-cart-issue-in-magento-1-4-1-0/' addthis:title='Fixing &#8220;Catalog Price Rules&#8221; cart issue in Magento 1.4.1.0 ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/fixing-catalog-price-rules-cart-issue-in-magento-1-4-1-0/feed/</wfw:commentRss>
		<slash:comments>88</slash:comments>
		</item>
		<item>
		<title>Adding Customer Comments on Invoice PDFs in Magento (using OneStepCheckout)</title>
		<link>http://mandagreen.com/adding-customer-comments-invoice-pdf-magento/</link>
		<comments>http://mandagreen.com/adding-customer-comments-invoice-pdf-magento/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 15:35:54 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[onestepcheckout]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=123</guid>
		<description><![CDATA[I&#8217;ve recently installed OneStepCheckout (http://www.onestepcheckout.com/) on a couple of Magento installations. The extension is very nice, really simple to integrate and I expect to see better conversion rates on the checkout process. One cool thing is that it comes with the option of activating Customer Order Comments &#8211; it adds a textarea field on the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently installed OneStepCheckout (<a href="http://www.onestepcheckout.com/">http://www.onestepcheckout.com/</a>) on a couple of  Magento installations. The extension is very nice, really simple to integrate and I expect to see better conversion rates on the checkout process. </p>
<p>One cool thing is that it comes with the option of activating Customer Order Comments &#8211; it adds a textarea field on the checkout page, and a box with the customer comments in the admin, when viewing the order.</p>
<p>However, one of my clients requested I added these comments in the invoice PDF&#8217;s. So, here&#8217;s how to do it:</p>
<p><strong>Step 1</strong><br />
Copy <code>app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php</code> to <code>app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php</code></p>
<p><strong>Step 2</strong><br />
Open the new file and create a new method:</p>
<pre class="brush: php; title: ; notranslate">
	function insertOscComments(&amp;$page, $order) {
		if( !$order-&gt;getOnestepcheckoutCustomercomment() ) { return; }
		$this-&gt;y -= 20;
		$page-&gt;setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
		$page-&gt;setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
		$page-&gt;setLineWidth(0.5);
		$page-&gt;drawRectangle(25, $this-&gt;y, 570, $this-&gt;y - 20);
		$page-&gt;setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 1));
		$page-&gt;drawRectangle(25, $this-&gt;y - 20, 570, $this-&gt;y - 40);

		$page-&gt;setFillColor(new Zend_Pdf_Color_RGB(0.1, 0.1, 0.1));
		$page-&gt;drawText(Mage::helper('onestepcheckout')-&gt;__('Customer Comments'), 35, $this-&gt;y - 13, 'UTF-8');
		$page-&gt;drawText($order-&gt;getOnestepcheckoutCustomercomment(), 33, $this-&gt;y - 33, 'UTF-8');
		$this-&gt;y -= 50;
	}
</pre>
<p><strong>Step 3</strong><br />
At the end of method <code>getPdf</code> add a call to the new method you created:</p>
<pre class="brush: php; title: ; notranslate">
  /* Add totals */
  $this-&gt;insertTotals($page, $invoice);

  /* Add OneStepCheckout Customer Comments */
  $this-&gt;insertOscComments($page, $order);
}
</pre>
<p>And that&#8217;s all you need.</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/adding-customer-comments-invoice-pdf-magento/' addthis:title='Adding Customer Comments on Invoice PDFs in Magento (using OneStepCheckout) ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/adding-customer-comments-invoice-pdf-magento/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Showing all reviews and ratings on a page in Magento</title>
		<link>http://mandagreen.com/showing-all-reviews-and-ratings-on-a-page-in-magento/</link>
		<comments>http://mandagreen.com/showing-all-reviews-and-ratings-on-a-page-in-magento/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 17:46:02 +0000</pubDate>
		<dc:creator>Cristi</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mandagreen.com/?p=80</guid>
		<description><![CDATA[Finally, a new post, and at last it is about Mangeto Commerce (http://www.magentocommerce.com/). In my first Magento how-to you&#8217;ll learn how to retrieve all product reviews and show them on a single page, together with the average rating. For this, I assume you have already created a new module and are able to view the [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, a new post, and at last it is about Mangeto Commerce (<a href="http://www.magentocommerce.com/">http://www.magentocommerce.com/</a>). In my first Magento how-to you&#8217;ll learn how to retrieve all product reviews and show them on a single page, together with the average rating. For this, I assume you have already created a new module and are able to view the page. You&#8217;ll only need to manipulate a block and a template.</p>
<p>First, let&#8217;s retrieve the reviews collection (this method will go into the block):</p>
<pre class="brush: php; title: ; notranslate">
	function getReviews() {
		$reviews = Mage::getModel('review/review')-&gt;getResourceCollection();
		$reviews-&gt;addStoreFilter( Mage::app()-&gt;getStore()-&gt;getId() )
						-&gt;addStatusFilter( Mage_Review_Model_Review::STATUS_APPROVED )
						-&gt;setDateOrder()
						-&gt;addRateVotes()
						-&gt;load();        

		return $reviews;
	}
</pre>
<p>We&#8217;re using <code>Mage_Review_Model_Mysql4_Review_Collection</code>, which is a resource model. First setup the collection, filtering by store &#8211; we only want to retrieve the product reviews in the current store  -, by status &#8211; show only approved reviews -, and ordering by date in reverse order, then load the collection. </p>
<p><code>addRateVotes()</code> helps loading all the ratings/votes for that review. We&#8217;re gonna use this collection to compute the average rating. </p>
<p>Next, let&#8217;s move on to the template for a second. We&#8217;re gonna call the <code>getReviews()</code> method, then iterate through all the reviews. For each review you would probably want to display the title, nickname, date and details, but also the product associated and the user rating. For the first four, things are pretty easy, all you have to do is call <code>getTitle(), getNickname(), getDetail(), getCreatedAt()</code> on each review object. </p>
<p>To display the product name &amp; link, we need to retrieve the product associated with each review &#8211; unfortunately I wasn&#8217;t able to find a way to join the product tables inside the query for retrieving all the reviews. So, we need to create a helper method inside our block, called <code>getProduct()</code>. We&#8217;re gonna use a storage/registry variable called <code>_loadedProducts</code>, so that we avoid loading the same product multiple times. </p>
<pre class="brush: php; title: ; notranslate">
	function getProduct( Mage_Review_Model_Review $review ) {
		if( !isset($this-&gt;_loadedProducts[ $review-&gt;getEntityPkValue() ]) ) {
			$this-&gt;_loadedProducts[$review-&gt;getEntityPkValue()] = Mage::getModel('catalog/product')-&gt;load( $review-&gt;getEntityPkValue() );
		}

		return $this-&gt;_loadedProducts[ $review-&gt;getEntityPkValue() ];
	}
</pre>
<p>And inside the template:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $_prod = $this-&gt;getProduct( $review ); ?&gt;
&lt;a href=&quot;&lt;?php echo $_prod-&gt;getProductUrl(); ?&gt;&quot;&gt;&lt;?php echo $_prod-&gt;getName(); ?&gt;&lt;/a&gt;
</pre>
<p>One last thing, if you intend to display the average rating of each review, add another helper method inside the block:</p>
<pre class="brush: php; title: ; notranslate">
	function getAverageRating( Mage_Review_Model_Review $review ) {
		$avg = 0;
		if( count($review-&gt;getRatingVotes()) ) {
			$ratings = array();
			foreach( $review-&gt;getRatingVotes() as $rating ) {
				$ratings[] = $rating-&gt;getPercent();
			}
			$avg = array_sum($ratings)/count($ratings);
		}

		return $avg;
	}
</pre>
<p>And then call it in the template (in this example we&#8217;re using Magento&#8217;s default styling):</p>
<pre class="brush: php; title: ; notranslate">
&lt;div class=&quot;rating-box&quot;&gt;
	&lt;div class=&quot;rating&quot; style=&quot;width: &lt;?php echo ceil($this-&gt;getAverageRating( $review )); ?&gt;%;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>That is all! You now have a page where all product reviews can be display.<br />
<strong>Things to consider: </strong> pagination and cache!</p>
<p><strong>Update:</strong> Seems that Magento comes prepared for reviews on products, categories and customers. We only need to load product reviews, so it would be wise to filter by entity. Unfortunately, the current version of Magento doesn&#8217;t allow filtering for a certain entity, only by entity and entity PK (which is the product ID in this case). Of course, we could write a decorator and write a method to just add a filter for <code>entity_code = 'product'</code>, but the quickest (and dirtiest) way of doing it is by adding a check inside the template foreach loop (or adding a helper method in the block): </p>
<pre class="brush: php; title: ; notranslate">

if( $review-&gt;getEntityId() == 1 ) { continue; }
//1 is the id of the 'product' entity - if you write a method, use a class constant
</pre>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://mandagreen.com/showing-all-reviews-and-ratings-on-a-page-in-magento/' addthis:title='Showing all reviews and ratings on a page in Magento ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://mandagreen.com/showing-all-reviews-and-ratings-on-a-page-in-magento/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>

