<?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>tgreenaway.com &#187; magento</title>
	<atom:link href="http://tgreenaway.com/tag/magento/feed/" rel="self" type="application/rss+xml" />
	<link>http://tgreenaway.com</link>
	<description>Creatively engineered.</description>
	<lastBuildDate>Sat, 30 May 2009 06:06:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>If You&#8217;re Not Testing Something Then Don&#8217;t Make It Default</title>
		<link>http://tgreenaway.com/2009/01/if-youre-not-testing-something-then-dont-make-it-default/</link>
		<comments>http://tgreenaway.com/2009/01/if-youre-not-testing-something-then-dont-make-it-default/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 06:44:27 +0000</pubDate>
		<dc:creator>TCMG</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://tgreenaway.com/?p=236</guid>
		<description><![CDATA[After debugging an Ajax Internet Explorer issue for about 3 hours today at work wherein what should&#8217;ve been some simple JSON data being returned by a jQuery $.post call the server instead returned the website&#8217;s main splash page.
I eventually discovered the problem was also clearing the user&#8217;s checkout basket. Upon realising that I discovered the [...]]]></description>
			<content:encoded><![CDATA[<p>After debugging an Ajax Internet Explorer issue for about 3 hours today at work wherein what should&#8217;ve been some simple JSON data being returned by a jQuery $.post call the server instead returned the website&#8217;s main splash page.</p>
<p>I eventually discovered the problem was also clearing the user&#8217;s checkout basket. Upon <em>realising that</em> I discovered the user&#8217;s session was dematerialising on the server-side as well.</p>
<p>A few google&#8217;s later I found this post on the Magento forum (finally their forum is useful):</p>
<p><a href="http://www.magentocommerce.com/boards/viewthread/27475/">http://www.magentocommerce.com/boards/viewthread/27475/</a></p>
<p>So basically there are options in Magento&#8217;s admin backend that cause disruptions in IE for sessions and result in user&#8217;s losing their entire session.</p>
<p>In my case it was disrupting Ajax calls <em>all the time</em>. Why have the Magento developers made a buggy set of options the default for the admin panel when the bug affects the most common browser in existence?</p>
<p>Those options do sound great in terms of security but until they&#8217;re stable and tested they shouldn&#8217;t be made the default.</p>
]]></content:encoded>
			<wfw:commentRss>http://tgreenaway.com/2009/01/if-youre-not-testing-something-then-dont-make-it-default/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Magento: Listing regions from a country code</title>
		<link>http://tgreenaway.com/2009/01/magento-listing-regions-from-a-country-code/</link>
		<comments>http://tgreenaway.com/2009/01/magento-listing-regions-from-a-country-code/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 02:36:51 +0000</pubDate>
		<dc:creator>TCMG</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://tgreenaway.com/?p=212</guid>
		<description><![CDATA[Once and a while you may want to get a collection of the regions that are associated with a country in Magento. For example, the United States is of course a collection of&#8230; states. In Magento these are referred to as regions (Japan&#8217;s prefectures would hence be referred to as regions as well.)
So for a [...]]]></description>
			<content:encoded><![CDATA[<p>Once and a while you may want to get a collection of the regions that are associated with a country in Magento. For example, the United States is of course a collection of&#8230; states. In Magento these are referred to as regions (Japan&#8217;s prefectures would hence be referred to as regions as well.)</p>
<p>So for a given country (and that country&#8217;s ID or country code) you might want to find all the regions in that country. Which are usually used to populate a dropdown menu on the address selection pages or shipping tax pages.</p>
<pre class="brush: php;">

$collection = Mage::getModel('directory/region')-&gt;getResourceCollection()
-&gt;addCountryFilter($this-&gt;getCountryId())
-&gt;load();
</pre>
<p>It&#8217;s great when ORM works for a developer. The problem with Magento I find is the complete lack of documentation. I only discovered the above technique after 20 minutes of grepping the app/code/core directory&#8230; <img src='http://tgreenaway.com/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </p>
<p>And remember to use Magento&#8217;s log method:</p>
<pre class="brush: php;">

foreach($collection as $region) {

Mage::log(print_r($region, true));

}
</pre>
<p>Note some of the more useful attributes of that $region object are:</p>
<ul>
<li>$region-&gt;default_name</li>
<li>$region-&gt;code</li>
</ul>
<p>Which give responses along the lines of South Australia and SA, respectively.</p>
]]></content:encoded>
			<wfw:commentRss>http://tgreenaway.com/2009/01/magento-listing-regions-from-a-country-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
