<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Freelance Web Development | Douglas Radburn</title>
	
	<link>http://www.douglasradburn.co.uk</link>
	<description>Just another weblog typed by a web monkey...</description>
	<lastBuildDate>Mon, 31 Oct 2011 16:43:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DouglasRadburn" /><feedburner:info uri="douglasradburn" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>DouglasRadburn</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Magento and a free shipping option for Google Checkout</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/lCppkCAn5tQ/</link>
		<comments>http://www.douglasradburn.co.uk/magento-and-a-free-shipping-option-for-google-checkout/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 16:31:57 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=619</guid>
		<description><![CDATA[When using flat rate shipping options for Google Checkout, you can include a free delivery option. However, when you click through to Google Checkout, the free option is missing. Google Checkout seems to see this option and discard it. Or &#8230;]]></description>
			<content:encoded><![CDATA[<p>When using flat rate shipping options for Google Checkout, you can include a free delivery option.</p>
<p>However, when you click through to Google Checkout, the free option is missing.  Google Checkout seems to see this option and discard it.  Or does it?</p>
<p>In fact, this is Magento being helpful(?)</p>
<p>To cure this, you just need to edit /app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Checkout.php</p>
<p>You should be able to create a local version of the file (/app/code/local/&#8230;) if you don&#8217;t wish to edit the core file.</p>
<p>You&#8217;re looking for the following loop:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span> <span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$allowSpecific</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfigFlag</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'google/checkout_shipping_flatrate/sallowspecific_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$specificCountries</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;">'google/checkout_shipping_flatrate/specificcountry_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$allowedAreasXml</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getAllowedCountries<span style="color: #009900;">&#40;</span><span style="color: #000088;">$allowSpecific</span><span style="color: #339933;">,</span> <span style="color: #000088;">$specificCountries</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$title</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;">'google/checkout_shipping_flatrate/title_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$price</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;">'google/checkout_shipping_flatrate/price_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$price</span> <span style="color: #339933;">=</span> <span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$price</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</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: #000088;">$price</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>float<span style="color: #009900;">&#41;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tax'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getShippingPrice</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$price</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;"># || $price &lt; = 0) {
</span>    <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$xml</span> <span style="color: #339933;">.=</span> <span style="color: #339933;">&lt;&lt;&lt;</span>EOT
  <span style="color: #339933;">&lt;</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$nodeName</span><span style="color: #009900;">&#125;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$title}</span>&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>shipping <span style="color: #339933;">-</span>restrictions<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;</span>allowed <span style="color: #339933;">-</span>areas<span style="color: #339933;">&gt;</span>
       <span style="color: #009900;">&#123;</span><span style="color: #000088;">$allowedAreasXml</span><span style="color: #009900;">&#125;</span>
      <span style="color: #339933;">&lt;/</span>allowed<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>shipping<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>price currency<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{<span style="color: #006699; font-weight: bold;">$this-&gt;getCurrency</span>()}&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$price</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;/</span>price<span style="color: #339933;">&gt;</span>
&nbsp;
  EOT<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The only bit you&#8217;re really interested in though, is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$price</span> <span style="color: #339933;">&lt;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Change this to:</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And there you go - a free delivery option that you create will appear.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Magento+and+a+free+shipping+option+for+Google+Checkout+http%3A%2F%2Ftinyurl.com%2F3d7w3ne" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Magento+and+a+free+shipping+option+for+Google+Checkout+http%3A%2F%2Ftinyurl.com%2F3d7w3ne" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/lCppkCAn5tQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/magento-and-a-free-shipping-option-for-google-checkout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/magento-and-a-free-shipping-option-for-google-checkout/</feedburner:origLink></item>
		<item>
		<title>Getting category thumbnail images with Magento</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/MxITuEfiNDo/</link>
		<comments>http://www.douglasradburn.co.uk/getting-category-thumbnail-images-with-magento/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 10:29:33 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=608</guid>
		<description><![CDATA[Magento provides facilities to get the Image URL from a category by using the catalog/category model. echo Mage::getModel&#40;'catalog/category'&#41;-&#62;load&#40;$catId&#41;-&#62;getImageUrl&#40;&#41;; However, by default, it doesn&#8217;t provide the facility to get the thumbnail category image. You&#8217;d expect to be able to use getThumbnailUrl(), &#8230;]]></description>
			<content:encoded><![CDATA[<p>Magento provides facilities to get the Image URL from a category by using the catalog/category model.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog/category'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$catId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getImageUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>However, by default, it doesn&#8217;t provide the facility to get the thumbnail category image.  You&#8217;d expect to be able to use <code>getThumbnailUrl()</code>, but, you can&#8217;t.</p>
<p>In order to enable this functionality, you need to make some modifications to Magento.</p>
<p>The file you need to edit is <code>/app/code/core/Mage/Catalog/Model/Category.php</code>. Due to the nature of Magento, you&#8217;d be best copying this to <code>/app/code/local/Mage/Catalog/Model/Category.php</code> before amending the file.  Once copied, you can edit this new file.</p>
<p>Around line 481, you&#8217;ll find the <code>getImageUrl</code> function. Below this, we&#8217;re going to add a new function.  This function is slightly modified from others I&#8217;ve seen, where you can pass it a parameter to get just the file name, or get the full path if you&#8217;d prefer.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Retrieve thumbnail image URL
 *
 * @return string
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getThumbnailUrl<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fullpath</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getThumbnail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fullpath</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getBaseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'media'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'catalog/category/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$image</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span>
     <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$image</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Getting+category+thumbnail+images+with+Magento+http%3A%2F%2Ftinyurl.com%2F3kop9om" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Getting+category+thumbnail+images+with+Magento+http%3A%2F%2Ftinyurl.com%2F3kop9om" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/MxITuEfiNDo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/getting-category-thumbnail-images-with-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/getting-category-thumbnail-images-with-magento/</feedburner:origLink></item>
		<item>
		<title>MySQL issues from apt-get update</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/NfxMAFeGZuY/</link>
		<comments>http://www.douglasradburn.co.uk/mysql-issues-fro-apt-get-update/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 10:51:44 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=587</guid>
		<description><![CDATA[I did an apt-get upgrade from one version of Debian to another &#8211; I think it was etch to lenny. Upon restarting the box, mysql wouldn&#8217;t respond. hq-lnx-001:~# /etc/init.d/mysql start Starting MySQL database server: mysqld. Checking for corrupt, not cleanly &#8230;]]></description>
			<content:encoded><![CDATA[<p>I did an apt-get upgrade from one version of Debian to another &#8211; I think it was etch to lenny.</p>
<p>Upon restarting the box, mysql wouldn&#8217;t respond.  </p>
<p>hq-lnx-001:~# /etc/init.d/mysql start<br />
Starting MySQL database server: mysqld.<br />
Checking for corrupt, not cleanly closed and upgrade needing tables..<br />
/usr/bin/mysqladmin: connect to server at &#8216;localhost&#8217; failed<br />
error: &#8216;Access denied for user &#8216;debian-sys-maint&#8217;@'localhost&#8217; (using password: YES)&#8217;<br />
hq-lnx-001:~# ERROR 1045 (28000): Access denied for user &#8216;debian-sys-maint&#8217;@'localhost&#8217; (using password: YES)</p>
<p>debian-sys-maint is Debian&#8217;s user for interacting with MySQL.  In order to rebuild it, you need to  &#8211;skip-grant-tables.  You can&#8217;t do this just running mysqld, you need to edit your my.cnf file.</p>
<p>hq-lnx-001:~# nano /etc/mysql/my.cnf</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=MySQL+issues+from+apt-get+update+http%3A%2F%2Ftinyurl.com%2F66ydrax" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=MySQL+issues+from+apt-get+update+http%3A%2F%2Ftinyurl.com%2F66ydrax" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/NfxMAFeGZuY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/mysql-issues-fro-apt-get-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/mysql-issues-fro-apt-get-update/</feedburner:origLink></item>
		<item>
		<title>How to get number of cart items in Magento</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/kPNzadE6zP4/</link>
		<comments>http://www.douglasradburn.co.uk/how-to-get-number-of-cart-items-in-magento/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 11:14:30 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=601</guid>
		<description><![CDATA[Many websites show a &#8220;total number of items in your basket&#8221;. So, how do you get that information out of Magento if you&#8217;re not in the checkout process? You can simply call the Mage Helper file checkout/cart. If all you&#8217;re &#8230;]]></description>
			<content:encoded><![CDATA[<p>Many websites show a &#8220;total number of items in your basket&#8221;.  So, how do you get that information out of Magento if you&#8217;re not in the checkout process?</p>
<p>You can simply call the Mage Helper file checkout/cart.</p>
<p>If all you&#8217;re after is a total number, all you need is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout/cart'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCart</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getItemsCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This code grabs the helper object, gets the current cart object, and then calls the Magento count function on that.</p>
<p>If you want to do something with the items, then you&#8217;ll need to return the items, rather than the counter.  To do this, you need to look at the helper checkout/session instead.</p>
<p>Something along the lines of:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout/session'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAllItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you wanted to get the total for the basket &#8211; so that it could be displayed elsewhere on your site, then you can get this from the checkout/cart class.  Note, we don&#8217;t get this from the helper.</p>
<p>Simply call:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout/cart'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGrandTotal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// format the number - you couldn't probably use number_format, but use Magento's functions</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">formatPrice</span><span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout/cart'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGrandTotal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=How+to+get+number+of+cart+items+in+Magento+http%3A%2F%2Ftinyurl.com%2F6z2sdo4" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=How+to+get+number+of+cart+items+in+Magento+http%3A%2F%2Ftinyurl.com%2F6z2sdo4" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/kPNzadE6zP4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/how-to-get-number-of-cart-items-in-magento/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/how-to-get-number-of-cart-items-in-magento/</feedburner:origLink></item>
		<item>
		<title>Think Visibility September 2011</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/vJ6AAPzvEP8/</link>
		<comments>http://www.douglasradburn.co.uk/think-visibility-september-2011/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 10:44:02 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=593</guid>
		<description><![CDATA[This is the third Think Visibility I&#8217;ve attended (much thanks to Branded3 for forking out for the ticket!) I&#8217;ve really enjoyed the previous conferences and this one was no exception. Whilst I&#8217;m not an SEO, I have a keen interest &#8230;]]></description>
			<content:encoded><![CDATA[<p>This is the third <a href="http://www.thinkvisibility.com/">Think Visibility</a> I&#8217;ve attended (much thanks to Branded3 for forking out for the ticket!)  I&#8217;ve really enjoyed the previous conferences and this one was no exception.  Whilst I&#8217;m not an SEO, I have a keen interest in the area, and there is always enough going on that relates to the industry as a whole that its easy to just sit and listen and absorb information.  I remember seeing a talk by Paul Boag at FOWD last year where he talked about not sitting an reading about what you do &#8211; you just won&#8217;t take enough in &#8211; reading AROUND the subject means you learn a lot more, and this is one of the reasons attending a conference like this is so important.</p>
<p><a href="http://www.douglasradburn.co.uk/wp-content/uploads/2011/09/photo2.jpg"><img src="http://www.douglasradburn.co.uk/wp-content/uploads/2011/09/photo2-500x373.jpg" alt="Think Visibility Opening" title="Think Visibility Opening" width="500" height="373" class="alignright size-medium wp-image-595" /></a></p>
<p>The hot topics at Think Visibility for me this year were: security, psychology and edge rank.</p>
<p>It&#8217;s been interesting to see the change in the industry over the past two years or so &#8211; pushing social interaction into online and offline campaigns.  With it, brings an interesting shift into knowing about the psychology behind decision making.  This incorporated the latter two topics for me.</p>
<p>I really enjoyed the more technical talk about security in web applications by Glyn Wintle.  Whilst aware of much of what he talked about, it was interesting to see that what he talked about was merely the tip of the ice berg of a fascinating topic.</p>
<p>A great aspect of this conference is its downtime between talks, and before and after the conference. Everyone is so approachable, and everybody at the conference has a different background.  People attend from various backgrounds &#8211; internal seo staff, seo agencies, freelancers, CEOs, speakers etc, and this means there is always an interesting conversation to have.  The previous two visits I&#8217;d had to Think Visibility I kept myself to myself, but this time I was determined to say hello to people, and hope I didn&#8217;t come across as someone who didn&#8217;t know too much!</p>
<p>This SEO conference is well worth attending and great that its so local (Leeds), and not in London!</p>
<p>Oh yeah, also, there was Robot Wars.</p>
<p><a href="http://www.douglasradburn.co.uk/wp-content/uploads/2011/09/photo3.jpg"><img src="http://www.douglasradburn.co.uk/wp-content/uploads/2011/09/photo3-500x373.jpg" alt="Think Visibility - Robot Wars" title="Think Visibility - Robot Wars" width="500" height="373" class="alignright size-medium wp-image-596" /></a></p>
<p>The next Think Visibility conference planned for March 2012.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Think+Visibility+September+2011+http%3A%2F%2Ftinyurl.com%2F62udzqw" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Think+Visibility+September+2011+http%3A%2F%2Ftinyurl.com%2F62udzqw" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/vJ6AAPzvEP8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/think-visibility-september-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/think-visibility-september-2011/</feedburner:origLink></item>
		<item>
		<title>Where has apache2-ssl-certificate gone?</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/Ne9eIljoQjE/</link>
		<comments>http://www.douglasradburn.co.uk/where-has-apache2-ssl-certificate-gone/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 15:16:29 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=583</guid>
		<description><![CDATA[I was setting up SSL on our local Debian box at work, and needed to generate a new cert. apache2-ssl-certificate failed to work though, so what have they done with it? Well, they&#8217;ve moved it. If you&#8217;re setting up SSL &#8230;]]></description>
			<content:encoded><![CDATA[<p>I was setting up SSL on our local Debian box at work, and needed to generate a new cert.</p>
<p>apache2-ssl-certificate failed to work though, so what have they done with it?</p>
<p>Well, they&#8217;ve moved it.  If you&#8217;re setting up SSL for the first time, a nice workaround is:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># mkdir /etc/apache2/ssl
# /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem</pre></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Where+has+apache2-ssl-certificate+gone%3F+http%3A%2F%2Ftinyurl.com%2F3hxdvxv" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Where+has+apache2-ssl-certificate+gone%3F+http%3A%2F%2Ftinyurl.com%2F3hxdvxv" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/Ne9eIljoQjE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/where-has-apache2-ssl-certificate-gone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/where-has-apache2-ssl-certificate-gone/</feedburner:origLink></item>
		<item>
		<title>Viewing another users’ Crontab</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/82Q-abd9aHw/</link>
		<comments>http://www.douglasradburn.co.uk/viewing-another-users-crontab/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 10:09:09 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=576</guid>
		<description><![CDATA[I had the need recently to find a cron job on a server. I was logged in as root, but I didn&#8217;t know who the cron job was set up as. You can get a list of all users who &#8230;]]></description>
			<content:encoded><![CDATA[<p>I had the need recently to find a cron job on a server.  I was logged in as root, but I didn&#8217;t know who the cron job was set up as.</p>
<p>You can get a list of all users who have cron scheduled tasks by running the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@server ~]# ls -l /var/spool/cron</pre></div></div>

<p>This allows you to see the users, although if you&#8217;ve got a general idea, then looking in /etc/passwd would give you an idea too.</p>
<p>So, the cronjob might be running as any of these users. Usually to get your crontab you can just run:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@server ~]# crontab -l</pre></div></div>

<p>Or to edit it:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@server ~]# crontab -e</pre></div></div>

<p>As root, you get the chance to tell crontab which user you&#8217;d like to view.  Like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@server ~]#crontab -u username -l</pre></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Viewing+another+users%E2%80%99+Crontab+http%3A%2F%2Ftinyurl.com%2F3temk7x" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Viewing+another+users%E2%80%99+Crontab+http%3A%2F%2Ftinyurl.com%2F3temk7x" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/82Q-abd9aHw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/viewing-another-users-crontab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/viewing-another-users-crontab/</feedburner:origLink></item>
		<item>
		<title>jQuery UI Tabs and the Stylish Select Plugin</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/46J1D7CDfe4/</link>
		<comments>http://www.douglasradburn.co.uk/jquery-ui-tabs-and-the-stylish-select-plugin/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 10:38:29 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=570</guid>
		<description><![CDATA[I was having issues with a site recently whereby the jQuery UI Tabs that were on the site weren&#8217;t working in IE. After chopping out all other includes and HTML/CSS that wasn&#8217;t needed for the tabs to display, I narrowed &#8230;]]></description>
			<content:encoded><![CDATA[<p>I was having issues with a site recently whereby the jQuery UI Tabs that were on the site weren&#8217;t working in IE.</p>
<p>After chopping out all other includes and HTML/CSS that wasn&#8217;t needed for the tabs to display, I narrowed it down to the &#8220;stylish select&#8221; jQuery plugin (<a href="http://plugins.jquery.com/project/stylish-select-box">http://plugins.jquery.com/project/stylish-select-box</a>) that had been installed on the site.  As this was an inherited site, I didn&#8217;t know where (or even if) the plugin was being actively used on the site, so I couldn&#8217;t just disable it.</p>
<p>The issue was that this plugin was redefining the &#8220;indexOf&#8221; function.  In order to create a &#8220;global&#8221; version of the function, the developer has created their own.  Since this function is then used in other function calls by other plugins/scripts etc, it was breaking them.</p>
<p>Simply modifying the function and re-referencing the function calls within the plugin was enough.</p>
<p>The modified function looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">Array.prototype.indexOfNew = function (obj, start) {
  for (var i = (start || 0); i &lt; this.length; i++) {
    if (this[i] == obj) {
      return i;
    }
  }
}</pre></div></div>

<p>Then, just update any function calls within the plugin to &#8220;indexOfNew&#8221;.  That cures the issue.</pre>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=jQuery+UI+Tabs+and+the+Stylish+Select+Plugin+http%3A%2F%2Ftinyurl.com%2F3v7b26z" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=jQuery+UI+Tabs+and+the+Stylish+Select+Plugin+http%3A%2F%2Ftinyurl.com%2F3v7b26z" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/46J1D7CDfe4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/jquery-ui-tabs-and-the-stylish-select-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/jquery-ui-tabs-and-the-stylish-select-plugin/</feedburner:origLink></item>
		<item>
		<title>Upgrading PHP</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/LYJWLfjk0zA/</link>
		<comments>http://www.douglasradburn.co.uk/upgrading-php/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 15:56:07 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=566</guid>
		<description><![CDATA[I was reading about the impending release of WordPress 3.2 and the fact that it will only be supporting PHP 5.2 and above. This also sparked discussion at http://yoast.com/requires-php-52/ regarding Yoast&#8217;s plugins now requiring PHP 5.2 (it has a check &#8230;]]></description>
			<content:encoded><![CDATA[<p>I was reading about the impending release of WordPress 3.2 and the fact that it will only be supporting PHP 5.2 and above.  This also sparked discussion at <a href="http://yoast.com/requires-php-52/">http://yoast.com/requires-php-52/</a> regarding Yoast&#8217;s plugins now requiring PHP 5.2 (it has a check at the top of the plugin, but doesn&#8217;t actually REQUIRE PHP 5.2 as yet).</p>
<p>A few of the comments got me a little confused &#8211; talking about security etc.  I guess it all depends with distribution you have, how much you want to take advantage of new functionality (5.3 has A LOT &#8211; and the difference between PHP 4 and PHP 5 is VAST).  I recently set up a new server for work, and it came with Red Hat Enterprise 5.   RHEL 5 is a nice bit of kit, from a trusted source, but it only ships with PHP 5.1.6.  Some people seem to see this as a big security risk, but what they don&#8217;t seem to be aware of is that Red Hat backport all security patches.  I believe this probably covers Fedora Core and CentOS too.  Version 5.1 of PHP is the supported version with the updating system.</p>
<p>If you want to go off on an adventure and install 5.2 or 5.3 then you need to make sure that you can maintain the same level of support that your distro is already offering, or, you need to find a host who is willing to do the work.  Just asking your host to update your PHP could become dangerous if they then don&#8217;t upgrade it when new security patches become available.  It&#8217;s something that needs to be monitored and supported.</p>
<p>It&#8217;s interesting to note that most major distributions still don&#8217;t ship with THE LATEST revision of PHP. Debian, Fedora, RHEL, CentOS, etc.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Upgrading+PHP+http%3A%2F%2Ftinyurl.com%2F4xreyq2" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Upgrading+PHP+http%3A%2F%2Ftinyurl.com%2F4xreyq2" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/LYJWLfjk0zA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/upgrading-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/upgrading-php/</feedburner:origLink></item>
		<item>
		<title>WordPress MU on main domains</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/ZjaZOC9-On8/</link>
		<comments>http://www.douglasradburn.co.uk/wordpress-mu-on-main-domains/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 15:05:42 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=557</guid>
		<description><![CDATA[WordPress MU, or just WordPress now as of v3, supports &#8220;networks&#8221; of sites. Once you set up the main site, you can install other sites into folders, or on to subdomains of the main domain. There is a lot of &#8230;]]></description>
			<content:encoded><![CDATA[<p>WordPress MU, or just WordPress now as of v3, supports &#8220;networks&#8221; of sites.  Once you set up the main site, you can install other sites into folders, or on to subdomains of the main domain.  There is a lot of information on the subject, and my friend Nick Boldison wrote a blog post here &#8211; <a href="http://nick.boldison.com/wordpress/wordpress-how-to-enable-multi-site-in-wp3/">WordPress: How to enable multi-site in WP3</a>.</p>
<p>A couple of things have changed in WP3.1, such as the Super Admin now being called &#8220;Network Admin&#8221; and being located in the top right corner.</p>
<p>It&#8217;s a great guide and quickly gets you up and running with a quick blog network all in folders or subdomains and I can&#8217;t improve on it.</p>
<p>What I did want to talk about though was getting your blog network running on multiple IPs and more importantly, multiple domains.  I didn&#8217;t think this was possible.  After all, WordPress says, subdomains or folders.  Those are the only two options.  However, enter the <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">WordPress MU Domain Mapping</a> plugin.</p>
<p>Once you&#8217;ve installed the plugin, you&#8217;re pretty much set.  Just add a line to the config:</p>

<div class="wp_syntax"><div class="code"><pre class="hmtl" style="font-family:monospace;">define( 'SUNRISE', 'on' );</pre></div></div>

<p>and make sure you copy the sunrise.php file into the root of wp-content from your plugins folder.</p>
<p>Once you add a new subdomain / folder you can access the dashboard of the site and add a domain mapping, such as this example from an internal network (it was easier to configure the multiple IPs on our linux box and domain controller):</p>
<p><a href="http://www.douglasradburn.co.uk/wp-content/uploads/2011/03/internal_domain_mapping.jpg"><img src="http://www.douglasradburn.co.uk/wp-content/uploads/2011/03/internal_domain_mapping-500x258.jpg" alt="" title="internal_domain_mapping" width="500" height="258" class="alignright size-medium wp-image-558" /></a></p>
<p>Now that you&#8217;ve added the domain mapping, you can continue to add more and more sites following the same system.  This means that you manage all of them from one central place but they can appear on different domains on different IPs.</p>
<p>As far as your linux set up to achieve this goes, just make sure that all the IPs and sites all point to the same folder, like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;virtualhost *:80&gt;
    DocumentRoot &quot;/var/www/somesite/&quot;
    ServerName maindomain.co.uk
    ServerAlias *.maindomain.co.uk
    ServerAlias somecooldomain.com www.somecooldomain.com
    ServerAlias anotherawesomedomain.com www.anotherawesomedomain.com
&lt;/virtualhost&gt;</pre></td></tr></table></div>

<p>In the example above, Apache has a virtual host listening on all IPs on the server.  All are then routed through to the same document root if it matches one of the domains.  This means you can just point your domain&#8217;s A record at an IP on the server and it should work.  If you&#8217;re using a control panel for your server, you might have a little more work to do to set this up.  CPanel has a nifty trick whereby you can alter the vhost.conf and then run</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/usr/local/cpanel/bin/apache_conf_distiller --update
/usr/local/cpanel/bin/build_apache_conf</pre></div></div>

<p>So, you can change the Virtualhost definition and then add the additional domains as parked domains on the primary one through the control panel you&#8217;re already used to.</p>
<p>Depending on your server setup, openbase_dir shouldn&#8217;t catch you out, but in case it does, you can disable this as part of your config file too.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=WordPress+MU+on+main+domains+http%3A%2F%2Ftinyurl.com%2F6fe5kgg" title="Post to Twitter"><img class="nothumb" src="http://www.douglasradburn.co.uk/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=WordPress+MU+on+main+domains+http%3A%2F%2Ftinyurl.com%2F6fe5kgg" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/ZjaZOC9-On8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/wordpress-mu-on-main-domains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/wordpress-mu-on-main-domains/</feedburner:origLink></item>
	</channel>
</rss>

