<?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>Web "Development" | Douglas Radburn</title>
	
	<link>http://www.douglasradburn.co.uk</link>
	<description>Just another weblog typed by a web monkey...</description>
	<lastBuildDate>Thu, 17 May 2012 10:41:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</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>Attribute Mapping with Google Content in Magento</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/b4wKoAg4v5g/</link>
		<comments>http://www.douglasradburn.co.uk/attribute-mapping-with-google-content-in-magento/#comments</comments>
		<pubDate>Wed, 16 May 2012 12:15:28 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=684</guid>
		<description><![CDATA[I&#8217;ve worked on a few Magento builds recently where the client has requested Google Merchant Centre integration. We&#8217;ve used some third party tools previously to create feed files that we can then pass on to Google Content. However, in a &#8230;]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve worked on a few Magento builds recently where the client has requested Google Merchant Centre integration.  We&#8217;ve used some third party tools previously to create feed files that we can then pass on to Google Content.  However, in a recent project, we were looking for a more integrated, close-knit solution, so we looked at Mage&#8217;s own <a href="http://www.magentocommerce.com/magento-connect/google-content-api-for-shopping.html">Google Content extension</a>.</p>
<p>The first thing you&#8217;ll notice is that this uses the API.  To get access to the API, your account has to be approved by Google.  You&#8217;ll need to <a href="http://support.google.com/merchants/bin/request.py?contact_type=content_api">fill in this form</a>.  Once Google has activated your account for API use, you&#8217;re good to go.</p>
<p>Next you&#8217;ll need to set a few things up &#8211; such as mapping a GTIN field etc, but most of the work is taken care of by the extension and you can quickly start syncronising content.</p>
<p>The client on this project specifically requested that their brandname appeared prefixed to the product title.</p>
<p>The problem is in the <code>Title</code> attribute- even though there the extension allows you to map Google&#8217;s &#8216;title&#8217; with a custom attribute, Google automatically pulls product title info from &#8216;name&#8217; attribute.  The issue here is with Magento&#8217;s implementation.</p>
<p>For this implementation, another attribute was created and populated with the &#8220;brand-productname&#8221; convention, so that we could re-map it.</p>
<p>The only file you need to be interested in is: <code>/app/code/core/Mage/GoogleShopping/Model/Attribute/Title.php</code></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Mage_GoogleShopping_Model_Attribute_Title <span style="color: #000000; font-weight: bold;">extends</span> Mage_GoogleShopping_Model_Attribute_Default
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * Set current attribute to entry (for specified product)
     *
     * @param Mage_Catalog_Model_Product $product
     * @param Varien_Gdata_Gshopping_Entry $entry
     * @return Varien_Gdata_Gshopping_Entry
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> convertAttribute<span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">,</span> <span style="color: #000088;">$entry</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000088;">$mapValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductAttributeValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGroupAttributeName</span><span style="color: #009900;">&#40;</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: #339933;">!</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$mapValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$name</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductAttributeValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mapValue</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$titleText</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapValue</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</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>
            <span style="color: #000088;">$titleText</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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;">$titleText</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'no title'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$titleText</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'googleshopping'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cleanAtomAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$titleText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$entry</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$entry</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getService</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">newTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$titleText</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$entry</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The lines we&#8217;re interested in, are:</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: #339933;">!</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000088;">$mapValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$name</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductAttributeValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>When happens here is, $name is null, so it tries to get a new mapping.  It fails, and thus, you get the product name in the <code>if</code> statement below it.</p>
<p>Simply change this line to the below, and your titles will be sent to Google as you intended them!</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: #339933;">!</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductAttributeValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/b4wKoAg4v5g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/attribute-mapping-with-google-content-in-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/attribute-mapping-with-google-content-in-magento/</feedburner:origLink></item>
		<item>
		<title>Including Magento blocks in a WordPress theme</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/He12EeL7L1M/</link>
		<comments>http://www.douglasradburn.co.uk/including-magento-blocks-in-a-wordpress-theme/#comments</comments>
		<pubDate>Tue, 08 May 2012 11:25:58 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=617</guid>
		<description><![CDATA[Including Magento blocks in a WordPress theme is straight forward, however, the internationalisation feature of both systems gets in the way. An example // File 1 - include_1.php function foo&#40;$a&#41; &#123; return $a*2; &#125; &#160; // File 2 - include_2.php &#8230;]]></description>
			<content:encoded><![CDATA[<p>Including Magento blocks in a WordPress theme is straight forward, however, the internationalisation feature of both systems gets in the way.</p>
<h2>An example</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// File 1 - include_1.php</span>
<span style="color: #000000; font-weight: bold;">function</span> foo<span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$a</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// File 2 - include_2.php</span>
<span style="color: #000000; font-weight: bold;">function</span> foo<span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$b</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// File 3 - index.php</span>
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">&quot;include_1.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">&quot;include_2.php&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>File 3 would throw: <code>Fatal error: Cannot redeclare foo()</code></p>
<h2>So, what&#8217;s the problem?</h2>
<p>Put simply, they both have the same function.  Whichever one comes first, PHP raises an error when the second one is defined.  In the case of WordPress and Magento, they both have the function <code>__</code>.</p>
<h2>How do I overcome this issue?</h2>
<p>Deactivate a Magento function that conflicts with one in WordPress.</p>
<p>This is the easiest way to do it, as otherwise we&#8217;d need to modify core WordPress.  Magento allows us to over-ride files using a &#8220;local&#8221; version.</p>
<h2>The implemenation</h2>
<p>Copy <code>/app/code/core/Mage/Core/functions.php</code> to <code>/app/code/local/Mage/Core/functions.php</code> – this file will now be used over the original, and will remain during Magento upgrades.</p>
<p>Open the file at <code>/app/code/local/Mage/Core/functions.php</code> and locate the <code>function __</code> function.  It should be around line 90, but can vary depending on your Magento version.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> __<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">return</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">app</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTranslator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">translate</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">func_get_args</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: #009900;">&#125;</span></pre></div></div>

<p>This should now become:</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: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">function</span> __<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">app</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTranslator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">translate</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">func_get_args</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: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This tells Magento that it should only actually define the function if it&#8217;s not already been defined (by WordPress in our case).</p>
<h2>So, how do I now include a CMS static block in my theme?</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//include Magento</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'../app/Mage.php'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">umask</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Mage<span style="color: #339933;">::</span><span style="color: #004000;">app</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCurrentStore</span><span style="color: #009900;">&#40;</span>Mage_Core_Model_App<span style="color: #339933;">::</span><span style="color: #004000;">ADMIN_STORE_ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$staticBlock</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cms/block'</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: #0000ff;">'static-cms-block-identifier'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$staticBlock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/He12EeL7L1M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/including-magento-blocks-in-a-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/including-magento-blocks-in-a-wordpress-theme/</feedburner:origLink></item>
		<item>
		<title>Getting Magento to work with BST/GMT</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/DUrn5_Cfr_E/</link>
		<comments>http://www.douglasradburn.co.uk/getting-magento-to-work-with-bstgmt/#comments</comments>
		<pubDate>Thu, 03 May 2012 10:47:44 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bst]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=613</guid>
		<description><![CDATA[The problem If you run a UK based Magento store you probably already know that the store times are wrong for half of the year as the timezone switches between GMT and BST. Unfortunately, Magento doesn&#8217;t support BST at all &#8230;]]></description>
			<content:encoded><![CDATA[<h2>The problem</h2>
<p>If you run a UK based Magento store you probably already know that the store times are wrong for half of the year as the timezone switches between GMT and BST. </p>
<p>Unfortunately, Magento doesn&#8217;t support BST <em>at all</em> and the only thing for store owners in the UK, is to use standard GMT for the whole year &#8211; obviously, not great.</p>
<p>Magento uses UTC to store all times in the DB and works out the offset from that to whichever timezone you have selected in the admin area.  The idea behind this is to allow you to set different timezones per store and have them all work together because of how the dates are stored.</p>
<h2>So what can I do?</h2>
<p>Unfortunately the only way to allow support for BST is to change the default timezone from UTC to Europe/London. This means creating local override files, so <strong>if you&#8217;re wanting to use timezones other than Europe/London for a store in your installation, you&#8217;re probably just going to have to live with the issue</strong>.</p>
<h2>Issues?</h2>
<p>1) Any existing data will be stored in UTC (GMT), so it will always be an hour behind during BST.  This is a useful amend to make at the beginning of a new build rather than to a store that already exists, but if you can live with it, then go ahead any way.</p>
<p>2) You&#8217;ll need to make a single core file change to <code>app/Mage.php</code>.</p>
<h2>What steps should I take?</h2>
<p>Firstly, you need to ensure that your server is set up as <code>Europe/London</code>, otherwise altering Magento isn&#8217;t really going to have any baring on getting things working.  To fix this, depending on your Linux OS, you want to be doing something like: <a href="http://whomwah.com/2008/10/01/setting-the-timezone-on-centos/">this handy guide</a>.</p>
<h2>What to change with Magento</h2>
<p>Start by copying the following files into their respective &#8220;local&#8221; folder.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">   app/code/core/Mage/Core/Model/Locale.php
   app/code/core/Mage/Core/Model/Date.php
   app/code/core/Mage/Cron/Model/Schedule.php</pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">   app/code/local/Mage/Core/Model/Locale.php
   app/code/local/Mage/Core/Model/Date.php
   app/code/local/Mage/Cron/Model/Schedule.php</pre></div></div>

<p>Open the first file &#8211; <code>app/code/local/Mage/Core/Model/Locale.php</code> and replace the following lines (note these lines aren&#8217;t together):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">const</span> DEFAULT_TIMEZONE  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UTC'</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #339933;">@</span><span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$timezone</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #339933;">@</span><span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$currentTimezone</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>with</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">const</span> DEFAULT_TIMEZONE  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Europe/London'</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #339933;">@</span><span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span>Mage_Core_Model_Locale<span style="color: #339933;">::</span><span style="color: #004000;">DEFAULT_TIMEZONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #339933;">@</span><span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span>Mage_Core_Model_Locale<span style="color: #339933;">::</span><span style="color: #004000;">DEFAULT_TIMEZONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What we&#8217;re doing here is altering the default timezone, and then calling that setting when we call <code>date_default_timezone_set</code>. You could use <code>self::DEFAULT_TIMEZONE</code> instead of <code>Mage_Core_Model_Locale::DEFAULT_TIMEZONE</code> if you were so inclined.</p>
<p>Nex, you should open up the <code>app/code/local/Mage/Core/Model/Date.php</code> file and locate the <code>calculateOffset()</code> function.</p>
<p>Change the following two occurances &#8211; again, making reference to the constant we&#8217;ve just set up:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$timezone</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$oldzone</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>with</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span>Mage_Core_Model_Locale<span style="color: #339933;">::</span><span style="color: #004000;">DEFAULT_TIMEZONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The only other amend left to do is to make sure that the cron system still knows what time it is! To do this, we edit <code>app/code/core/Mage/Cron/Model/Schedule.php</code> and change the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$d</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getdate</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;">'core/date'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timestamp</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$d</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getdate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Unfortunately &#8211; and I&#8217;m not quite sure why I&#8217;ve left this till last, but&#8230; &#8211; you need to make a core Magento change.  Fortunately, this is straight forward and only requires one change.  For some reason, the guys that made Magento decided to hard-code in a UTC call within the main <code>app/mage.php</code>.  It&#8217;s not a good idea to make core changes, as when you come to update Magento (if you ever do), you&#8217;ll have to re-make this change, but it needs to be done.</p>
<p>Open up <code>app/mage.php</code> and find the line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UTC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Europe/London'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And that&#8217;s it!  Your store should now be working to BST/GMT.  Congratulations!</p>
<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/DUrn5_Cfr_E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/getting-magento-to-work-with-bstgmt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/getting-magento-to-work-with-bstgmt/</feedburner:origLink></item>
		<item>
		<title>Facebook Canvas Auto Height</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/zTwZwlzZGnU/</link>
		<comments>http://www.douglasradburn.co.uk/facebook-canvas-auto-height/#comments</comments>
		<pubDate>Wed, 02 May 2012 12:39:38 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=652</guid>
		<description><![CDATA[I was developing a canvas app on Facebook this week for a client, using the new timeline dimensions (810px wide). Annoyingly, Facebook seemed to ignore the height attribute I specified when I set up the tab, and promptly put all &#8230;]]></description>
			<content:encoded><![CDATA[<p>I was developing a canvas app on Facebook this week for a client, using the new timeline dimensions (810px wide).  Annoyingly, Facebook seemed to ignore the height attribute I specified when I set up the tab, and promptly put all my content in an iframe 800px high.</p>
<p>I tried adding a height attribute to my opening div in my page.  I tried amending the height in Facebook&#8217;s attributes too, but unfortunately no luck.  The only thing I could think was to change the height onload.  Luckily, a quick google came up with this <a href="http://stackoverflow.com/questions/9846444/facebook-timeline-define-custom-height-for-tab-with-iframe">article on stackoverflow</a> which covers most of the code needed (specificially <code>FB.Canvas.setAutoGrow()</code>)</p>
<p>Depending on your app/page, create: <code>&lt;div id="fb-root"&gt;&lt;/div&gt;</code> and immediately below it, put the following.  you may need to tweak true/false depending on your circumstance.</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">window.fbAsyncInit = function () {
    FB.init({
        appId: 'YOURAPPID', // App ID
        channelUrl: '/channel.html', // Channel File
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true  // parse XFBML
    });
    FB.Canvas.setAutoGrow(); //Resizes the iframe to fit content
};
// Load the SDK Asynchronously
(function (d) {
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) { return; }
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = &quot;//connect.facebook.net/en_US/all.js&quot;;
    ref.parentNode.insertBefore(js, ref);
} (document));</pre></div></div>

<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/zTwZwlzZGnU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/facebook-canvas-auto-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/facebook-canvas-auto-height/</feedburner:origLink></item>
		<item>
		<title>Create a Zip File Using PHP</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/S5X9BcHWF0E/</link>
		<comments>http://www.douglasradburn.co.uk/create-a-zip-file-using-php/#comments</comments>
		<pubDate>Wed, 02 May 2012 11:53:26 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=645</guid>
		<description><![CDATA[A few days ago, a client requested a contact form submission to go to an autoimporting email address in a specific format. At first, this wasn&#8217;t an issue &#8211; a CSV file was fine. However, the client wanted a zipped &#8230;]]></description>
			<content:encoded><![CDATA[<p>A few days ago, a client requested a contact form submission to go to an autoimporting email address in a specific format.  At first, this wasn&#8217;t an issue &#8211; a CSV file was fine. However, the client wanted a zipped CSV.  At first I thought this was going to be difficult &#8211; Linux + Zip? &#8211; but it turns out PHP has some nifty functions to create and add to zip files.</p>
<p>Looking into it a bit further it appears it isn&#8217;t brilliant &#8211; for example, there is a lack of support for NOT compressing the archive &#8211; but it did exactly what I required.</p>
<p>I put together a little function to take care of it and make it re-usable.  Take a look below.</p>
<h2>The solution function</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> createZipFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$files</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$destination</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$overwrite</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: #666666; font-style: italic;">// sanity check</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$destination</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$overwrite</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> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// should probably add something to ensure that the files exist?</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$files</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$zip</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ZipArchive<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">open</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$destination</span><span style="color: #339933;">,</span> <span style="color: #000088;">$overwrite</span> ? ZIPARCHIVE<span style="color: #339933;">::</span><span style="color: #004000;">OVERWRITE</span> <span style="color: #339933;">:</span> ZIPARCHIVE<span style="color: #339933;">::</span><span style="color: #004000;">CREATE</span><span style="color: #009900;">&#41;</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: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$files</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// use basename so that we don't keep the directory structure</span>
			<span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$zip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Making the call</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$files_to_zip</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'path/image1.jpg'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'image2.jpg'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$destination</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getcwd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/files/filename.zip'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createZipFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$files_to_zip</span><span style="color: #339933;">,</span> <span style="color: #000088;">$destination</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/S5X9BcHWF0E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/create-a-zip-file-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/create-a-zip-file-using-php/</feedburner:origLink></item>
		<item>
		<title>Zend, Magento and WordPress – working together</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/W-T1dvBBZMs/</link>
		<comments>http://www.douglasradburn.co.uk/zend-magento-and-wordpress-working-together/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 16:06:15 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bespoke]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=636</guid>
		<description><![CDATA[I recently wanted to integrate WordPress, Magento and a bespoke Zend application to work together. For the main part, this was easy. I put the Magento installation into a seperate folder, and the WordPress folder into a seperate and then &#8230;]]></description>
			<content:encoded><![CDATA[<p>I recently wanted to integrate WordPress, Magento and a bespoke Zend application to work together.</p>
<p>For the main part, this was easy.  I put the Magento installation into a seperate folder, and the WordPress folder into a seperate and then wrapped the lot in a Zend Application.</p>
<p>The <code>.htaccess</code> file looked much like any usual Zend Application.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">RewriteEngine on
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>REQUEST_FILENAME<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!-</span>f
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>REQUEST_FILENAME<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!-</span>l
RewriteRule ^<span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span>$ zendApp<span style="color: #339933;">/</span><span style="color: #000000; font-weight: bold;">public</span><span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php <span style="color: #009900;">&#91;</span>NC<span style="color: #339933;">,</span>L<span style="color: #009900;">&#93;</span></pre></div></div>

<p>This sits at the main httpdocs level, knowing that the application <code>.htaccess</code> files would pick up for their tasks.</p>
<p>That&#8217;s pretty much it.  Unless you want to use sessions.</p>
<p>The main issue here, is sharing the Magento session.  It likes to store session information in its own folder.  Whereas PHP would usually store session information in something like <code>/tmp/</code>, Magento stores it in it&#8217;s application directory <code>/var/session/</code>.</p>
<p>In order to grab session information within the Zend app for example, we need something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Initialise the Autoloader
* 
* @access protected
* @return void 
*/</span>
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _initAutoloader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">/*
     * Set up the session handler / save path to be the same as Magento
     * so that they can share session data
     */</span>
&nbsp;
    <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;session.save_handler&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;files&quot;</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;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'frontend'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_COOKIE</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;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'frontend'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'frontend'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$sessionOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'save_path'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">getcwd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../../var/session&quot;</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: #339933;">!</span>Zend_Session<span style="color: #339933;">::</span><span style="color: #004000;">isStarted</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>
            Zend_Session<span style="color: #339933;">::</span><span style="color: #004000;">setOptions</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sessionOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            Zend_Session<span style="color: #339933;">::</span><span style="color: #004000;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #339933;">...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This causes Zend to use the same directory as Magento, and also merges the session data with Magento at the same time by merging with the <code>$_COOKIE</code>.  We put this code in the bootstrap to make sure it&#8217;s set early on and doesn&#8217;t interfere with anything within Zend, and we make Zend do the work so that we don&#8217;t interfere with anything Magento is offering.</p>
<p>I&#8217;ll be putting up a longer post, with details on how to integrate with WordPress on the <a href="http://www.branded3.com">Branded3.com</a> blog soon!</p>
<p>Edit: This post is now up! View it here <a href="http://www.branded3.com/b3labs/zend-framework-magento-and-wordpress-sitting-in-a-tree/">http://www.branded3.com/b3labs/zend-framework-magento-and-wordpress-sitting-in-a-tree/</a></p>
<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/W-T1dvBBZMs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/zend-magento-and-wordpress-working-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/zend-magento-and-wordpress-working-together/</feedburner:origLink></item>
		<item>
		<title>Magento – Getting a custom image type in your view</title>
		<link>http://feedproxy.google.com/~r/DouglasRadburn/~3/KsX4NAjnKrk/</link>
		<comments>http://www.douglasradburn.co.uk/magento-getting-a-custom-image-type-in-your-view/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 15:24:31 +0000</pubDate>
		<dc:creator>Douglas Radburn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bespoke]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.douglasradburn.co.uk/?p=628</guid>
		<description><![CDATA[Every now and then, you might end up with a custom image type in your Magento store. Maybe the initial ones don&#8217;t allow enough flexibilty or you need to show a specific image somewhere about som aspect of your product? &#8230;]]></description>
			<content:encoded><![CDATA[<p>Every now and then, you might end up with a custom image type in your Magento store.  Maybe the initial ones don&#8217;t allow enough flexibilty or you need to show a specific image somewhere about som aspect of your product?</p>
<p>I had this exact issue recently where I needed to store a colour swatch for a product and load it on a specific page.</p>
<p>The code for this is actually nice and straight forward:</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: #000088;">$_helper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">productAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$child</span><span style="color: #339933;">,</span> <span style="color: #000088;">$child</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getColourSwatch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'colour_swatch'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'no_selection'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-/&gt;</span>helper<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog/image'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$child</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'colour_swatch'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resize</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">163</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/DouglasRadburn/~4/KsX4NAjnKrk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.douglasradburn.co.uk/magento-getting-a-custom-image-type-in-your-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.douglasradburn.co.uk/magento-getting-a-custom-image-type-in-your-view/</feedburner:origLink></item>
		<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>
		<category><![CDATA[checkout]]></category>
		<category><![CDATA[free shipping]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[success]]></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>
<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>

<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>
<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>
	</channel>
</rss>

