<?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>magento | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/category/ecommerce/magento/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Sat, 06 Oct 2012 14:25:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Check if a country is an EU country in Magento</title>
		<link>https://nerdpress.org/2012/10/06/check-if-a-country-is-an-eu-country-in-magento/</link>
					<comments>https://nerdpress.org/2012/10/06/check-if-a-country-is-an-eu-country-in-magento/#comments</comments>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Sat, 06 Oct 2012 14:25:12 +0000</pubDate>
				<category><![CDATA[magento]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2266</guid>

					<description><![CDATA[<p>I you ever wondered how you can check if a Country, resp. a Country Code, is in the EU, i did the following: Magento has a config value: eu_countries that lists all Countries of the EU. You can find it in the backend under: Configuration -> General -> Country Options. Against this list you can &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/10/06/check-if-a-country-is-an-eu-country-in-magento/" class="more-link">Continue reading<span class="screen-reader-text"> "Check if a country is an EU country in Magento"</span></a></p>
The post <a href="https://nerdpress.org/2012/10/06/check-if-a-country-is-an-eu-country-in-magento/">Check if a country is an EU country in Magento</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I you ever wondered how you can check if a Country, resp. a Country Code, is in the EU, i did the following:</p>
<p>Magento has a config value: eu_countries that lists all Countries of the EU.</p>
<p>You can find it in the backend under: <br /><em>Configuration -> General -> Country Options</em>.</p>
<p>Against this list you can validate your country code, f.e. that you got in an billing or shipping address of an order.</p>
<p><span id="more-2266"></span></p>
<pre class="brush: php; title: ; notranslate">
$address = $order-&gt;getBillingAddress()-&gt;getData();
$eu_countries = Mage::getStoreConfig('general/country/eu_countries');
$eu_countries_array = explode(',',$eu_countries);
if(in_array($address&#x5B;'country_id'], $eu_countries_array)){
//do something useful:
//for example show a tax hint like this german one: 'steuerfreie innergemeinschaftliche Lieferung'
}
</pre>
<p>Pretty simple, once you know!</p>
<p>Do you know any other way?</p>
<p>Let me know!</p>The post <a href="https://nerdpress.org/2012/10/06/check-if-a-country-is-an-eu-country-in-magento/">Check if a country is an EU country in Magento</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/10/06/check-if-a-country-is-an-eu-country-in-magento/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>how to not cache the footer in magento</title>
		<link>https://nerdpress.org/2011/10/04/how-to-not-cache-the-footer-in-magento/</link>
					<comments>https://nerdpress.org/2011/10/04/how-to-not-cache-the-footer-in-magento/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Tue, 04 Oct 2011 03:10:45 +0000</pubDate>
				<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[footer]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1823</guid>

					<description><![CDATA[<p>With some advanced scheduled-post-voodoo i successfully managed to publish this post already yesterday with some completely unrelated queries and no text. this was not intended &#8211; please accept my apologies :P Anyway: In the footer of my magento shop we might have a summary of the shopping cart, which i simply put in the footer.phtml &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/10/04/how-to-not-cache-the-footer-in-magento/" class="more-link">Continue reading<span class="screen-reader-text"> "how to not cache the footer in magento"</span></a></p>
The post <a href="https://nerdpress.org/2011/10/04/how-to-not-cache-the-footer-in-magento/">how to not cache the footer in magento</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>With some advanced scheduled-post-voodoo i successfully managed to publish this post already yesterday with some completely unrelated queries and no text. this was not intended &#8211; please accept my apologies :P</p>
<p>Anyway: In the footer of my magento shop we might have a summary of the shopping cart,<br />
which i simply put in the footer.phtml template file:<br />
<span id="more-1823"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php if (Mage::getModel('checkout/cart')-&gt;getItemsCount() &gt; 0): ?&gt;
  &lt;div class=&quot;footer_cart_widget&quot;&gt;
    &lt;a href=&quot;/checkout/cart&quot; class=&quot;cart&quot;&gt;
      &lt;?php echo $this-&gt;__('Warenkorb') ?&gt;:&lt;br /&gt;
      &lt;span class=&quot;cart_meta&quot;&gt;
        &lt;?php echo Mage::getModel('checkout/cart')-&gt;getItemsCount() ?&gt;
        &lt;?php if (Mage::getModel('checkout/cart')-&gt;getItemsCount() == 1): ?&gt;
          Produkt: 
        &lt;?php else: ?&gt;
          Produkte: 
        &lt;?php endif; ?&gt;
        &lt;?php echo $this-&gt;helper('checkout')-&gt;formatPrice(Mage::getSingleton('checkout/cart')-&gt;getQuote()-&gt;getGrandTotal()); ?&gt;
      &lt;/span&gt;
    &lt;/a&gt;
  &lt;/div&gt;
&lt;?php endif; ?&gt;
</pre>
<p><a href="https://nerdpress.org/wp-content/uploads/2011/10/Bildschirmfoto-2011-10-04-um-21.21.05.png"><img decoding="async" src="https://nerdpress.org/wp-content/uploads/2011/10/Bildschirmfoto-2011-10-04-um-21.21.05-300x146.png" alt="Magento Footer Shopping cart Widget disable cache" title="Magento Footer Shopping Cart Summary" width="300" height="146" class="alignnone size-medium wp-image-1846" srcset="https://nerdpress.org/wp-content/uploads/2011/10/Bildschirmfoto-2011-10-04-um-21.21.05-300x146.png 300w, https://nerdpress.org/wp-content/uploads/2011/10/Bildschirmfoto-2011-10-04-um-21.21.05.png 443w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>This means we might need to disable the caching for the footer HTML block,<br />
so that my cart summary will stay dynamically generated.</p>
<p>This is how you can do it:</p>
<p>copy</p>
<pre class="brush: bash; title: ; notranslate">app/code/core/Mage/Page/Block/Html/Footer.php</pre>
<p>to</p>
<pre class="brush: bash; title: ; notranslate">app/code/local/Mage/Page/Block/Html/Footer.php</pre>
<p>and just comment out the following lines:</p>
<pre class="brush: php; title: ; notranslate">
//$this-&gt;addData(array(
//    'cache_lifetime'=&gt; false,
//    'cache_tags'    =&gt; array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG)
//));
</pre>
<p>you could also put the cart values in the getCacheKeyInfo() method, but as this would result in caching a footer for any state of the shopping cart from my understanding, i don&#8217;t think it&#8217;s necessarily a good idea.</p>The post <a href="https://nerdpress.org/2011/10/04/how-to-not-cache-the-footer-in-magento/">how to not cache the footer in magento</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2011/10/04/how-to-not-cache-the-footer-in-magento/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>set up magento in multiple environments</title>
		<link>https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/</link>
					<comments>https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Tue, 27 Sep 2011 03:29:47 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[environments]]></category>
		<category><![CDATA[Git]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1667</guid>

					<description><![CDATA[<p>I just started digging in the shop software magento for a project and set up the following development environment. In this scenario development is done on two local machines while products and pages beeing already edited on the &#8220;Live&#8221;-Web-Server. Git is used for version control and deployment. Also FTP SSH. Magento is quite nice when &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/" class="more-link">Continue reading<span class="screen-reader-text"> "set up magento in multiple environments"</span></a></p>
The post <a href="https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/">set up magento in multiple environments</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I just started digging in the shop software <a href="http://www.magentocommerce.com">magento</a> for a project and set up the following development environment.</p>
<p>In this scenario development is done on two local machines while products and pages beeing already edited on the &#8220;Live&#8221;-Web-Server.<br />
Git is used for version control and deployment. Also <del>FTP</del> SSH.<span id="more-1667"></span></p>
<p><a href="https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments.png"><img decoding="async" class="alignnone size-medium wp-image-1761" title="magento_sync_multiple_environments" src="https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments-300x147.png" alt="sync multiple Magento environments" width="300" height="147" srcset="https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments-300x147.png 300w, https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments.png 732w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Magento is quite nice when it comes to deployment, as most config stuff is stored in XML files.<br />
Those files are kept locally and ignored from version control.</p>
<p>So this is what my <a href="http://stackoverflow.com/questions/4564622/best-practices-for-using-git-with-magento">.gitignore</a> looks like:</p>
<pre class="brush: bash; title: ; notranslate">
#cache, sessions, logs
/var/cache/*
/var/session/*
/var/locks/*
/var/report/*
/var/log/*
#media folder - images etc...
/media/*

#local config files
/app/etc/local.xml
.htaccess

#database dump
/database.sql

</pre>
<p>So i got a copy of the repository in each environment with a local .htaccess and local.xml file.</p>
<p>Theres a few things stored in DB by magento, though.<br />
The most obvious is the &#8220;web/secure/base_url&#8221; and &#8220;web/unsecure/base_url&#8221; which both reside in the &#8220;core_config_data&#8221; table.<br />
Those have to be set to the name of the host you&#8217;re working on.</p>
<p>This can be done with a shell script like this:</p>
<pre class="brush: bash; title: ; notranslate">

#create a dupm of the live DB on the server
ssh user@server.com 'mysqldump -u&#x5B;username] -p&#x5B;password] &gt; ~/db_dump.sql'

#copy DB dump to local machine
scp user@server.com:~/db_dump.sql ./database.sql

#import SQL
mysql -u&#x5B;local_mysql_user] -p&#x5B;local_mysql_pw] &#x5B;local_db_name] &lt; ./database.sql

#update config settings in the DB
mysql -u&#x5B;local_mysql_user] -p&#x5B;local_mysql_pw] &#x5B;local_db_name]&lt;UPDATE
core_config_data
SET value='http://local.server.com/'
WHERE value ='http://server.com';
EOFMYSQL

</pre>
<p>This way all CMS and products  can be edited on the server, while the local machines can be easily synched.<br />
For me this works fine, as we are working only in the file system in the local environment.<br />
In case you can&#8217;t use the online Server as &#8220;database master&#8221; this might be not that simple.</p>
<p>As we most likely don&#8217;t want the whole /media folder under version control we might want to have another shell script to copy the media files to the local machine (via SCP in this case):</p>
<pre class="brush: bash; title: ; notranslate">

#remove local media folder
rm -rf ./media/*
#fetch media files
scp -r ssh_user@server.com:~/magento_folder/media/* ./media

</pre>
<p>I guess this could be done more efficiently with maybe ant or something.<br />
But for the moment this works fine for me.</p>
<p>So now i can update my local environment with one line on the console:</p>
<pre class="brush: bash; title: ; notranslate">

git pull; sh sync_db.sh; sh sync_media.sh

</pre>The post <a href="https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/">set up magento in multiple environments</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
