<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Smullin &#187; Magento</title>
	<atom:link href="http://www.mikesmullin.com/tag/magento/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikesmullin.com</link>
	<description>Personal Blog</description>
	<lastBuildDate>Fri, 30 Sep 2011 23:21:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Use Categories in Product URLs for Magento SEO without Duplicate Content</title>
		<link>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/</link>
		<comments>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 03:51:07 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Patch]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=319</guid>
		<description><![CDATA[Magento provides the option to use categories in your product URLs for the search engine optimization benefits it brings, but they&#8217;ve implemented it in a very unusual way. Basically, if you enable this option, you&#8217;ll end up with at least 4 URLs per product. Once people realize it, this often raises a number of concerns [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento1.png" alt="Magento Open Source eCommerce logo" title="Magento Open Source eCommerce logo" width="150" height="150" class="alignright size-full wp-image-133" /> Magento provides the option to use categories in your product URLs for the search engine optimization benefits it brings, but they&#8217;ve implemented it in a very unusual way. Basically, if you enable this option, you&#8217;ll end up with at least 4 URLs per product. Once people realize it, this often raises a number of concerns including possible duplicate content penalty from Google, fractured link juice for product pages, frustrated admins, etc.</p>
<p>With <a href="http://www.magento.cn/104/magento-shopping-cart/magento-seo-friendly-urls/">so</a> <a href="http://www.magentocommerce.com/boards/viewthread/33562/">many</a> <a href="http://www.hostingcoupons.org/magento-use-category-path-for-product-url-issues/">people</a> <a href="http://www.virtueseo.com/seo-blog/2008/08/25/magento-seo-duplicate-content-threat/">also</a> <a href="http://www.magentocommerce.com/boards/viewforum/81/">searching</a> <a href="http://www.magentocommerce.com/boards/viewthread/3008/">for a clever</a> <a href="http://www.magentocommerce.com/boards/viewthread/6002/">solution</a>, I decided disabling the feature was an unacceptable solution, and took the challenge.</p>
<p><span id="more-319"></span></p>
<p>First you have to enable the <a href="http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/chapter_3#search_engine_optimizations">&#8220;Use categories path for product URLs&#8221;</a> feature under <strong>System</strong> > <strong>Configuration</strong> > <strong>Catalog</strong> > <strong>Search Engine Optimization</strong>.</p>
<blockquote><p>
Use categories path for product URLs &#8211; This determines how the <acronym title="Uniform Resource Locator">URL</acronym> Rewrites autogenerate. If you choose Yes, the <acronym title="Uniform Resource Locator">URL</acronym> rewrite for products will include the associated category, and a separate rewrite will generate for each associated category. If you choose No, the <acronym title="Uniform Resource Locator">URL</acronym> Rewrites will include only the product name, and there will be only one rewrite, regardless of how many categories the product is associated to.
</p></blockquote>
<p>Once this feature is enabled, you&#8217;ll be to use any of these URLs to visit the same product page:</p>
<ul>
<li>
<p><strong>/catalog/product/view/id/&lt;product_id&gt;</strong><br />
	    <small>example: http://www.domain.tld/catalog/product/view/id/6</small><br />
      Internal to Magento; never actually exposed.</p>
</li>
<li>
<p><strong>/catalog/product/view/id/&lt;product_id&gt;/category/&lt;category_id&gt;</strong><br />
	    <small>example: http://www.domain.tld/catalog/product/view/id/6/category/10</small><br />
      Internal to Magento; never actually exposed.</p>
</li>
<li>
<p><strong>/name-of-product</strong><br />
	    <small>example: http://www.domain.tld/super-dee-duper-tent-1000-olive</small><br />
      Normally used on the front page, in content blocks, or anywhere other than a category page. This is because without being on a category page, Magento doesn&#8217;t know which category would be appropriate to display in the <acronym title="Uniform Resource Locator">URL</acronym> (since it provides the ability to have multiple categories per product). Therefore it opts to not display any category at all. A bad decision in my opinion.</p>
</li>
<li>
<p><strong>/category-1/sub-category-1/name-of-product</strong><br />
	    <small>example: http://www.domain.tld/sporting-goods/camping-hiking/super-dee-duper-tent-1000-olive</small><br />
      Used from category pages.</p>
</li>
<li>
<p><strong>/category-2/name-of-product</strong><br />
	    <small>example: http://www.domain.tld/affordable-housing/super-dee-duper-tent-1000-olive</small><br />
      Used from category pages.</p>
</li>
<li>
<p><strong>etc.</strong><br />
      Depending on how many categories per product.</p>
</li>
</ul>
<p>Personally, I don&#8217;t like my products having multiple URLs. Between the front page and the category pages, two separate URLs are introduced to GoogleBot as it crawls through the pages. Even though <a href="http://www.magentocommerce.com/boards/viewthread/18538/">you may not be seriously penalized for duplicate content</a>, which page do you want to appear in Google SERPs? Which one do you want your customers to link at? You&#8217;re splitting your link juice and causing confusion.</p>
<p>When I saw this feature for the first time, all I really expected was a single <acronym title="Uniform Resource Locator">URL</acronym> like:</p>
<p><strong>http://www.domain.tld/sporting-goods/camping-hiking/super-dee-duper-tent-1000-olive</strong></p>
<p>Well, it took about four hours to find, but I finally came up with a patch to Magento core that delivers this result. Check it out below in unified diff / patch file format:</p>
<pre><code>
Index: app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php	(revision 2102)
+++ app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php	(working copy)
@@ -553,7 +553,11 @@
                 ->from($this->getTable('core/url_rewrite'), array('product_id', 'request_path'))
                 ->where('store_id=?', Mage::app()->getStore()->getId())
                 ->where('is_system=?', 1)
-                ->where('category_id=? OR category_id is NULL', $this->_urlRewriteCategory)
+//                excluding this clause to facilitate one URL per product, and one that includes the category
+//                if a product has multiple categories, the first one (by category_id) will be used
+//                in most cases you'll probably only have one category because you only want one page per product for SEO reasons
+//                for maximum link juice, no possibility of duplicate content, and a less confusing store
+//                ->where('category_id=? OR category_id is NULL', $this->_urlRewriteCategory)
                 ->where('product_id IN(?)', $productIds)
                 ->order('category_id DESC'); // more priority is data with category id
             $urlRewrites = array();
</code></pre>
<p>In my setup, each product only has one category. Although this will also work if you specify multiple categories per product, you won&#8217;t have complete control over which category is used for the official link.</p>]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Automatically Sorting Magento Catalog Categories Alphabetically via MySQL</title>
		<link>http://www.mikesmullin.com/development/automatically-sorting-magento-catalog-categories-alphabetically-via-mysql/</link>
		<comments>http://www.mikesmullin.com/development/automatically-sorting-magento-catalog-categories-alphabetically-via-mysql/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 20:31:33 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Catalog Categories]]></category>
		<category><![CDATA[Dataflow]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Mysql Script]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=305</guid>
		<description><![CDATA[Beats me why this isn&#8217;t an option in Magento core back-end administration already. I have been using the core patch for Magento Dataflow which allows me to import categories with my products similar to the way Yahoo! eCommerce lets you do it. It makes things easy for importing but you end up with the categories [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento1.png" alt="Magento Open Source eCommerce logo" title="Magento Open Source eCommerce logo" width="150" height="150" class="alignright size-full wp-image-133" /> Beats me why this isn&#8217;t an option in Magento core back-end administration already. I have been using the <a href="http://www.magentocommerce.com/wiki/how_to_import_category_structure_with_products_using_dataflow">core patch for Magento Dataflow which allows me to import categories</a> with my products similar to the way <a href="http://smallbusiness.yahoo.com/ecommerce/">Yahoo! eCommerce</a> lets you do it. It makes things easy for importing but you end up with the categories appearing in the order they were specified in your .CSV file you imported, and not alphabetically as most customers would expect when browsing your product catalog from the front-end.</p>
<p>So, rather than manually attempting to reorder 68 categories across 3 levels one-by-one using the tools provided in the Magento back-end, I decided to write a simple MySQL script that would do it all for me automatically. Here it is, for anyone else who may be running into this problem.</p>
<p><span id="more-305"></span></p>
<p><strong>DISCLAIMER:</strong> This script is provided as-is with no warranty or support. It works for me on the latest version of Magento [as of this writing] which is v1.2.1.2, but not guaranteed to work forever. As always, it is strongly recommended to backup first and test this in a development environment before you attempt to apply it to your live server. You alone are responsible for any damages it may cause in your hands. Use at your own risk.</p>
<pre><code>
# adjusted order of categories
SET # init vars, set defaults
 @pos = 0,
 @last_parent = 0,
 @last_level = 0
;
DROP TABLE IF EXISTS cce_adjusted;
CREATE TEMPORARY TABLE cce_adjusted # output to temp table for review before commit
SELECT
 a.entity_id,
 a.level,
 a.parent_id,
 a.value,
 a.position,
 @pos := (IF((@last_parent != a.parent_id) OR (@last_level != a.level), 0, @pos) + 1) `new_position`,
 @last_level `last_level`,
 @last_parent `last_parent`,
 @last_level := CAST(a.level AS UNSIGNED) `new_last_level`,
 @last_parent := CAST(a.parent_id AS UNSIGNED) `new_last_parent`
FROM (
 SELECT
  cce.entity_id,
  cce.level,
  cce.parent_id,
  ccev.value,
  cce.position
 FROM catalog_category_entity cce
 INNER JOIN catalog_category_entity_varchar ccev
  ON cce.entity_id = ccev.entity_id
   AND ccev.store_id = 0 # Root Store
   AND ccev.attribute_id = 31 # Category Name
 ORDER BY cce.level, cce.parent_id, ccev.value
) a
;
SELECT * FROM cce_adjusted;

/*
# commit changes
UPDATE catalog_category_entity cce
INNER JOIN cce_adjusted a
 ON cce.entity_id = a.entity_id
SET cce.position = a.new_position
;
*/

/*
# current order of categories
SELECT
 cce.entity_id,
 cce.level,
 cce.position,
 cce.parent_id,
 ccev.value,
 1 `new_position`
FROM catalog_category_entity cce
INNER JOIN catalog_category_entity_varchar ccev
 ON cce.entity_id = ccev.entity_id
  AND ccev.store_id = 0 # Root Store
  AND ccev.attribute_id = 31 # Category Name
ORDER BY cce.level, IF(cce.level<3, cce.position, cce.parent_id), cce.position
*/
</code></pre>
<p>I like to save it as a .sql file and execute it in a MySQL <acronym title="Graphical User Interface">GUI</acronym> like <a href="http://www.webyog.com/en/">SQLYog</a> whenever I need, but I suppose it would also work from the CLI if you were applying it to your live server via <acronym title="Secure Shell">SSH</acronym>. The first section previews the changes. The middle section saves changes, and is commented out to prevent accidental changes. You would just uncomment the middle part to make it work. The last section that is commented-out is just for debugging, in case you need to make any changes to this script to get it to work with a customized/non-standard Magento configuration. Also, remember to reset your cache if you have it enabled after you apply this.</p>
<p>Drop me a comment if this script saved you time or you found it useful in any way. Maybe link at it if you think others may also find it useful. It's all that I ask! Keep the open-source spirit alive. Peace.</p>]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/automatically-sorting-magento-catalog-categories-alphabetically-via-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning to Design and Code for Magento Themes</title>
		<link>http://www.mikesmullin.com/development/learning-to-design-and-code-for-magento-themes/</link>
		<comments>http://www.mikesmullin.com/development/learning-to-design-and-code-for-magento-themes/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 22:32:55 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=234</guid>
		<description><![CDATA[First off, the first reaction I always hear when others are introduced to Magento [including myself] are complaints about how difficult it is. The truth is it is just as easy as what we&#8217;re all used to. I&#8217;m going to show you that today by drawing comparisons between Magento and some other popular open-source projects [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento1.png"><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento1.png" alt="Magento Open Source eCommerce logo" title="Magento Open Source eCommerce logo" width="150" height="150" class="alignright size-full wp-image-133" /></a>First off, the first reaction I always hear when others are introduced to Magento [including myself] are complaints about how difficult it is. The truth is it is just as easy as what we&#8217;re all used to. I&#8217;m going to show you that today by drawing comparisons between Magento and some other popular open-source projects we&#8217;re more familiar with such as <a href="http://drupal.org/">Drupal</a> and <a href="http://wordpress.org/">WordPress</a>.</p>
<p>This guide is meant to be a quick-start supplement for the official <a href="http://www.magentocommerce.com/design_guide">Magento Design Guide</a>, and not a replacement for it. It assumes you are already familiar with and have completed themes for Drupal and/or WordPress.</p>
<p><span id="more-234"></span></p>
<h3>Introduction: Working with Magento</h3>
<p>The first thing you&#8217;ll notice about Magento is its size: 15.7MB zipped, and 58.8MB unpacked: 7,231 files across 2,482 folders (as of Magento 1.2.0.1). This may be one of the largest web applications you&#8217;ve worked with&#8211;and not only you, but your <acronym title="Integrated Development Environment">IDE</acronym>, too. Don&#8217;t even think about letting Notepad++, UltraEdit, Textpad, or one of those programs touch this baby. The &#8220;<a href="http://web.archive.org/web/20080117072823/http://www.madewithnotepad.com/">Made with Notepad</a>&#8221; days are long gone, man. Get yourself a decent <acronym title="Integrated Development Environment">IDE</acronym>. I even <a href="http://www.mikesmullin.com/development/magento-crashing-apache-on-winxp-xampp-with-pdo-enabled/">had to upgrade</a> my <a href="http://www.eclipse.org/pdt/">Eclipse <acronym title="Integrated Development Environment">IDE</acronym></a> to <a href="http://www.eclipse.org/pdt/downloads/">2.1.0M5 &#8220;Galileo&#8221;</a> and <a href="http://www.mikesmullin.com/development/magento-crashing-apache-on-winxp-xampp-with-pdo-enabled/">switch my <acronym title="Pre-Hypertext Processing">PHP</acronym> stack</a> to <a href="http://www.zend.com/products/core/">Zend Core</a> <a href="http://www.zend.com/en/products/core/downloads">2.5</a> just to handle Magento without slowness and crashing.</p>
<p>The second thing you&#8217;ll notice is that it&#8217;s fully object-oriented with PHP5, and if there seems to be no rhyme or reason to the directory hierarchy, you may also need to <a href="http://framework.zend.com/docs/quickstart">take some time to introduce yourself</a> to <a href="http://framework.zend.com/">Zend Framework</a> for <acronym title="Pre-Hypertext Processing">PHP</acronym>. What&#8217;s really happening here is <a href="http://www.varien.com/">Varien</a> is using architectural and design patterns you&#8217;ve probably seen before but never fully understood such as <a href="http://en.wikipedia.org/wiki/Model-view-controller">Model View Controller (MVC)</a>, the <a href="http://www.martinfowler.com/eaaCatalog/frontController.html">Front Controller</a> pattern implemented by <a href="http://zendframework.com/manual/en/zend.controller.html#zend.controller.quickstart">Zend_Controller</a> object, the <a href="http://www.martinfowler.com/eaaCatalog/twoStepView.html">Two Step View</a> pattern, the <a href="http://www.martinfowler.com/eaaCatalog/applicationController.html">Application Controller</a> pattern, etc. </p>
<p>Later when you begin writing Magento extensions, you&#8217;ll also notice you don&#8217;t have to write any <acronym title="Structured Query Language">SQL</acronym> anymore because <a href="http://zendframework.com/manual/en/zend.db.html#zend.db.adapter">Zend_Db</a> implements the <a href="http://www.martinfowler.com/eaaCatalog/dataMapper.html">Data Mapper</a> pattern.</p>
<p>So for now bookmark the <a href="http://zendframework.com/manual/en/">Zend Framework Reference Guide</a>, <a href="http://www.magentocommerce.com/design_guide">Designer&#8217;s Guide to Magento</a>, <a href="http://docs.magentocommerce.com/">Magento Documentation</a>, and lets get started.</p>
<h3>Getting Started: Jump-start with pre-existing Blank Theme</h3>
<p>The first thing I would do is download the <a href="http://www.magentocommerce.com/extension/518/blank-theme">Blank Theme</a> from <a href="http://www.magentocommerce.com/magento-connect">Magento Connect</a>; it&#8217;s a good blank canvas starting point for theme developers. As I recall, the Drupal community also had one of these&#8211;it was called <a href="http://drupal.org/project/zen">Zen</a> by John Wilkins. In WordPress I suppose it is the equivalent to the <a href="http://binarybonsai.com/wordpress/kubrick/">Kubrick</a> theme by Michael Heilemann. If you are building your own standards-compliant theme, you will find it much easier to start with Blank Theme than to start with the default <a href="http://www.scottrageous.net/tealo/">Tealo</a> theme packaged with Magento core. This theme is also well commented.</p>
<p>Before we go any further, I want to emphasize that one primary difference you&#8217;ll realize with Magento is that there are many many pages you or your client may decide to potentially theme individually. (e.g. front page (2 col), catalog pages (3 col), product pages (2 col), about pages (1 col), my cart, checkout&#8211;even the email templates are individually themed) Not only that, but there are over 270 unique <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> template files as well as the <acronym title="Cascading Style Sheets">CSS</acronym> for each content block (e.g. my cart, compare products, newsletter, advertisements, etc.) which come with the stock installation of Magento. </p>
<p>So when quoting you have to take into consideration just how far you&#8217;re planning on deviating from the Magento defaults because it could potentially take you a considerable amount of time to customize all these things. In most cases, though, clients only want to pay to have up to five unique pages designed, so it&#8217;s no biggie to reuse a lot of the default code on the rest of the pages. By starting with the Blank Theme, we already have all of the base <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> we&#8217;re going to need, and all we have to do is write the code to override it and <em>only where change is required</em>.</p>
<h3>Terminology: Identifying the different LEGO&trade; pieces</h3>
<p>So the <a href="http://www.magentocommerce.com/design_guide">Magento Design Guide</a> does a pretty good job of explaining this but I want to draw some comparisons using proportional analogies. (i.e. &#8220;<em>A</em> in Magento is to <em>B</em> in Drupal and <em>C</em> in WordPress&#8221;)</p>
<ul>
<li>
<p>A &#8220;<strong>Theme</strong>&#8221; in Magento is just like any theme in Drupal or WordPress, with two exceptions. One, the front-end and back-end of Magento are treated as separate themes. And two, for security reasons each theme is split into a <em>public</em> directory (e.g. css, js, images, and index.php <a href="http://martinfowler.com/eaaCatalog/frontController.html">front controller</a>) and <em>private</em> directory (e.g. all .php files including <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> templates which are saved as .phtml files).</p>
</li>
<li>
<p>&#8220;<strong>Structural Blocks</strong>&#8221; in Magento are known as <em>regions</em> in Drupal, and similar to <em>sidebars</em> in WordPress.</p>
</li>
<li>
<p>&#8220;<strong>Content Blocks</strong>&#8221; in Magento are just called <em>blocks</em> in Drupal, and <em>widgets</em> in WordPress. However, unlike Drupal and WordPress, they cannot yet be positioned on the page using simple JavaScript drag-and-drop techniques. They can&#8217;t even be specified with weights like in Drupal 5. They are specified only in .XML <strong>layout</strong> files, which are part of your theme, and can optionally be assigned an <em>order</em> which is an integer but are otherwise displayed in the order that the .XML files are included. However, unlike Drupal and WordPress where blocks and widgets would normally be relegated to only sidebars and you cannot control the position of the actual content, in Magento, content blocks are used for everything. For example, to render the <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> for individual products, comparable in Drupal to <em>nodes</em>, or in WordPress to <em>posts</em> and <em>pages</em>.</p>
</li>
<li>
<p>&#8220;<strong>Layouts</strong>&#8221; in Magento have no equivalent in Drupal or WordPress. It&#8217;s a relatively clever concept. There are also some other clever concepts involved like overriding of template files that I won&#8217;t go into here but are explained in the design guide. You won&#8217;t need to worry about that much, if at all, to complete this theme.</p>
</li>
<li>
<p>&#8220;<strong>Templates</strong>&#8221; in Magento are the individual <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> files and they are saved with a <em>.phtml</em> extension inside the <em>./app/design/frontend/default/YOUR_THEME/template/page/</em> directory. In Drupal these files end with <em>.tpl.php</em> and are saved in <em>./sites/all/themes/YOUR_THEME/</em>, and in WordPress these files end with good old <em>.php</em> and are saved in <em>./wp-content/themes/YOUR_THEME/</em>. These are the files containing <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> markup for pages, including header, footer, as well as individual content blocks.</p>
</li>
</ul>
<p>Ok, great. Now that you are acclimated to the terminology most people will be using as you read further into the subject, let&#8217;s move on.</p>
<h3>Touring the Directory Structure: What goes where?</h3>
<p>Now I am going to take you on an overview of the Magento directory structure, highlighting only the files you need to be concerned about along the way to complete your first theme. Feel free to find these files and directories in your own Magento installation and follow along with me as I explain what each file is for.</p>
<pre><code>
./app/ - private dir
  design/
    frontend/
      default/ - interface (worry about later)
        YOUR_THEME/
          layout/ - .XML here control which content blocks appear and in what order
            <strong>page.xml</strong> - content blocks that appear on all pages
          template/
            page/
              html/
                <strong>head.phtml</strong> - DOCTYPE &#038; &lt;HEAD&gt; tag
                <strong>header.phtml</strong> - page header incl. logo
                <strong>footer.phtml</strong> - page footer
              <strong>1column.phtml</strong> - e.g. about page
              <strong>2columns-left.phtml</strong>
              <strong>2columns-right.phtml</strong> - e.g. product page
              <strong>3columns.phtml</strong> - e.g. catalog page

./skin/ - public dir
  frontend/
    default/ - interface (worry about later)
      YOUR_THEME/
        css/
          <strong>styles.css</strong> - screen styles
          <strong>print.css</strong> - print styles
          <strong>reset.css</strong> - <acronym title="Cascading Style Sheets">CSS</acronym> reset
          <strong>clears.css</strong> - .clear { clear:both }
          <strong>styles-ie.css</strong> - ie-only styles
        images/
        js/
        <strong>favicon.ico</strong>
</code></pre>
<p>I think the way I have presented it to you here, if you have ever completed a theme for WordPress or Drupal before, you will immediately recognize these files and be well on your way. By making changes to these <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> files alone you will have drastic control over 90% of the theme.</p>
<h3>Enabling Magento Debugging Tools</h3>
<p>Of course, there are more files than this that make a theme. Sometimes you will wonder what file controls a specific content block when you want to edit its <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> template. For that you will want to know about this handy developer tool provided with Magento. </p>
<p>Here it is step-by-step:</p>
<ol>
<li>Login to back-end &gt; <strong>System</strong> &gt; <strong>Configuration</strong></li>
<li>Choose your store from the &#8220;<strong>Current Configuration Scope</strong>&#8221; drop-down menu on the top-left</li>
<li>Continue navigating to <strong>Advanced</strong> &gt; <strong>Developer</strong></li>
<li>Open the <strong>Debug</strong> drawer</li>
<li>Uncheck &#8220;<strong>Use website</strong>&#8221; for &#8220;<strong>Template Path Hints</strong>&#8221; and set its drop-down to &#8220;<strong>Yes</strong>&#8220;</li>
<li>Uncheck &#8220;<strong>Use website</strong>&#8221; for &#8220;<strong>Add Block Names to Hints</strong>&#8221; and set its drop-down to &#8220;<strong>Yes</strong>&#8220;</li>
<li>Click the <strong>Save Config</strong> button and refresh the front page</li>
</ol>
<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/step-by-step.gif" alt="Step-by-step walkthrough of instructions" title="Step-by-step walkthrough of instructions" width="565" height="308" class="aligncenter size-full wp-image-300" /></p>
<p>This will display the location of the .phtml template at the top of each content block. It does come in handy.</p>
<h3>To Be Continued</h3>
<p>While there are more advanced subtleties, nuances, and quirks you will undoubtedly encounter as you complete more and more themes for the Magento e-Commerce platform, this is the meat and potatoes. Should you run into any question not answered here, I find that the <a href="http://www.magentocommerce.com/boards">Magento Forum</a>, <a href="http://www.magentocommerce.com/wiki/">Magento Wiki</a>, and <a href="http://www.magentocommerce.com/chat">#magento on irc.freenode.net</a>, as well as a fair amount of Googling can turn up those answers with relative ease. </p>
<p>Please feel free to drop me a note in the comments if this tutorial saved you some time, or if you&#8217;d like to point out anything I may have missed or any necessary corrections to be made. Otherwise, thanks for visiting and good luck on your theme!</p>
<h3>Bonus</h3>
<p>I recently completed a Magento theme of my own and it took me about 40 hours to do, work which includes the creative time for custom artwork. All-in-all, it turned out excellent and I am very proud. Check it out:</p>
<div id="attachment_239" class="wp-caption alignleft" style="width: 160px"><a href="http://www.mikesmullin.com/wp-content/uploads/2009/02/home-the-smullin-supply-company-2.png"><img class="size-thumbnail wp-image-239" title="Screenshot of front page" src="http://www.mikesmullin.com/wp-content/uploads/2009/02/home-the-smullin-supply-company-2-150x150.png" alt="Screenshot of front page" width="150" height="150" /></a><p class="wp-caption-text">Front page</p></div>
<div id="attachment_243" class="wp-caption alignleft" style="width: 160px"><a href="http://www.mikesmullin.com/wp-content/uploads/2009/02/public-safety-the-smullin-supply-company.png"><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/public-safety-the-smullin-supply-company-150x150.png" alt="Screenshot of product catalog" title="Screenshot of product catalog" width="150" height="150" class="size-thumbnail wp-image-243" /></a><p class="wp-caption-text">Product Catalog</p></div>
<div id="attachment_244" class="wp-caption alignleft" style="width: 160px"><a href="http://www.mikesmullin.com/wp-content/uploads/2009/02/hellfighter-lights-hellfighter-x-8-flashlight-doh247-handheld-lighting-the-smullin-supply-company.png"><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/hellfighter-lights-hellfighter-x-8-flashlight-doh247-handheld-lighting-the-smullin-supply-company-150x150.png" alt="Screenshot of product page" title="Screenshot of product page" width="150" height="150" class="size-thumbnail wp-image-244" /></a><p class="wp-caption-text">Product Page</p></div>
<div class="clear"></div>
<p>Also, I have posted an in-depth case study explaining most everything that went into the project, should you be interested in reading further:</p>
<p><a href="http://www.smullindesign.com/clients/case-studies/smullin-supply">Magento case study at Smullin Design</a></p>
<p>Thanks again!</p>]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/learning-to-design-and-code-for-magento-themes/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Magento Crashing Apache on WinXP XAMPP with PDO Enabled</title>
		<link>http://www.mikesmullin.com/development/magento-crashing-apache-on-winxp-xampp-with-pdo-enabled/</link>
		<comments>http://www.mikesmullin.com/development/magento-crashing-apache-on-winxp-xampp-with-pdo-enabled/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 23:00:15 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[XAMPP]]></category>
		<category><![CDATA[Zend Core]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=132</guid>
		<description><![CDATA[Very frustrating! With XAMPP Lite 1.6.8 on Windows XP SP3, I could get Magento 1.2.0.1 to work but Apache would crash randomly every 3-5 minutes triggered by new page loads or refreshes. Upgrading to Magento 1.2.0.2 and then 1.2.1 didn&#8217;t help. Upgrading to XAMPP Lite 1.7.0 made it worse because Apache would crash on every [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento1.png" alt="Magento Open Source eCommerce logo" title="Magento Open Source eCommerce logo" width="150" height="150" class="alignright size-full wp-image-133" />Very frustrating! With <acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym> Lite 1.6.8 on Windows XP <acronym title="Service Pack 3">SP3</acronym>, I could get Magento 1.2.0.1 to work but Apache would crash randomly every 3-5 minutes triggered by new page loads or refreshes. Upgrading to Magento 1.2.0.2 and then 1.2.1 didn&#8217;t help. Upgrading to <acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym> Lite 1.7.0 made it worse because <a href="http://www.magentocommerce.com/boards/viewthread/26644/">Apache would crash on <em>every</em> page load</a>, finally making it impossible to work with. That&#8217;s when I realized these types of problems were <a href="http://www.magentocommerce.com/wiki/general/installing_on_windows_with_xampp_and_wamp">known issues</a> between Magento <a href="http://www.apachefriends.org/f/viewtopic.php?f=16&#038;t=32507&#038;start=0&#038;sid=a3789ca590747f394668fa0fb24da946">and <acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym></a>.</p>
<p><span id="more-132"></span></p>
<p>No offense to <a href="http://www.apachefriends.org/en/team.html">Apache Friends</a> because I love <a href="http://www.apachefriends.org/en/xampp.html"><acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym></a> and have been using it for years. Something bigger is definitely going on here, because my <a href="http://www.eclipse.org/pdt/">Eclipse PDT</a> 3.2 <a href="http://activecodeline.com/what-makes-magento-so-hard-to-learn/"><acronym title="Integrated Development Environment">IDE</acronym> was having trouble with Magento</a>, too. Contrary to what you might think, from what I&#8217;ve read it looks like it&#8217;s actually <a href="http://www.zend.com/en/">Zend&#8217;s</a> fault; specifically, the <a href="http://framework.zend.com/">Zend Framework</a> has revolutionized the way <acronym title="Pre-Hypertext Processing">PHP</acronym> programmers think and the way PHP5 web applications are written. Truly object-oriented! Imagine that. Even the highly acclaimed <a href="http://drupal.org/">Drupal</a> project [which I also love, don't get me wrong] is still 99.9% procedural programming. Eclipse was fine with these, but now you need the new <a href="http://www.eclipse.org/ganymede/">Ganymede release</a> to ride with <acronym title="Zend Framework">ZF</acronym> and Magento.</p>
<p>So in a way this unexpected behavior now between Magento and <acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym> is self-serving because, if you research the problem, the solution recommended <a href="http://www.magentocommerce.com/boards/viewthread/26860/">just about everywhere</a> is to <a href="http://www.mikesmullin.com/development/introducing-zend-core-php-stack-for-windows/">download Zend Core as an alternative to <acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym></a>.</p>
<p>Well <acronym title="(Windows, Linux, Mac OS/X, or Solaris), Apache, MySQL, PHP, and Perl">XAMPP</acronym>, my friend, it was fun while it lasted, but the cards are stacked against you now. It has been days since I made the switch and Magento hasn&#8217;t crashed at all. <em>Not even once!</em> So, if you&#8217;re having the same problem as I was, just save yourself some time and try <a href="http://www.zend.com/products/core/">Zend Core</a>. You&#8217;ll thank yourself later.</p>]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/magento-crashing-apache-on-winxp-xampp-with-pdo-enabled/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Introducing Magento eCommerce Platform</title>
		<link>http://www.mikesmullin.com/development/introducing-magento-ecommerce-platform/</link>
		<comments>http://www.mikesmullin.com/development/introducing-magento-ecommerce-platform/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 06:23:24 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=90</guid>
		<description><![CDATA[For anyone who doesn&#8217;t know, Magento is a new open-source e-commerce platform first stable released Q3 2008 using the PHP5 Zend Framework. What is amazing about this platform is in less than one year it has rocketed to the top of Google search volume trends closely rivaling&#8212;and soon to overtake&#8212;the long-time osCommerce project. Today the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento.png" alt="Magento" title="Magento" width="150" height="150" class="alignright size-full wp-image-99" />For anyone who doesn&#8217;t know, <a href="http://www.magentocommerce.com/">Magento</a> is a new open-source e-commerce platform first stable <a href="http://www.magentocommerce.com/download/release_notes">released</a> Q3 2008 using the PHP5 <a href="http://framework.zend.com/">Zend Framework</a>. What is amazing about this platform is in less than one year it has <a href="http://www.google.com/trends?q=magento%2C+oscommerce%2C+zen+cart">rocketed to the top of Google search volume trends</a> closely rivaling&#8212;and soon to overtake&#8212;the long-time osCommerce project. Today the project is supported by <a href="http://www.varien.com/">Varien</a>, an Open Source eCommerce software development and consulting firm who started the project, and an ever-growing <a href="http://www.magentocommerce.com/boards">community</a> of over 68,000 users and developers.</p>
<p><span id="more-90"></span></p>
<p>To give you a brief overview of the timeline so far: In July, <a href="http://www.magentocommerce.com/blog/comments/magento-wins-best-new-open-source-project/">Magento was awarded &#8220;Best New Open Source Project&#8221;</a> by the <a href="http://sourceforge.net/community/the-community-choice-awards-winners/">2008 SourceForge.net Community Choice Awards</a>. In August, <a href="http://www.magentocommerce.com/blog/comments/magento-wins-best-of-open-source-enterprise-applications/">Magento was awarded &#8220;Best of Open Source Enterprise Applications&#8221;</a> by the <a href="http://www.infoworld.com/archives/t.jsp?N=s&amp;V=107881">2008 InfoWorld.com BOSSIE Awards</a>. This year <a title="Forrester Research" href="http://www.forrester.com/">Forrester Research</a>, the leading technology and market research firm, named <a title="Magento" href="http://www.magentocommerce.com/">Magento</a> as an &#8220;Emerging Player To Watch&#8221; in its <a href="http://www.forrester.com/Research/Document/Excerpt/0,7211,53651,00.html">Forrester Wave™: B2C eCommerce Platforms Report, Q1 2009</a>. The growth has just been incredible! Check out the <a href="http://www.magentocommerce.com/blog">blog</a> for a full in-depth history.</p>
<p>Personally, I have been using this platform for a little over 4 months now (running version 1.2.1 as of this writing) and can&#8217;t say enough good things about it. The feature-set is truly an amazing combination of technology. If I had one complaint, I wish there were more <a href="http://www.magentocommerce.com/knowledge-base">documentation</a>, and more <a href="http://www.magentocommerce.com/magento-connect">extensions</a>, but it&#8217;s still pretty early for all that and I know the community is actively working on this with the <a href="http://www.magentocommerce.com/wiki/">wiki</a>, <a href="http://www.magentocommerce.com/media/screencasts">screencasts</a>, <a href="http://docs.magentocommerce.com/">phpdocs</a>, etc. If there is ever anything you can&#8217;t find there, I have always found supportive folks in the <a href="http://www.magentocommerce.com/chat">#magento chatroom</a> on irc.freenode.net.</p>
<p>Check out their <a href="http://www.magentocommerce.com/demo">store demo</a> and in the meantime stay tuned for updates, Q&amp;A, tips, tricks, and hacks as I continue benefiting from and contributing back to the platform.</p>]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/introducing-magento-ecommerce-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

