<?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>mage-page</title>
	<atom:link href="http://mage-page.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://mage-page.net</link>
	<description>Daily Magento articles from around the web</description>
	<lastBuildDate>Wed, 15 May 2013 18:30:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Long Running Admin Page Requests Blocking Other Requests</title>
		<link>http://mage-page.net/2013/05/long-running-admin-page-requests-blocking-other-requests/</link>
		<comments>http://mage-page.net/2013/05/long-running-admin-page-requests-blocking-other-requests/#comments</comments>
		<pubDate>Wed, 15 May 2013 18:30:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/05/long-running-admin-page-requests-blocking-other-requests/</guid>
		<description><![CDATA[<a href="http://magento.stackexchange.com/questions/3720/long-running-admin-page-requests-blocking-other-requests">Long Running Admin Page Requests Blocking Other Requests</a>: <p>The dark art of PHP session management.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://magento.stackexchange.com/questions/3720/long-running-admin-page-requests-blocking-other-requests">Long Running Admin Page Requests Blocking Other Requests</a>:
<p>The dark art of PHP session management.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/05/long-running-admin-page-requests-blocking-other-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Connect Bookmarklet</title>
		<link>http://mage-page.net/2013/05/magento-connect-bookmarklet/</link>
		<comments>http://mage-page.net/2013/05/magento-connect-bookmarklet/#comments</comments>
		<pubDate>Mon, 13 May 2013 06:42:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/05/magento-connect-bookmarklet/</guid>
		<description><![CDATA[<p>Stop me if this sounds familiar.</p>

<ol><li><p>Hey look, a Magento Connect extension, let&#8217;s try it out</p></li>
<li><p>Oh, right, I need to be logged in to get the extension key</p></li>
<li><p>Where&#8217;s that password again? [knocks over pills]</p></li>
<li><p>Waiting for Magento site to log me in</p></li>
<li><p>[Still waiting]</p></li>
</ol><p>There are, of course (I assume), reasons for Magento to force a sign-in before letting you grab a free extension key. That said, four plus years (!) in it&#8217;s still one of the things that annoys me about the platform.  <a href="http://alanstorm.com/bookmarklet-magentoconnect.html">So here&#8217;s a bookmarklet</a> that&#8217;ll extract the Connect 2.0 key from an extension page, even if you&#8217;re not logged in.</p>

<p>Visit <a href="http://alanstorm.com/bookmarklet-magentoconnect.html">the bookmarklet landing page</a>, drag the <code>Connect Key</code> link to your bookmarks bar, click on it while ...]]></description>
				<content:encoded><![CDATA[<p>Stop me if this sounds familiar.</p>
<ol>
<li>
<p>Hey look, a Magento Connect extension, let&#8217;s try it out</p>
</li>
<li>
<p>Oh, right, I need to be logged in to get the extension key</p>
</li>
<li>
<p>Where&#8217;s that password again? [knocks over pills]</p>
</li>
<li>
<p>Waiting for Magento site to log me in</p>
</li>
<li>
<p>[Still waiting]</p>
</li>
</ol>
<p>There are, of course (I assume), reasons for Magento to force a sign-in before letting you grab a free extension key. That said, four plus years (!) in it&#8217;s still one of the things that annoys me about the platform.  <a href="http://alanstorm.com/bookmarklet-magentoconnect.html">So here&#8217;s a bookmarklet</a> that&#8217;ll extract the Connect 2.0 key from an extension page, even if you&#8217;re not logged in.</p>
<p>Visit <a href="http://alanstorm.com/bookmarklet-magentoconnect.html">the bookmarklet landing page</a>, drag the <code>Connect Key</code> link to your bookmarks bar, click on it while you&#8217;re looking at  a Magento Connect page, and a text field with a link will be appended at the top of the page.  Tested in Chrome/OS X, should work elsewhere, bug reports welcome  Your millage mary very, PROVIDED &#8220;AS IS&#8221;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/05/magento-connect-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento CSRF Protection</title>
		<link>http://mage-page.net/2013/05/magento-csrf-protection/</link>
		<comments>http://mage-page.net/2013/05/magento-csrf-protection/#comments</comments>
		<pubDate>Fri, 10 May 2013 21:04:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/05/magento-csrf-protection/</guid>
		<description><![CDATA[<p>Maybe if I write this down I&#8217;ll remember it.</p>

<p>You probably know all Magento admin console URLs need a nonce/key in the URL</p>

<pre><code><a href="http://magento.example.com/admin/catalog_product/edit/id/174/key/c4df66cd2118cb5422c9fb5eff7eq4f0/">http://magento.example.com/admin/catalog_product/edit/id/174/key/c4df66cd2118cb5422c9fb5eff7eq4f0/</a>
</code></pre>

<p>That&#8217;s why we use the <code>Mage::getModel('adminhtml/url')</code> model object to generate URLs.</p>

<p>What I always forget is any POST to Magento&#8217;s backend <strong>also</strong> needs a <code>form_key</code> variable.  Double the CSRF protection.  Without this a POST will be redirected to the dashboard.  You can generate a <code>form_key</code> with</p>

<pre><code>Mage::getSingleton('core/session')-&#62;getFormKey()
</code></pre>]]></description>
				<content:encoded><![CDATA[<p>Maybe if I write this down I&#8217;ll remember it.</p>
<p>You probably know all Magento admin console URLs need a nonce/key in the URL</p>
<pre><code><a href="http://magento.example.com/admin/catalog_product/edit/id/174/key/c4df66cd2118cb5422c9fb5eff7eq4f0/">http://magento.example.com/admin/catalog_product/edit/id/174/key/c4df66cd2118cb5422c9fb5eff7eq4f0/</a>
</code></pre>
<p>That&#8217;s why we use the <code>Mage::getModel('adminhtml/url')</code> model object to generate URLs.</p>
<p>What I always forget is any POST to Magento&#8217;s backend <strong>also</strong> needs a <code>form_key</code> variable.  Double the CSRF protection.  Without this a POST will be redirected to the dashboard.  You can generate a <code>form_key</code> with</p>
<pre><code>Mage::getSingleton('core/session')-&gt;getFormKey()
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/05/magento-csrf-protection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Creating Hello World</title>
		<link>http://mage-page.net/2013/05/n98-magerun-creating-hello-world/</link>
		<comments>http://mage-page.net/2013/05/n98-magerun-creating-hello-world/#comments</comments>
		<pubDate>Wed, 01 May 2013 23:35:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/05/n98-magerun-creating-hello-world/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>Now that <a href="http://magento-quickies.tumblr.com/post/49122097133/n98-magerun-development-environment">we&#8217;ve got a build environment up and running</a>, we can get to work creating our first <code>n98-magerun</code> command.  Our end goal for today is to add a <code>helloworld</code> command to <code>n98-magrun</code></p>

<pre><code>$ ./n98-magerun.phar list

//...

Available commands:
  helloworld                       Displays a Hello World message. (pedagogical
</code></pre>

<h2>Development Stub</h2>

<p>So far, all our examples have used the <code>n98-magerun.phar</code> bundled application. Therefore, our first step today is to run the application from <strong>source code</strong>. Every <code>phar</code> archive can have an optional &#8220;stub&#8221; file.  This file is meant ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>Now that <a href="http://magento-quickies.tumblr.com/post/49122097133/n98-magerun-development-environment">we&#8217;ve got a build environment up and running</a>, we can get to work creating our first <code>n98-magerun</code> command.  Our end goal for today is to add a <code>helloworld</code> command to <code>n98-magrun</code></p>
<pre><code>$ ./n98-magerun.phar list

//...

Available commands:
  helloworld                       Displays a Hello World message. (pedagogical
</code></pre>
<h2>Development Stub</h2>
<p>So far, all our examples have used the <code>n98-magerun.phar</code> bundled application. Therefore, our first step today is to run the application from <strong>source code</strong>. Every <code>phar</code> archive can have an optional &#8220;stub&#8221; file.  This file is meant to encourage clean coding practices in your <code>phar</code> archive, with the stub acting as a main entry-point into your <code>phar</code> based application. Think of it like you would your <code>index.php</code> bootstrap file in a web application, or a <code>main</code> function in a <code>c</code> program.</p>
<p>The <code>n98-magerun.phar</code> bootstrap file is <code>_cli_stub.php</code>.  You might think we could run this ourselves. However, running</p>
<pre><code>$ php _cli_stub.php
</code></pre>
<p>will produce the error</p>
<pre><code>PHP Fatal error:  Uncaught exception 'PharException' with message 'internal corruption of phar
</code></pre>
<p>Let&#8217;s look at the contents of the <code>phar</code></p>
<pre><code>#!/usr/bin/env php
&lt;?php

Phar::mapPhar('n98-magerun.phar');

$application = require_once 'phar://n98-magerun.phar/src/bootstrap.php';
$application-&gt;setPharMode(true);
$application-&gt;run();

__HALT_COMPILER();
</code></pre>
<p>It turns out that <code>phar</code> stub files are meant to be used from <code>phar</code> archives only.  The call to <code>mapPhar</code>, the <code>require</code> using a <code>phar://</code> url scheme, and the <code>__HALT_COMPILER()</code> call all produce errors if used outside of a <code>phar</code> archive.</p>
<p>We&#8217;re going to need to create our own stub file.  In the root of your repository, create the following file with the following contents</p>
<pre><code>&lt;!-- File: dev-stub.php --&gt;
&lt;?php
$application = require_once realpath(dirname(__FILE__)) . '/src/bootstrap.php';
$application-&gt;setPharMode(false);
$application-&gt;run();    
</code></pre>
<p>This is almost the same code that&#8217;s the the <code>phar</code> stub, but written with generic PHP.</p>
<p>Let&#8217;s try running this from the command line.</p>
<pre><code>$ php dev-stub.php

     ___ ___
 _ _/ _ ( _ )___ _ __  __ _ __ _ ___ _ _ _  _ _ _
| ' \_, / _ \___| '  \/ _` / _` / -_) '_| || | ' \
|_||_/_/\___/   |_|_|_\__,_\__, \___|_|  \_,_|_||_|
                           |___/
n98-magerun version 1.63.0 by netz98 new media GmbH

Usage:
  [options] command [arguments]

...
</code></pre>
<p>Eureka!  We&#8217;re now running <code>n98-magerun</code> strictly from code.   You can make sure everything&#8217;s working correctly by navigating to your Magento folder and running a simple command like <code>sys:info</code>.</p>
<pre><code>$ cd /path/to/magento
$ php /path/to/n98-magerun/dev-stub.php sys:info

  Magento System Information  

Version                  : 1.7.0.1
Edition                  : Community
Cache Backend            : Zend_Cache_Backend_File
Cache Directory          : /Users/alanstorm/Sites2012/magento1point7pointzeropoint1.dev/var/cache
Session                  : files
Crypt Key                : 18cea96f92f35a540d83a2fe7f33c005
Install Date             : Sun, 01 Jul 2012 17:06:09 +0000
</code></pre>
<p>We&#8217;re now ready to start with our <code>helloworld</code> command.</p>
<h2>Hello World</h2>
<p>To create a new <code>n98-magerun</code> command there&#8217;s five basic steps</p>
<ol>
<li>
<p>Register the command</p>
</li>
<li>
<p>Create the command class</p>
</li>
<li>
<p>Configure the command name</p>
</li>
<li>
<p>Implement the command</p>
</li>
<li>
<p>Build our new command into the <code>phar</code></p>
</li>
</ol>
<p>By the end of the article, you&#8217;ll know how to do all five.</p>
<h2>Registering the Command Class and Namespaces</h2>
<p>Our first task is to register the command class.  Open up the main application file and look at the <code>registerCommands</code> method</p>
<pre><code>#File: src/N98/Magento/Application.php
//...    
class Application extends BaseApplication
{    
    //...
    protected function registerCommands()
    {
        $this-&gt;add(new GenerateLocalXmlConfigCommand());
        $this-&gt;add(new DatabaseDumpCommand());
        $this-&gt;add(new DatabaseDropCommand());        
        //...
    }
    //...    
}    
</code></pre>
<p>The <code>n98-magerun</code> team made use of <a href="http://symfony.com/">Symfony&#8217;s</a> console package as the basis for their application.  A Symfony console application&#8217;s <code>add</code> method allows client programmers to tell their application about a command, which in turn exposes it to end users of the console application.</p>
<p>A few of you may be wondering why this code uses such generic class names.  The name <code>Application</code>, and <code>BaseApplication</code> seem like things that could be used in other code bases — so why did <code>n98-magerun</code> choose <code>Application</code> and why did <code>Symfony</code> choose <code>BaseApplication</code>?</p>
<p>The short answer is namespaces.  If you look at the top of this file</p>
<pre><code>#File: src/N98/Magento/Application.php
namespace N98\Magento;
//...
</code></pre>
<p>you&#8217;ll see we&#8217;re working in the <code>N98\Magerun</code> namespace.  That means this application class&#8217;s full name is actually</p>
<pre><code>N98\Magento\Application
</code></pre>
<p>Similarly, further down in the file, you can see (nestled in among many similar calls)</p>
<pre><code>use Symfony\Component\Console\Application as BaseApplication;
</code></pre>
<p>This aliases the class with the full name of</p>
<pre><code>Symfony\Component\Console\Application
</code></pre>
<p>as the class <code>BaseApplication</code> in this file.</p>
<p>PHP namespace programming can be confusing if you&#8217;re not used to it.  Even if you are used to it, the lack of a gold standard in how to approach namespaces can leave you feeling as though you&#8217;re flailing about.  While this isn&#8217;t necessarily a namespace tutorial, we&#8217;ll try to explain how and why each classes interacts in this brave new namespaced world.</p>
<p>The namespace detour completed, let&#8217;s add our command!  Add the following line to the <code>registerCommands</code> method.</p>
<pre><code>#File: src/N98/Magento/Application.php
//...    
class Application extends BaseApplication
{    
    //...
    protected function registerCommands()
    {
        $this-&gt;add(
            new HelloWorldCommand()
        );
        //...
    }
}
</code></pre>
<p>What we&#8217;ve done here is pass in an object, instantiated from the class <code>HelloWorldCommand</code>.  Let&#8217;s run our command with this in place</p>
<pre><code>$ php /path/to/n98-magerun/dev-stub.php    
PHP Fatal error:  Class 'N98\Magento\HelloWorldCommand' not found    
</code></pre>
<p>A fatal error!  PHP is complaining it can&#8217;t find a class named <code>HelloWorldCommand</code>.  Actually, it&#8217;s complaining it can&#8217;t find a class named <code>N98\Magento\HelloWorldCommand</code> since we&#8217;re working in the <code>N98\Magento</code> namespace.  Regardless, this make sense since we haven&#8217;t actually created our class yet.  Let&#8217;s get to that.</p>
<h2>Creating the Class</h2>
<p>Each command in <code>n98-magerun</code> corresponds to a single PHP class file.  These files are, by convention, created in the <code>src/N98/Magento/Command</code> folder.</p>
<p>If you list out the contents of this folder, you&#8217;ll see a number of classes and directories</p>
<pre><code>$ ls -1 src/N98/Magento/Command
AbstractMagentoCommand.php
AbstractMagentoStoreConfigCommand.php
Admin
Cache
Cms
Config
ConfigurationLoader.php
Customer
Database
Design
Developer
Indexer
Installer
LocalConfig
MagentoConnect
OpenBrowserCommand.php
PHPUnit
ScriptCommand.php
SelfUpdateCommand.php
ShellCommand.php
System
</code></pre>
<p>We&#8217;re going to create a new class file in this folder.  The <code>n98-magerun</code> autoloader expects file names and class names to match, so create the following file at the following location</p>
<pre><code>#File: src/N98/Magento/Command/HelloWorldCommand.php
&lt;?php
namespace N98\Magento\Command;    
use N98\Magento\Command\AbstractMagentoCommand;

class HelloWorldCommand extends AbstractMagentoCommand
{
}    
</code></pre>
<p>The first line of this file puts us in the</p>
<pre><code>N98\Magento\Command
</code></pre>
<p>namespace.  That means the full name for the <code>HelloWorldCommand</code> class we&#8217;ve declared is actually <code>N98\Magento\Command\HelloWorldCommand</code>.  You&#8217;ll notice the namespace convention matches the file path convention.</p>
<pre><code>N98/Magento/Command/HelloWorldCommand.php
N98\Magento\Command\HelloWorldCommand
</code></pre>
<p>Without getting too deeply into it, the autoloader depends on this, so make sure you stick to this convention.</p>
<p>Our <code>HelloWorldCommand</code> class extends the <code>AbstractMagentoCommand</code> class. This is the abstract class that all <code>n98-magerun</code> commands inherit from.  The full name of this class is actually</p>
<pre><code>N98\Magento\Command\AbstractMagentoCommand
</code></pre>
<p>We&#8217;re able to refer to it as <code>AbstractMagentoCommand</code> since the following code was used at the top of our file</p>
<pre><code>use N98\Magento\Command\AbstractMagentoCommand;
</code></pre>
<p>If we run our application with the above class in place</p>
<pre><code>$ php /path/to/dev-stub.php
Class 'N98\Magento\HelloWorldCommand' not found
</code></pre>
<p>We&#8217;re still getting the same error.  That&#8217;s because our register function is trying to load a class in the <strong>current</strong> namespace of the <code>Application</code> file.  If we change our <code>add</code> method call so it uses the full class name</p>
<pre><code>#File: src/N98/Magento/Application.php
//...    
class Application extends BaseApplication
{    
    //...
    protected function registerCommands()
    {
        $this-&gt;add(
            new \N98\Magento\Command\HelloWorldCommand()
        );
    }
}
</code></pre>
<p>we should be good to go.  Notice the leading <code>\\</code> on the class name.  This tells PHP to start looking from the <strong>global</strong> namespace, (vs. looking for a deeper namespace, starting at the current one) .</p>
<p>If we run our stub with the above in place</p>
<pre><code>$ php /path/to/dev-stub.php
PHP Fatal error:  Uncaught exception 'LogicException' with message 'The command name cannot be empty.
</code></pre>
<p>Sort of Eureka!  We&#8217;ve gotten rid of the class not found error, and replaced with with a new &#8220;the command name cannot be empty&#8221; error.  That&#8217;s progress of a sort, and brings us to step 3, <em>configure the command name</em>.</p>
<h2>Configuring the Command</h2>
<p>Every command has a <code>configure</code> method which is called automatically.  This is where we&#8217;ll want to assign our command a name.  Add the following method to your command class</p>
<pre><code>#File: src/N98/Magento/Command/HelloWorldCommand.php
&lt;?php
namespace N98\Magento\Command;    
use N98\Magento\Command\AbstractMagentoCommand;

class HelloWorldCommand extends AbstractMagentoCommand
{
    protected function configure()
    {
        $this-&gt;setName('helloworld');

    }    
}    
</code></pre>
<p>With the above in place, lets run our command again</p>
<pre><code>$ php /path/to/dev-stub.php
     ___ ___
 _ _/ _ ( _ )___ _ __  __ _ __ _ ___ _ _ _  _ _ _
| ' \_, / _ \___| '  \/ _` / _` / -_) '_| || | ' \
|_||_/_/\___/   |_|_|_\__,_\__, \___|_|  \_,_|_||_|
                           |___/
n98-magerun version 1.63.0 by netz98 new media GmbH

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v Increase verbosity of messages.
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  helloworld                       
  help                             Displays help for a command
</code></pre>
<p><strong>Finally!</strong> We&#8217;ve got a clean run.  Also, if you&#8217;re playing close attention, you&#8217;ll notice that <code>helloworld</code> is now listed as an available command.</p>
<pre><code>Available commands:
  helloworld                       
  help                             Displays help for a command
</code></pre>
<p>If you want to give your command a description, just call the <code>setDescription</code> method in <code>configure</code></p>
<pre><code>#File: src/N98/Magento/Command/HelloWorldCommand.php
protected function configure()
{
    $this-&gt;setName('helloworld');
    $this-&gt;setDescription('Displays a Hello World message. &lt;comment&gt;(pedagogical)&lt;/comment&gt;');
}
</code></pre>
<p>Give the stub another run, and you should see your command description.</p>
<pre><code>$ php /path/to/dev-stub.php
...
Available commands:
  helloworld                       Displays a Hello World message. (pedagogical)
</code></pre>
<p>Notice that the text we included in the <code>&lt;comment/&gt;</code> tag has been automatically made into a parenthetical.</p>
<h2>Implementing our Command</h2>
<p>We&#8217;ve got our stub running clean again — lets press our luck and try calling our <code>helloworld</code> command.</p>
<pre><code>$ php /path/to/dev-stub.php helloworld

  [LogicException]                                                       
  You must override the execute() method in the concrete command class.  
</code></pre>
<p>Drats!  At least we&#8217; we&#8217;ve replaced our gross PHP errors with pretty Symfony errors.</p>
<p>Every command in a Symfony console application needs an <code>execute</code> method.  The <code>execute</code> method is where we implement our command logic.  To create this method, add the following to your <code>HelloWorldCommand</code> class</p>
<pre><code>#File: src/N98/Magento/Command/HelloWorldCommand.php
writeln("Hello World!");
        }        
    }    
    
As you can see, we've added an `execute` method to our class.  The method has two arguments.  The first, `$input`, allows you to access arguments and options passed to your command.  The second, `$output`, allows you to send feedback to the users of your command.  You can also see we've called the `writeln` method of the output object to print out our ubiquitous *Hello World!* message.  Let's give the command a final run and call it a day.

    $ php /path/to/dev-stub.php helloworld
    PHP Catchable fatal error:  Argument 1 passed to N98\Magento\Command\HelloWorldCommand::execute() must be an instance of N98\Magento\Command\InputInterface, instance of Symfony\Component\Console\Input\ArgvInput given    
    
Crud.  That would have been too easy, wouldn't it have?  PHP is complaining that the first argument to `execute` failed to match the type safety check.  PHP was expecting a `N98\Magento\Command\InputInterface`, but was provided with a `Symfony\Component\Console\Input\ArgvInput`.  Again, namespaces rear their hydra like heads.  

The `InputInterface` interface we want is actually `Symfony\Component\Console\Input\InputInterface`.  Instead of changing the type check in front of the parameter, let's import `Symfony\Component\Console\Input\InputInterface` and `Symfony\Component\Console\Output\OutputInterface` into the current namespace.  Add the following lines just below the `namespace` declaration.

    #File: src/N98/Magento/Command/HelloWorldCommand.php
    namespace N98\Magento\Command;
    
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;    
    //...
    
With the above in place, we should be able to run our command.

    $ php ~/Documents/github_netz98/n98-magerun/dev-stub.php helloworld
    Hello World!

There we have it, another *Hello World* example program added to the world. 

Following Conventions
--------------------------------------------------
Before we finish things off by compiling our new code into a `phar`, let's jump back to our `add` method call.

    #File: src/N98/Magento/Application.php
    //...
    $this-&gt;add(
        new \N98\Magento\Command\HelloWorldCommand()
    );
    
    $this-&gt;add(new GenerateLocalXmlConfigCommand());    
    
While this code works, it's not keeping with the conventions setup by the netz98 team.  When they add a command object, they're not using the full qualified namespace, they're just using simple class names like `GenerateLocalXmlConfigCommand`.  How do they get away with this?

If you search this file for `GenerateLocalXmlConfigCommand`, you'll find your answer.  Near the top of the file is the following line
    
    #File: src/N98/Magento/Application.php
    use N98\Magento\Command\LocalConfig\GenerateCommand as GenerateLocalXmlConfigCommand;    
    
Using <a href="http://php.net/manual/en/language.namespaces.importing.php">the `use` operator</a>, the fully qualified `N98\Magento\Command\LocalConfig\GenerateCommand` class is being imported into the local namespace as `GenerateLocalXmlConfigCommand`.  Let's bring **our** class into the local namespace. Add the following right above the `GenerateLocalXmlConfigCommand` line

#File: src/N98/Magento/Application.php
//our code
use N98\Magento\Command\HelloWorldCommand;

//their code
use N98\Magento\Command\LocalConfig\GenerateCommand as GenerateLocalXmlConfigCommand;    
</code></pre>
<p>and then change your call to <code>add</code></p>
<pre><code>$this-&gt;add(new HelloWorldCommand());
</code></pre>
<p>Your command should behave exactly the same, but now you&#8217;re matching the current coding conventions used in the project.  Some people might write this off as <a href="http://en.wiktionary.org/wiki/bikeshedding">bike shedding</a>, but a consistant codebase helps with team cohesion, and allows new programmers a stable base  to learn the fundamentals of a project without having to worry about parsing multiple different coding styles. This is particularly true in the PHP world, since &#8220;idiomatic PHP&#8221; varies from project to project.</p>
<h2>Building a New phar</h2>
<p>The only thing left is to build a new <code>phar</code> archive.  As we <a href="http://magento-quickies.tumblr.com/post/49122097133/n98-magerun-development-environment">learned last time</a>, our build script is just a single call to</p>
<pre><code>$ phing
...
BUILD FINISHED

Total time: 8.2973 seconds away.  
</code></pre>
<p>After running <code>phing</code>, make sure a new <code>phar</code> was created with today&#8217;s date and time (<code>May XX XX:XX</code> below)</p>
<pre><code>$ ls -l n98-magerun.phar 
-rwxrwxr-x  1 alanstorm  staff  3617497 May XX XX:XX n98-magerun.phar
</code></pre>
<p>Then, try running your command</p>
<pre><code>$ ./n98-magerun.phar helloworld
Hello World!
</code></pre>
<p>Congratulations, you&#8217;ve just created and built your first <code>n98-magerun</code> command.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/05/n98-magerun-creating-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tumblr Eats HTML in Markdown Code Blocks</title>
		<link>http://mage-page.net/2013/04/tumblr-eats-html-in-markdown-code-blocks/</link>
		<comments>http://mage-page.net/2013/04/tumblr-eats-html-in-markdown-code-blocks/#comments</comments>
		<pubDate>Tue, 30 Apr 2013 04:09:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/tumblr-eats-html-in-markdown-code-blocks/</guid>
		<description><![CDATA[<p>I was about to update the <code>n98-magerun</code> article with some positive developments on those <code>phpunit</code> dependencies when, much to my surprise, this happened</p>

<p><img src="http://media.tumblr.com/5c28f632b411c00f384b1f3093bc96c2/tumblr_inline_mm1vi1H8iE1qz4rgp.png" alt="" /></p>

<p>All the XML in code blocks is gone.  Vanished. Something something other people&#8217;s free blogging systems.</p>

<p>Fortunately the post is <a href="http://magento-quickies.tumblr.com/api/read?filter=none">mostly available</a> via the <code>V1</code> API (with entity encoded HTML), but that&#8217;s still some pretty weak sauce. I for one do not welcome our always available in the cloud closed source applications.</p>]]></description>
				<content:encoded><![CDATA[<p>I was about to update the <code>n98-magerun</code> article with some positive developments on those <code>phpunit</code> dependencies when, much to my surprise, this happened</p>
<p><img src="http://media.tumblr.com/5c28f632b411c00f384b1f3093bc96c2/tumblr_inline_mm1vi1H8iE1qz4rgp.png" alt="" /></p>
<p>All the XML in code blocks is gone.  Vanished. Something something other people&#8217;s free blogging systems.</p>
<p>Fortunately the post is <a href="http://magento-quickies.tumblr.com/api/read?filter=none">mostly available</a> via the <code>V1</code> API (with entity encoded HTML), but that&#8217;s still some pretty weak sauce. I for one do not welcome our always available in the cloud closed source applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/tumblr-eats-html-in-markdown-code-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Development Environment</title>
		<link>http://mage-page.net/2013/04/n98-magerun-development-environment/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-development-environment/#comments</comments>
		<pubDate>Sun, 28 Apr 2013 20:58:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-development-environment/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>Today we&#8217;re going to run through setting up your own <code>n98-magerun</code> development environment.  This will allow you to develop your own features and contribute bug fixes back to the main repository. This one&#8217;s a little longer than our normal Magento Quickies fare, so if you&#8217;re in a hurry you may want to save this for later.</p>

<p>There&#8217;s two (or maybe three) extra software packages you&#8217;ll need to install if you want to work with the <code>n98-magerun</code> source code.  The first is PHP <a href="http://getcomposer.org/">Composer</a>, the second is the <a href="http://www.phing.info/trac/wiki/Users/Download">phing</a> build system.</p>

<h2>Composer</h2>

<p>Composer is a software package for managing project dependencies.  The <code>n98-magerun</code> program relies ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>Today we&#8217;re going to run through setting up your own <code>n98-magerun</code> development environment.  This will allow you to develop your own features and contribute bug fixes back to the main repository. This one&#8217;s a little longer than our normal Magento Quickies fare, so if you&#8217;re in a hurry you may want to save this for later.</p>
<p>There&#8217;s two (or maybe three) extra software packages you&#8217;ll need to install if you want to work with the <code>n98-magerun</code> source code.  The first is PHP <a href="http://getcomposer.org/">Composer</a>, the second is the <a href="http://www.phing.info/trac/wiki/Users/Download">phing</a> build system.</p>
<h2>Composer</h2>
<p>Composer is a software package for managing project dependencies.  The <code>n98-magerun</code> program relies on many third party packages for its functionality.  Rather than include these in the main source tree, <code>n98-magerun</code> includes a top level <code>vendor/</code> folder.  This is where third party dependencies are downloaded to.</p>
<p>This is a standard best practice in profesional software development.  By separating your vendor packages from the main source tree, you make upgrading the packages easier. You also encourage/force a &#8220;no hacking the vendor package&#8221; discipline on your team.</p>
<p>There&#8217;s instructions for <a href="http://getcomposer.org/download/">installing Composer on their website</a>.  The short version is there&#8217;s a <code>composer.phar</code> (similar to <code>n98-magerun.phar</code>) archive that needs to be in your shell path and needs to be executable.  The composer team has a &#8220;download install script with curl and run it&#8221; one liner, or you may download the <code>phar</code> file directly and place it in your path.</p>
<p>You can test if composer is installed correctly by running the following</p>
<pre><code>$ composer.phar --version
Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33
</code></pre>
<h2>Phing</h2>
<p>Phing is a PHP build system based on <a href="http://ant.apache.org/">apache ant</a>. For The Kids™ in the audience, ant is a system that was created to give developers a &#8220;pure java&#8221; build system (as opposed to the powerful-but-tortuous options of the day like <code>GNU make</code>).  Phing, in turn, is a PHP version of ant.</p>
<p>Phing implements an XML based build language that allows you to perform common build tasks.  This XML format is an example of a Domain Specific Language (DSL). Folks using Magento&#8217;s layout system may get a sense of Déjà vu.</p>
<p>Installing <code>phing</code> is slightly trickier than installing PHP composer.  The preferred way of <a href="http://www.phing.info/trac/wiki/Users/Download">installing <code>phing</code> is via PHP PEAR</a>.  PEAR (the third package we mentioned above) is PHP&#8217;s original dependencies and package management system. While powerful, it never became consistently adopted by the disperate PHP communities.  A side effect of this is many PHP distributions don&#8217;t have PEAR properly installed, or have it only available to users with <code>sudo</code> permission.</p>
<p>If a fully operational PEAR isn&#8217;t available to you, phing is also available via a package download, as well as a stand alone <code>phar</code> file.</p>
<p>Regardless how you install it, at the end of the day you&#8217;ll have a <code>phing</code> (or <code>phing.phar</code> or <code>phing-latest.phar</code>) command executable from your shell.</p>
<pre><code>$ phing -v
Phing 2.5.0
</code></pre>
<h2>Downloading Dependencies with Composer</h2>
<p>Now that our tools are in place, we&#8217;re ready to start. Step 1 for working with  <code>n98-magerun</code> is to <a href="https://github.com/netz98/n98-magerun">get the codebase</a> from GitHub.</p>
<pre><code>$ git clone <a href="https://github.com/netz98/n98-magerun.git">https://github.com/netz98/n98-magerun.git</a>
</code></pre>
<p>However, even after you&#8217;ve <code>cloned</code> the git source tree, you&#8217;re still missing a number of files <code>n98-magerun</code> needs to function.  If you look in the <code>vendor</code> folder, you&#8217;ll see it&#8217;s empty</p>
<pre><code>$ ls -la vendor/
total 16
drwxr-xr-x   3 alanstorm  staff   102 Apr 26 14:40 .
drwxr-xr-x  26 alanstorm  staff   884 Apr 25 23:24 ..
</code></pre>
<p>As mentioned earlier, the <code>vendor</code> folder is where third party code libraries are kept.  To download these files, run the <code>composer.phar install</code> command from the root folder of your repository.</p>
<pre><code>$ cd n98-magerun
$ composer.phar install
Loading composer repositories with package information
Installing dependencies from lock file
  - Installing symfony/process (v2.2.1)
    Loading from cache

  - Installing symfony/finder (v2.2.1)
    Loading from cache

  - Installing symfony/console (2.2.x-dev a10a2fb)
    Cloning a10a2fb156267b9b8f01d717a06979e6ebb69251

  - Installing seld/jsonlint (1.1.1)
    Loading from cache

  - Installing justinrainbow/json-schema (1.1.0)
    Loading from cache

  - Installing composer/composer (dev-master c655674)
    Cloning c65567447c84eb6a8c0f229c40b0865cd4dcecb5

  - Installing fzaninotto/faker (v1.1.0)
    Loading from cache

  - Installing n98/junit-xml (dev-master 6381433)
    Cloning 6381433a39498dc22bec60cebdb2576a9d2327b0

  - Installing symfony/translation (v2.2.1)
    Loading from cache

  - Installing symfony/validator (v2.2.1)
    Loading from cache

  - Installing symfony/yaml (v2.2.1)
    Loading from cache

symfony/translation suggests installing symfony/config (2.2.*)
symfony/validator suggests installing doctrine/common (~2.2)
symfony/validator suggests installing symfony/config (2.2.*)
symfony/validator suggests installing symfony/http-foundation (2.2.*)
symfony/validator suggests installing symfony/locale (2.2.*)
Generating autoload files
</code></pre>
<p>If you take a look at your vendor folder after running the <code>install</code> command, you&#8217;ll see the required vendor packages have been installed.</p>
<pre><code>$ ls -1a vendor/
.
..    
autoload.php
bin
composer
fzaninotto
justinrainbow
n98
seld
symfony
</code></pre>
<p>Of course, this raises a few questions: How does <code>composer.phar</code> know which packages to download? And where are these packages coming from? While this knowledge isn&#8217;t strictly required to procede, we&#8217;re going to cover it to put your (and our) minds at ease.</p>
<p>The <code>composer.phar</code> command looks for a file named <code>composer.json</code>.  This file contains configuration information for a composer based project (which <code>n98-magerun</code> is).  This configuration information will include a list of package dependencies</p>
<pre><code>//File: composer.json
"require": {
    "php": "&gt;=5.3.3",
    "symfony/console": "2.2.x-dev",
    "symfony/finder": "2.2.1",
    "symfony/yaml": "2.2.1",
    "symfony/process": "2.2.1",
    "symfony/validator": "2.2.1",
    "justinrainbow/json-schema": "1.1.*",
    "seld/jsonlint": "1.*",
    "n98/junit-xml": "dev-master",
    "fzaninotto/faker": "1.1.0",
    "composer/composer": "dev-master"
},
</code></pre>
<p>As you can see, the <code>require</code> key contains a list of packages and versions.  These package names correspond with the downloaded packages from the <code>install</code> command.  So this answers the &#8220;how does composer know&#8221; question. Before we move on the &#8220;where&#8221; question, it&#8217;s worth pointing out that composer is actually reading from the <code>composer.lock</code> file. This <code>composer.lock</code> file is generated with the information in <code>composer.json</code>, and is not meant to be human editable.  If you want to get into the nitty gritty of this checkout <a href="http://getcomposer.org/doc/01-basic-usage.md#compo%20ser-lock-the-lock-file">the composer manual</a>.</p>
<p>The &#8220;from where&#8221; question is a little trickier.  There&#8217;s two grand arcs to the  composer project.  The first is the <code>composer.phar</code> application we downloaded, which contains the logic for dependency management.  The second is a composer repository at <a href="https://packagist.org/">packagist.org</a>.  Unless a different repository is listed in <code>composer.json</code>, <em>packagist.org</em> is where <code>composer.phar</code> will grab package information from.</p>
<p>Does that mean composer is downloading packages from <em>packagist.org</em>?  No.  Confused?  Read on!</p>
<p>A composer repository only contains meta-data about a package.  This meta-data includes a <strong>source code repository</strong> where the package source can be found.  The <em>packagist.org</em> repository simply tells <code>composer.phar</code> where it should download the package source from.</p>
<p>Figuring out where <code>composer.phar</code> is grabbing packages from is a two step process.  First, you can list out all the packages used in your project with the <code>show</code> command and and <code>--self</code> flag.</p>
<pre><code>$ composer.phar show --self
name     : n98/magerun
descrip. : Tools for managing Magento projects and installations
keywords : magento, installer
versions : * dev-master
type     : library
license  : MIT
source   : []  
dist     : []  
names    : n98/magerun

support
issues : <a href="https://github.com/netz98/n98-magerun/issues">https://github.com/netz98/n98-magerun/issues</a>

autoload
psr-0
N98 =&gt; src
Composer =&gt; src
Xanido =&gt; src

requires
php &gt;=5.3.3
symfony/console 2.2.x-dev
symfony/finder 2.2.1
symfony/yaml 2.2.1
symfony/process 2.2.1
symfony/validator 2.2.1
justinrainbow/json-schema 1.1.*
seld/jsonlint 1.*
n98/junit-xml dev-master
fzaninotto/faker 1.1.0
composer/composer dev-master

requires (dev)
phpunit/phpunit 3.7.19
phpunit/phpunit-story 1.0.2
phpunit/phpunit-selenium 1.2.12
phpunit/dbunit 1.2.3
phpunit/php-invoker 1.1.2
</code></pre>
<p>Once you have a package name (such as <code>symfony/yaml</code>), you can see its repository by using the <code>show</code> command again, this time with the package name as an argument.</p>
<pre><code>$ composer.phar show symfony/yaml
name     : symfony/yaml
descrip. : Symfony Yaml Component
keywords : 
versions : dev-master, 2.3.x-dev, 2.2.x-dev, * v2.2.1, v2.2.0, v2.2.0-RC3, v2.2.0-RC2, v2.2.0-RC1, v2.2.0-BETA2, v2.2.0-BETA1, 2.1.x-dev, v2.1.9, v2.1.8, v2.1.7, v2.1.6, v2.1.5, v2.1.4, v2.1.3, v2.1.2, v2.1.1, v2.1.0, v2.1.0-RC2, v2.1.0-RC1, v2.1.0-BETA4, v2.1.0-BETA3, v2.1.0-BETA2, v2.1.0-BETA1, 2.0.x-dev, v2.0.23, v2.0.22, v2.0.21, v2.0.20, v2.0.19, v2.0.18, v2.0.17, v2.0.16, v2.0.15, v2.0.14, v2.0.13, v2.0.12, v2.0.10, v2.0.9, 2.0.7, 2.0.6, 2.0.5, 2.0.4
type     : library
license  : MIT
source   : [git] <a href="https://github.com/symfony/Yaml.git">https://github.com/symfony/Yaml.git</a> v2.2.1
dist     : [zip] <a href="https://api.github.com/repos/symfony/Yaml/zipball/v2.2.1">https://api.github.com/repos/symfony/Yaml/zipball/v2.2.1</a> v2.2.1
names    : symfony/yaml

autoload
psr-0
Symfony\Component\Yaml\ =&gt; .

requires
php &gt;=5.3.3
</code></pre>
<p>The two sections we&#8217;re interested in here are <code>source</code> and <code>dist</code>.  The <code>source</code> lists the repository where the source code should be downloaded from, (<code>git</code>, <code>svn</code>, and <code>hg</code> repository types are supported).  This is how <code>composer.phar</code> will grab the needed vendor packages.</p>
<p>The archive (as opposed to repository) at <code>dist</code> can be used to install a package instead, but only if the <code>--prefer-dist</code> flag is used with the <code>install</code> command.</p>
<p>If you&#8217;re paranoid about security, you&#8217;ll want to review these package locations — although at some point using a distributed packaging system like CPAN, ruby gems, or packagist requires a certain level of trust. That, however, is another subject better left to another time.</p>
<h2>Composer Development Packages</h2>
<p>There&#8217;s one last thing we should cover before moving on from composer.  If you examined the <code>composer.json</code> file carefully, you may have noticed this section</p>
<pre><code>//File: composer.json
"require-dev": {
    "phpunit/phpunit": "3.7.19",
    "phpunit/phpunit-story": "1.0.2",
    "phpunit/phpunit-selenium": "1.2.12",
    "phpunit/dbunit": "1.2.3",
    "phpunit/php-invoker": "1.1.2"
},
</code></pre>
<p>This appears to be a second list of packages.  It turns out composer projects can have <strong>two</strong> sets of required packages.  The first is the standard distribution you&#8217;ll need to <strong>use</strong> the package.  The second, <code>require-dev</code>, is an additional set of packages you&#8217;ll need to <strong>work on</strong> (or <code>dev</code>elop) the project.</p>
<p>Since this whole article is about building our own version of <code>n98-magerun.phar</code>, we&#8217;ll want to install these development packages.  Let&#8217;s run <code>composer.phar</code> with the <code>--dev</code> flag.</p>
<pre><code>$ composer.phar install --dev
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for phpunit/php-invoker 1.1.2 -&gt; satisfiable by phpunit/php-invoker 1.1.2.
    - phpunit/php-invoker 1.1.2 requires ext-pcntl * -&gt; the requested PHP extension pcntl is missing from your system.
</code></pre>
<p>Uh oh.  At this point, you may (as we did above) run into an intractable problem.  The <code>phpunit/php-invoker</code> package couldn&#8217;t be installed because it requires that PHP have <a href="http://php.net/manual/en/book.pcntl.php">the process control</a> (<code>ext-pcntl</code>) extension installed.  This extension is omitted from many standard PHP distributions.</p>
<p>We&#8217;ve now run into what I like to call the <em>Software is Hard</em> problem.  In order to install these dependencies, we&#8217;d need to recompile our version of PHP.  That&#8217;s something many people can&#8217;t, or won&#8217;t do.  Unless we&#8217;re willing to make a massive change to our environment, we won&#8217;t be able to install the full suite of required <code>phpunit</code> tools.</p>
<p>On the flip side, we could remove <code>phpunit/php-invoker</code> as a requirement, and then successfully install the other development packages.  However, this would mean we&#8217;re veering off from what the main team is doing. Our system may start to behave differently than theirs, causing subtle and hard to track down compatibility problems in the future.</p>
<p>There&#8217;s going to be times in your career where you run into problems where there is no ideal solution. The only option is to <a href="https://github.com/netz98/n98-magerun/issues/127">raise your concerns</a>, and then press on with the less than ideal conditions. The trick to a long career is finding a way to not let these small defeats sap your motivation for other, more important tasks.</p>
<p>Fortunately, it&#8217;s still possible to work on <code>n98-magerun</code> code without the full <code>phpunit</code> suite, so we&#8217;ll carry on without it.</p>
<h2>Phing</h2>
<p>Now that we&#8217;ve discussed composer, our next step is using <code>phing</code> to build the project.  Take a look at the <code>build.xml</code> file in the root of the project</p>
<pre><code>&lt;!-- File: build.xml --&gt;
&lt;project name="n98-magerun" default="dist"&gt;

    &lt;fileset dir="." id="root_folder"&gt;&lt;!-- ... --&gt;&lt;/fileset&gt;
    &lt;fileset dir="src"  id="src_folder"&gt;&lt;!-- ... --&gt;&lt;/fileset&gt;
    &lt;fileset dir="res" id="res_folder"&gt;&lt;!-- ... --&gt;&lt;/fileset&gt;
    &lt;fileset dir="vendor" id="vendor_folder"&gt;&lt;!-- ... --&gt;&lt;/fileset&gt;

    &lt;target name="dist"&gt;
        &lt;!-- ... --&gt;
    &lt;/target&gt;

    &lt;target name="dist_unix"&gt;
        &lt;!-- ... --&gt;
    &lt;/target&gt;

    &lt;target name="install"&gt;
        &lt;!-- ... --&gt;
    &lt;/target&gt;

&lt;/project&gt;
</code></pre>
<p>This is our <code>phing</code> build file.  It contains all the build instructions for our package. We&#8217;re interested in the <code>&lt;target/&gt;</code> nodes.  Each <code>&lt;target/&gt;</code> node defines a single build command.  For example, the <code>install</code> command can be used to install the <code>n98-magerun.phar</code> from the repository to your local computer.  This is a relatively simple build target.</p>
<pre><code><!-- File: build.xml -->
&lt;target name="install"&gt;
    &lt;exec command="sudo cp ${project.basedir}/n98-magerun.phar /usr/local/bin/n98-magerun.phar;" /&gt;
    &lt;exec command="sudo chmod a+x /usr/local/bin/n98-magerun.phar;" /&gt;
&lt;/target&gt;
</code></pre>
<p>As you can see, there&#8217;s two <code>&lt;exec/&gt;</code> nodes within this target.  These are command nodes — think of each one like you would a single line in a normal programming language or shell script.  The <code>&lt;exec/&gt;</code> command is one of the simplest build commands — it simply runs a unix shell script.</p>
<p>Let&#8217;s try running the <code>install</code> target.</p>
<pre><code>$ phing install
Buildfile: /path/to/n98-magerun/build.xml

n98-magerun &gt; install:

Password:
Sorry, try again.
Password:

BUILD FINISHED

Total time: 5.9880 seconds
</code></pre>
<p>As you can see, to run a <code>phing</code> command you simply pass it the target name.  The <code>phing</code> command will look for a <code>build.xml</code> file in the current directory, and then run the target you&#8217;ve passed in.</p>
<p>As for the command output itself, it prompts you for a password (since it&#8217;s running the <code>sudo</code> command), and the finishes the build.  Unfortunately, there&#8217;s no indication of what the command actually did.  If you&#8217;d like a little more feedback, try the <code>verbose</code> flag.</p>
<pre><code>$ phing -verbose install
Buildfile: /path/to/n98-magerun/build.xml
Override ignored for user property phing.file
Override ignored for user property phing.dir
parsing buildfile build.xml
Project base dir set to: /path/to/n98-magerun
Build sequence for target 'install' is: install 
Complete build sequence is: install dist dist_unix 

n98-magerun &gt; install:

Property ${project.basedir} =&gt; /path/to/n98-magerun
     [exec] Executing command: sudo cp /path/to/n98-magerun/n98-magerun.phar /usr/local/bin/n98-magerun.phar; 2&gt;&amp;1
     [exec] Executing command: sudo chmod a+x /usr/local/bin/n98-magerun.phar; 2&gt;&amp;1

BUILD FINISHED

Total time: 0.1772 seconds
</code></pre>
<p>With the <code>verbose</code> flag, <code>phing</code> tells you everything it&#8217;s doing.  From this we can figure out a file has been copied to <code>/usr/local/bin/n98-magerun.phar</code>.  This places the <code>phar</code> in our <code>*nix</code> path, and is <a href="http://magento-quickies.tumblr.com/post/47974204176/introduction-to-n98-magerun">another way to install</a> the <code>n98-magerun.phar</code> command.</p>
<h2>Building the Project</h2>
<p>Most <code>phing</code> build files have a default target which builds the project.</p>
<p>If you run <code>phing</code> with the <code>-l</code> option</p>
<pre><code>$ phing -l
Buildfile: /path/to/n98-magerun/build.xml
Default target:
-------------------------------------------------------------------------------
 dist

Subtargets:
-------------------------------------------------------------------------------
 dist
 dist_unix
 install
</code></pre>
<p>you&#8217;ll get a list of each <code>target</code> in the application, as well as the default target (in this case, <code>dist</code>).  You can also see the default target by looking at the root node of the <code>build.xml</code> file.</p>
<pre><code>&lt;!-- build.xml --&gt;
&lt;project name="n98-magerun" default="dist"&gt;
</code></pre>
<p>We&#8217;re going to run through a default build of the <code>n98-magerun</code> tool, including several problems we ran into and how to work around them.  You may not run into these specific problems — and you may run into different problems not mentioned here.  Setting up a build environment is always a trial and error process, and things will rarely work out of the gate.  Part of the reason teams use a tool like <code>phing</code> is to provide a single entry point into their build system and <strong>force</strong> developers to download and install the same dependencies.  If you run into trouble getting this up and running, <a href="http://magento.stackexchange.com/">the Magento Stack Exchange</a> is a great place to ask questions to help get your system up and running.</p>
<p>To run the default build step, just run <code>phing</code> from the project root directory with no arguments</p>
<pre><code>$ phing
</code></pre>
<p>The first thing you&#8217;ll see is <code>phing</code> going through the project dependencies and downloading the needed files to the <code>vendor</code> folder.</p>
<pre><code>$ phing
Buildfile: /path/to/n98-magerun/build.xml

n98-magerun &gt; dist:

Loading composer repositories with package information
Installing dependencies from lock file
  - Installing symfony/process (v2.2.1)
    Loading from cache

  - Installing symfony/finder (v2.2.1)
    Loading from cache

... snipped ...
</code></pre>
<p>If you&#8217;ve already downloaded these files with the <code>composer.phar install</code> command, these downloads will be skipped.  The output for that looks  like this</p>
<pre><code>$ phing
Buildfile: /private/tmp/building/n98-magerun/build.xml

n98-magerun &gt; dist:

Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
</code></pre>
<p>If you look at the <code>build.xml</code> file, you can see all this happens because the command in the <code>dist</code> target runs the composer <code>install</code> command.</p>
<pre><code>&lt;target name="dist"&gt;
    &lt;exec command="composer.phar install" dir="${project.basedir}" passthru="true" /&gt;
</code></pre>
<p>So, it would be more accurate to say <code>phing</code> still attempts to update your dependencies, but if the latest versions are already downloaded composer will skip re-downloading them.</p>
<h2>Writeable PHAR Archives</h2>
<p>After <code>phing</code> runs the <code>composer.phar</code> command, it moves on to the next build steps, and (for some of you) will hit another error.</p>
<blockquote>
<p>Execution of target &#8220;dist_unix&#8221; failed for the following reason: /path/to/n98-magerun/build.xml:45:65: Problem creating package: creating archive &#8220;/path/to/n98-magerun/n98-magerun.phar&#8221; disabled by the php.ini setting phar.readonly</p>
</blockquote>
<p>Here we&#8217;ve discovered a constraint of PHP&#8217;s <code>phar</code> implementation.  By default, PHP won&#8217;t let you edit an existing phar archive.  While annoying, if you consider that a <code>phar</code> archive is meant to  &#8220;emulate <code>jar</code>s and <code>dll</code>s&#8221;, this makes sense.  Allowing a program to modify its libraries would be a recipe for disaster.</p>
<p>The problem, of course, is that it&#8217;s PHP code that creates a <code>phar</code> archive.  In order to solve this chicken/egg problem, PHP has a <code>phar.readonly</code> flag for <code>php.ini</code>.  If you set this flag to <code>0</code> or <code>Off</code>, PHP will allow you to access the methods which modify a <code>phar</code> archive.</p>
<p>This flag is one you&#8217;ll need to set in your <code>php.ini</code> file, it can&#8217;t be set at runtime with <code>ini_set</code>. If you&#8217;re not sure where your <code>php.ini</code> file is located, try running the following</p>
<pre><code>$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /private/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
</code></pre>
<p>Remember, it&#8217;s not uncommon for the command line version of PHP to have a different <code>ini</code> file than the web server version of PHP.</p>
<h2>BZip Compression Problems</h2>
<p>With the above in place, try running the build again.  If you&#8217;re like me, you&#8217;re about to run into another problem</p>
<blockquote>
<p>Execution of target &#8220;dist_unix&#8221; failed for the following reason: /path/to/n98-magerun/build.xml:45:65: Problem creating package: unable to create temporary file [wrapped: unable to create temporary file]</p>
</blockquote>
<p>This one is a head scratcher, but I finally <a href="https://bugs.php.net/bug.php?id=53467&amp;edit=1">tracked down the problem</a>. In short: While PHP&#8217;s <code>phar</code> format works across a variety of platforms and environments, the methods for creating <code>phar</code> archives are still very beta-ish.  The specific problem here is, when compressing <code>phar</code> archives PHP likes to open a temporary file — and from the sound of things it opens a temporary file for <strong>each</strong> file in the archive, and doesn&#8217;t close them until the command is complete.  All that library code means <code>n98-magerun</code> has over 1,000 files.</p>
<p>This quickly hits the limits that a non-server operating system has in place for the number of files each process is allowed to have open.  To solve this problem, you&#8217;ll need to edit <code>build.xml</code>.  Find the following XML node</p>
<pre><code>&lt;!-- File: build.xml --&gt;
&lt;pharpackage basedir="./" stub="_cli_stub.php" signature="sha512" compression="bzip2" destfile="./n98-magerun.phar"&gt;    
</code></pre>
<p>The <code>pharpackage</code> node is a <code>phing</code> build command that allows you to automatically create a <code>phar</code> application from a PHP codebase.  We&#8217;re interested in the <code>compression="bzip2"</code> attribute.  This tells <code>phing</code> to run the <code>phar</code> archive through the <a href="http://php.net/manual/en/phar.compressfiles.php">compressFiles</a> method, and is done to reduce the file size of the archive that&#8217;s distributed.  If you change this attribute to</p>
<pre><code>compression="none"
</code></pre>
<p>then <code>phing</code> will skip the compression step, and we should be able to get a complete build.</p>
<pre><code>$ phing
Buildfile: /path/to/n98-magerun/build.xml

n98-magerun &gt; dist:

Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
[phingcall] Calling Buildfile '/path/to/n98-magerun/build.xml' with target 'dist_unix'

n98-magerun &gt; dist_unix:

[pharpackage] Building package: /path/to/n98-magerun/n98-magerun.phar
    [chmod] Changed file mode on '/path/to/n98-magerun/n98-magerun.phar' to 775
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file

BUILD FINISHED

Total time: 3.5711 seconds
</code></pre>
<p>That looks like a clean build, let&#8217;s test out the <code>n98-magerun.phar</code> file that was just created.</p>
<pre><code>$ ./n98-magerun.phar --version
n98-magerun version 1.63.0 by netz98 new media GmbH
</code></pre>
<p>Success!  However, our <code>n98-magerun.phar</code> file</p>
<pre><code>$ ls -lh n98-magerun.phar
-rwxrwxr-x  1 alanstorm  staff   3.4M Apr 25 15:50 n98-magerun.phar
</code></pre>
<p>is over <code>3 MB</code> in size.  Compare that to the <code>1 MB</code> file <a href="https://github.com/netz98/n98-magerun/blob/master/n98-magerun.phar">distributed in the main github archive</a>.  So, while we can&#8217;t build exactly what the core <code>n98-magerun</code> team does, we <strong>can</strong> get a clean build in place with a testable <code>phar</code>, which is good enough for our needs.</p>
<p>While frustrating, you&#8217;ll find many points in your career where your development environment won&#8217;t match up exactly with that of the team you&#8217;re working with.  While it&#8217;s true (especially among non-distributed teams) that a chaotic build environment can lead to development delays, these delays are subtle and complicated in nature, and not the sort of thing that shows up in ROI metrics.  Unfair as it may be, as an individual developer working with a group, it will often fall on you to solve these problems for yourself in a way that doesn&#8217;t disrupt team flow.</p>
<h2>Wrap Up</h2>
<p>Regardless of the subtle incompatibilities, we&#8217;ve successfully built the <code>n98-magerun.phar</code> file from source.  This means we can start hacking on bugs, as well as adding new features to the tool.   Next time we&#8217;ll create our very first <code>n98-magerun</code> command.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-development-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vinai/fix-sample-data.php</title>
		<link>http://mage-page.net/2013/04/vinaifix-sample-data-php/</link>
		<comments>http://mage-page.net/2013/04/vinaifix-sample-data-php/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 19:16:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/vinaifix-sample-data-php/</guid>
		<description><![CDATA[<a href="https://gist.github.com/Vinai/5451584">Vinai/fix-sample-data.php</a>: <p>And Vinai’s fix for the duplicate URL problem partially/previously mentioned below. I try not to be hypercritical of Magento Inc./eBay because I know how hard these things are, but it really sounds like they pushed EE 1.13 out the door to have a Magento Imagine announcement.  Fortunately <a href="http://www.magentocommerce.com/partners/">the partner firms</a> are there to catch these things and make smart choices for their clients.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="https://gist.github.com/Vinai/5451584">Vinai/fix-sample-data.php</a>:
<p>And Vinai’s fix for the duplicate URL problem partially/previously mentioned below. I try not to be hypercritical of Magento Inc./eBay because I know how hard these things are, but it really sounds like they pushed EE 1.13 out the door to have a Magento Imagine announcement.  Fortunately <a href="http://www.magentocommerce.com/partners/">the partner firms</a> are there to catch these things and make smart choices for their clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/vinaifix-sample-data-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s wrong with the new url-keys in Magento? &#8211; Fabrizio Branca</title>
		<link>http://mage-page.net/2013/04/whats-wrong-with-the-new-url-keys-in-magento-fabrizio-branca/</link>
		<comments>http://mage-page.net/2013/04/whats-wrong-with-the-new-url-keys-in-magento-fabrizio-branca/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 19:07:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/whats-wrong-with-the-new-url-keys-in-magento-fabrizio-branca/</guid>
		<description><![CDATA[<a href="http://www.fabrizio-branca.de/whats-wrong-with-the-new-url-keys-in-magento.html">What's wrong with the new url-keys in Magento? - Fabrizio Branca</a>: <p>Some musings by Fabrizio Branca on changes to Magento’s product URL handling.  I haven’t dug deeply into this, but it sounds like there’s a new typed (vs. a <code>varchar</code>), per store EAV attribute for product URL keys with unique indexing, but the unique indexing hasn’t been thought through completely.  Hopefully this is fixed up before the 1.8 CE alpha becomes the shipping version.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.fabrizio-branca.de/whats-wrong-with-the-new-url-keys-in-magento.html">What&#8217;s wrong with the new url-keys in Magento? &#8211; Fabrizio Branca</a>:
<p>Some musings by Fabrizio Branca on changes to Magento’s product URL handling.  I haven’t dug deeply into this, but it sounds like there’s a new typed (vs. a <code>varchar</code>), per store EAV attribute for product URL keys with unique indexing, but the unique indexing hasn’t been thought through completely.  Hopefully this is fixed up before the 1.8 CE alpha becomes the shipping version.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/whats-wrong-with-the-new-url-keys-in-magento-fabrizio-branca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Database Commands</title>
		<link>http://mage-page.net/2013/04/n98-magerun-database-commands/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-database-commands/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 17:43:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-database-commands/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>The database: That which, as Magento programmers, we&#8217;re not supposed to touch.  <em>Use the native objects</em> is a refrain I&#8217;ve sung on more than one occasion, and it&#8217;s still what I recommend to people starting out with Magento.</p>

<p>Of course, even if we treat the database as a black box datastore, we still need to move that block box datastore around.  Also, once you understand the database schemas for a particular Magento sub-system, its often easier to work directly with the database for read operations.</p>

<p>For those intrepid developers willing to brave the wilds of Magento&#8217;s database, <code>n98-magerun</code> has a suite of database commands to make ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>The database: That which, as Magento programmers, we&#8217;re not supposed to touch.  <em>Use the native objects</em> is a refrain I&#8217;ve sung on more than one occasion, and it&#8217;s still what I recommend to people starting out with Magento.</p>
<p>Of course, even if we treat the database as a black box datastore, we still need to move that block box datastore around.  Also, once you understand the database schemas for a particular Magento sub-system, its often easier to work directly with the database for read operations.</p>
<p>For those intrepid developers willing to brave the wilds of Magento&#8217;s database, <code>n98-magerun</code> has a suite of database commands to make things easier.</p>
<pre><code>$ n98-magerun list db

Available commands for the "db" namespace:
  db:console   Opens mysql client by database config from local.xml
  db:drop      Drop current database
  db:dump      Dumps database with mysqldump cli client according to informations from local.xml
  db:import    Imports database with mysql cli client according to database defined in local.xml
  db:info      Dumps database informations
  db:query     Executes an SQL query on the database defined in local.xml
</code></pre>
<p>First, the <code>db:info</code> command allows you to extract useful information from Magento&#8217;s database configuration.</p>
<pre><code>$ n98-magerun db:info
host                     : localhost
username                 : root
password                 : ididit27
dbname                   : magento_example_com
initStatements           : SET NAMES utf8
model                    : mysql4
type                     : pdo_mysql
pdoType                  : 
active                   : 1
PDO-Connection-String    : mysql:host=localhost;dbname=magento_example_com
JDBC-Connection-String   : jdbc:mysql://localhost/magento_example_com?username=root&amp;password=ididit27
MySQL-Cli-String         : mysql -h'localhost' -u'root' -p'ididit27' 'magento_example_com'
</code></pre>
<p>Of particular interest are the <code>PDO-Connection-String</code>, <code>JDBC-Connection-String</code>, and <code>MySQL-Cli-String</code> fields. If you work with external systems that need to connect to Magento&#8217;s database, then having these strings prebuilt can save you from all sorts of tedious typo debugging.  The <code>db:info</code> command is also a nice sanity check for the inevitable &#8220;am I editing the right database&#8221; problem.</p>
<p>Taking this laziness a step further, if you&#8217;re just looking to connect to Magento&#8217;s mysql database via the command line, then the <code>db:console</code>  command is just what you&#8217;re looking for.</p>
<pre><code>$ n98-magerun db:console
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12052
Server version: 5.5.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt;
</code></pre>
<p>Similarly, the <code>db-dump</code> command will export your entire <code>mysql</code> database to a text file.</p>
<pre><code>$ n98-magerun db:dump

    Dump MySQL Database  

Filename for SQL dump: [magento_example_com.sql]
Start dumping database magento_example_com to file magento_example_com.sql
Finished
</code></pre>
<p>The <code>db-dump</code> command also has a useful &#8220;strip&#8221; feature.  This allows you to omit <code>INSERT</code>s from your dump file for <strong>specific</strong> tables, dumping only the structure.  For example, if you wanted to export a complete Magento system, but omit all the static blocks (the <code>cms_block</code> and <code>cms_block_store</code> tables), you&#8217;d do something like this.</p>
<pre><code>$ n98-magerun db:dump --strip="cms_block cms_block_store"
</code></pre>
<p>While useful, this still requires you understand what data can and can&#8217;t be dumped.  Omit the wrong join table and you might break your entire Magento system. To help with this problem, the <code>n98-magerun</code> authors have created special &#8220;table groups&#8221; that logically group related tables together.  For example, you can strip out customer data using the <code>@customers</code> group with the following</p>
<pre><code>$ n98-magerun db:dump --strip="@customers"

  Dump MySQL Database  

Filename for SQL dump: [magento_example_com.sql]
No-data export for: customer_address_entity customer_address_entity_datetime customer_address_entity_decimal customer_address_entity_int customer_address_entity_text customer_address_entity_varchar customer_entity customer_entity_datetime customer_entity_decimal customer_entity_int customer_entity_text customer_entity_varchar
Start dumping database magento_example_com to file magento_example_com.sql
Finished
</code></pre>
<p>Notice the list of tables listed after <code>No-data export for</code>.  These are the tables whose data has been stripped.  You can see a list of the table groups by using the built-in <code>help</code></p>
<pre><code>$ n98-magerun help db:dump 
...
Available Table Groups
 @log Log tables
 @dataflowtemp Temporary tables of the dataflow import/export tool
 @stripped Standard definition for a stripped dump (logs and dataflow)
 @sales Sales data (orders, invoices, creditmemos etc)
 @customers Customer data
 @trade Current trade data (customers and orders). You usally do not want those in developer systems.
 @development Removes logs and trade data so developers do not have to work with real customer data
</code></pre>
<p>Keep in mind &#8212; these groups are defined by the creators of <code>n98-magerun</code>.  It&#8217;s still a good idea to review the dumped data and ensure the information you want stripped <strong>is</strong> stripped.  Even if the <code>n98-magerun</code> list of tables matches up with your own mental model, there&#8217;s no way this tool could know about 3rd-party extensions that may be saving sensitive data in other tables.</p>
<p>Once you&#8217;ve dumped your data, you&#8217;ll probably want to import it at some point.  The <code>db:import</code> command does exactly what you&#8217;d think.  Just pass in the path of your sql file as the first argument and <code>n98-magerun</code> will import the file.</p>
<pre><code>$ n98-magerun db:import magento_example_com.sql
</code></pre>
<p>Another useful option supported by both <code>db:import</code> and <code>db-dump</code> is <code>--only-command</code>.  You can use this option to spit out the command line that <code>n98-magerun</code> is building to perform the dump/import.</p>
<pre><code>mysql -h'localhost' -u'root' -p'ididit27' 'magento_example_com' &lt; 'magento_example_com.sql'
</code></pre>
<p>There&#8217;s also a command, <code>db:query</code>, for running raw SQL queries against the database, with results returned as tab separated lines</p>
<pre><code>n98-magerun db:query "SELECT * FROM cms_page"
page_id title   root_template   meta_keywords   meta_description    identifier  content_heading content creation_time   update_time is_active   sort_order  layout_update_xml   custom_theme    custom_root_template    custom_layout_update_xml    custom_theme_from   custom_theme_to
12  404 Not Found 1 two_columns_right   Page keywords   Page description    no-route    NULL    &lt;div class="page-head-alt"&gt;&lt;h3&gt;Whoops, our bad...&lt;/h3&gt;&lt;/div&gt;\n\n&lt;dl&gt;\n\n&lt;dt&gt;The page you requested was not found, and we have a fine guess why.&lt;/dt&gt;\n\n&lt;dd&gt;\n\n&lt;ul class="disc"&gt;\n\n&lt;li&gt;If you typed the URL directly, please make sure the spelling is correct.&lt;/li&gt;\n\n&lt;li&gt;If you clicked on a link to get here, the link is outdated.&lt;/li&gt;\n\n&lt;/ul&gt;&lt;/dd&gt;\n\n&lt;/dl&gt;\n\n&lt;br/&gt;\n\n&lt;dl&gt;\n\n&lt;dt&gt;What can you do?&lt;/dt&gt;\n\n&lt;dd&gt;Have no fear, help is near! There are many ways you can get back on track with Magento Demo Store.&lt;/dd&gt;\n\n&lt;dd&gt;\n\n&lt;ul class="disc"&gt;\n\n&lt;li&gt;&lt;a href="#" onclick="history.go(-1);"&gt;Go back&lt;/a&gt; to the previous page.&lt;/li&gt;\n\n&lt;li&gt;Use the search bar at the top of the page to search for your products.&lt;/li&gt;\n\n&lt;li&gt;Follow these links to get you back on track!&lt;br/&gt;&lt;a href="{{store url=""}}"&gt;Store Home&lt;/a&gt;&lt;br/&gt;&lt;a href="{{store url="customer/account"}}"&gt;My Account&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;br/&gt;\n\n&lt;p&gt;&lt;img src="{{skin url='images/media/404_callout1.jpg'}}" style="margin-right:15px;"/&gt;&lt;img src="{{skin url='images/media/404_callout2.jpg'}}" /&gt;&lt;/p&gt;    2007-06-20 18:38:32 2013-03-21 05:04:55 1   0   NULL    NULL    NULL    NULL    NULL    NULL
13  Home page   two_columns_right   NULL    NULL    home    NULL    &lt;div class="col-left side-col"&gt;\n\n&lt;p class="home-callout"&gt;\n\n&lt;a href="{{store direct_url="apparel/shoes/womens/anashria-womens-premier-leather-sandal.html"}}"&gt;&lt;img src="{{skin url='images/ph_callout_left_top.gif'}}" border="0" /&gt;&lt;/a&gt;\n\n&lt;/p&gt;\n\n&lt;p class="home-callout"&gt;\n\n&lt;img src="{{skin url='images/ph_callout_left_rebel.jpg'}}" border="0" /&gt;\n\n&lt;/p&gt;\n\n{{block type="tag/popular" template="tag/popular.phtml"}}\n\n&lt;/div&gt;\n\n&lt;div class="home-spot"&gt;\n\n&lt;p class="home-callout"&gt;\n\n&lt;img src="{{skin url='images/home_main_callout.jpg'}}" border="0" width="470" /&gt;\n\n&lt;/p&gt;\n\n&lt;p class="home-callout"&gt;\n\n&lt;img src="{{skin url='images/free_shipping_callout.jpg'}}" border="0" width="470" /&gt;\n\n&lt;/p&gt;\n\n&lt;div class="box best-selling"&gt;\n\n&lt;h3&gt;Best Selling Products&lt;/h3&gt;\n\n&lt;table border="0" cellspacing="0"&gt;\n\n\t&lt;tbody&gt;\n\n\t\t&lt;tr class="odd"&gt;\n\n\t\t\t&lt;td&gt;&lt;a href="{{store direct_url="sony-vaio-vgn-txn27n-b-11-1-notebook-pc.html"}}"&gt;&lt;img class="product-img" src="{{skin url='images/media/best_selling_img01.jpg'}}" border="0" width="95" /&gt;&lt;/a&gt;\n\n\t\t\t&lt;div class="product-description"&gt;\n\n\t\t\t&lt;p&gt;&lt;a href="{{store direct_url="sony-vaio-vgn-txn27n-b-11-1-notebook-pc.html"}}"&gt;Sony VAIO VGN-TXN27N/B 11.1" Notebook PC&lt;/a&gt;&lt;/p&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\tSee all &lt;a href="{{store direct_url="electronics/computers/laptops.html"}}"&gt;Laptops&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;/div&gt;\n\n\t\t\t&lt;/td&gt;\n\n\t\t\t&lt;td&gt;&lt;a href="{{store direct_url="nine-west-women-s-lucero-pump.html"}}"&gt;&lt;img class="product-img" src="{{skin url='images/media/best_selling_img02.jpg'}}" border="0" width="95" /&gt;&lt;/a&gt;\n\n\t\t\t&lt;div class="product-description"&gt;\n\n\t\t\t&lt;p&gt;&lt;a href="{{store direct_url="nine-west-women-s-lucero-pump.html"}}"&gt;Nine West Women's Lucero Pump&lt;/a&gt;&lt;/p&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\tSee all &lt;a href="{{store direct_url="apparel/shoes.html"}}"&gt;Shoes&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;/div&gt;\n\n\t\t\t&lt;/td&gt;\n\n\t\t&lt;/tr&gt;\n\n\t\t&lt;tr class="even"&gt;\n\n\t\t\t&lt;td&gt;&lt;a href="{{store direct_url="olympus-stylus-750-7-1mp-digital-camera.html"}}"&gt;&lt;img class="product-img" src="{{skin url='images/media/best_selling_img03.jpg'}}" border="0" width="95" /&gt;&lt;/a&gt;\n\n\t\t\t&lt;div class="product-description"&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\t&lt;a href="{{store direct_url="olympus-stylus-750-7-1mp-digital-camera.html"}}"&gt;Olympus Stylus 750 7.1MP Digital Camera&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\tSee all &lt;a href="{{store direct_url="electronics/cameras/digital-cameras.html"}}"&gt;Digital Cameras&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;/div&gt;\n\n\t\t\t&lt;/td&gt;\n\n\t\t\t&lt;td&gt;&lt;a href="{{store direct_url="acer-ferrari-3200-notebook-computer-pc.html"}}"&gt;&lt;img class="product-img" src="{{skin url='images/media/best_selling_img04.jpg'}}" border="0" width="95" /&gt;&lt;/a&gt;\n\n\t\t\t&lt;div class="product-description"&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\t&lt;a href="{{store direct_url="acer-ferrari-3200-notebook-computer-pc.html"}}"&gt;Acer Ferrari 3200 Notebook Computer PC&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\tSee all &lt;a href="{{store direct_url="electronics/computers/laptops.html"}}"&gt;Laptops&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;/div&gt;\n\n\t\t\t&lt;/td&gt;\n\n\t\t&lt;/tr&gt;\n\n\t\t&lt;tr class="odd"&gt;\n\n\t\t\t&lt;td&gt;&lt;a href="{{store direct_url="asics-men-s-gel-kayano-xii.html"}}"&gt;&lt;img class="product-img" src="{{skin url='images/media/best_selling_img05.jpg'}}" border="0" width="95" /&gt;&lt;/a&gt;\n\n\t\t\t&lt;div class="product-description"&gt;\n\n\t\t\t&lt;p&gt;&lt;a href="{{store direct_url="asics-men-s-gel-kayano-xii.html"}}"&gt;ASICS&amp;reg; Men's GEL-Kayano&amp;reg; XII&lt;/a&gt;&lt;/p&gt;\n\n\t\t\t&lt;p&gt;See all &lt;a href="{{store direct_url="apparel/shoes.html"}}"&gt;Shoes&lt;/a&gt;&lt;/p&gt;\n\n\t\t\t&lt;/div&gt;\n\n\t\t\t&lt;/td&gt;\n\n\t\t\t&lt;td&gt;&lt;a href="{{store direct_url="coalesce-functioning-on-impatience-t-shirt.html"}}"&gt;&lt;img class="product-img" src="{{skin url='images/media/best_selling_img06.jpg'}}" border="0" width="95" /&gt;&lt;/a&gt;\n\n\t\t\t&lt;div class="product-description"&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\t&lt;a href="{{store direct_url="coalesce-functioning-on-impatience-t-shirt.html"}}"&gt;Coalesce: Functioning On Impatience T-Shirt&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;p&gt;\n\n\t\t\tSee all &lt;a href="{{store direct_url="apparel/shirts.html"}}"&gt;Shirts&lt;/a&gt;\n\n\t\t\t&lt;/p&gt;\n\n\t\t\t&lt;/div&gt;\n\n\t\t\t&lt;/td&gt;\n\n\t\t&lt;/tr&gt;\n\n\t&lt;/tbody&gt;\n\n&lt;/table&gt;\n\n&lt;/div&gt;\n\n&lt;/div&gt;   2007-08-23 10:03:25 2013-03-21 05:04:55 1   0   &lt;!--&lt;reference name="content"&gt;\n\n&lt;block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page"&gt;&lt;action method="addPriceBlockType"&gt;&lt;type&gt;bundle&lt;/type&gt;&lt;block&gt;bundle/catalog_product_price&lt;/block&gt;&lt;template&gt;bundle/catalog/product/price.phtml&lt;/template&gt;&lt;/action&gt;&lt;/block&gt;\n\n&lt;block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new"&gt;&lt;action method="addPriceBlockType"&gt;&lt;type&gt;bundle&lt;/type&gt;&lt;block&gt;bundle/catalog_product_price&lt;/block&gt;&lt;template&gt;bundle/catalog/product/price.phtml&lt;/template&gt;&lt;/action&gt;&lt;/block&gt;\n\n&lt;block type="reports/product_compared" name="home.reports.product.compared" template="reports/home_product_compared.phtml" after="product_viewed"&gt;&lt;action method="addPriceBlockType"&gt;&lt;type&gt;bundle&lt;/type&gt;&lt;block&gt;bundle/catalog_product_price&lt;/block&gt;&lt;template&gt;bundle/catalog/product/price.phtml&lt;/template&gt;&lt;/action&gt;&lt;/block&gt;\n\n&lt;/reference&gt;&lt;reference name="right"&gt;\n\n&lt;action method="unsetChild"&gt;&lt;alias&gt;right.reports.product.viewed&lt;/alias&gt;&lt;/action&gt;\n\n&lt;action method="unsetChild"&gt;&lt;alias&gt;right.reports.product.compared&lt;/alias&gt;&lt;/action&gt;\n\n&lt;/reference&gt;--&gt;    NULL    NULL    NULL    NULL    NULL
...
</code></pre>
<p>Again, this query is run using the standard mysql client tool — if you want the command line string use the <code>--only-command</code> flag.</p>
<pre><code>$ n98-magerun db:query --only-command "SELECT * FROM cms_page" 
mysql -h'localhost' -u'root' -p'ididit27' 'magento_example_com' -e 'SELECT * FROM cms_page'
</code></pre>
<p>Finally, a <code>db:drop</code> command is included as well, allowing you to drop the entire database.  Given my bias against having such destructive commands at your finger tips, I&#8217;ll leave this one as an exercise for the reader.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-database-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Product Stock Alerts (not) working</title>
		<link>http://mage-page.net/2013/04/product-stock-alerts-not-working/</link>
		<comments>http://mage-page.net/2013/04/product-stock-alerts-not-working/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 11:33:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Inchoo]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/product-stock-alerts-not-working/</guid>
		<description><![CDATA[<p>Recently one of our clients had contacted us and he said that ProductAlert functionality doesn&#8217;t work any more. After I investigated the situation I saw that last email regarding to Stock Alerts was sent before several months. In a meanwhile we&#8217;ve upgraded site on Magento EE and I firstly thought that maybe during the upgrade something went wrong. Other thought was that maybe client has modified Transactional Email Template&#8230; After reviewing a log files I couldn&#8217;t find anything related to those emails. Other emails system does send.</p>
<p>In time of investigation I saw on forums that other developers around have similar issue that wasn&#8217;t resolved yet. After tracing and looking what might went wrong we&#8217;ve found that&#8230; If you&#8217;re interested in ...]]></description>
				<content:encoded><![CDATA[<p>Recently one of our clients had contacted us and he said that ProductAlert functionality doesn&#8217;t work any more. After I investigated the situation I saw that last email regarding to Stock Alerts was sent before several months. In a meanwhile we&#8217;ve upgraded site on Magento EE and I firstly thought that maybe during the upgrade something went wrong. Other thought was that maybe client has modified Transactional Email Template&#8230; After reviewing a log files I couldn&#8217;t find anything related to those emails. Other emails system does send.</p>
<p>In time of investigation I saw on forums that other developers around have similar issue that wasn&#8217;t resolved yet. After tracing and looking what might went wrong we&#8217;ve found that&#8230; If you&#8217;re interested in solution keep reading.<span></span></p>
<p>Shortly, issue was in Magento approach how they handle Product Stock Alert collection. Our client has more than 40 000 subscribers and more than 30 000 are waiting for status to be changed from &#8220;Out of Stock&#8221; to &#8220;In Stock&#8221;. So <strong>when Magento tries to load 40 000 records from table product_alert_stock to collection to foreach them because of memory limitation php fails</strong>. Probably if you have more than 20 000 records in table product_alert_stock your Product Stock Alert functionality doesn&#8217;t work anymore.</p>
<p>Solution was relatively simple. Divide collection by 1000 and create several pages to iterate through more than 30 000 recirds, in same way as Magento is doing in different places in it&#8217;s system. In our case we had around 35 pages, each with 1000 records in collection. <strong>New functionality is iterating through all of them and for each record where status=0 (unprocessed) system checks for product to see if product is now in stock.</strong> If that&#8217;s true =&gt; set status=1 and send an notification email to customer.</p>
<p>So let&#8217;s create our module, Inchoo_ProductAlert, that will enhance Magento&#8217;s approach:</p>
<h3>1. Create file in app/etc/modules/ Inchoo_ProductAlert.xml with the following content:</h3>
<p></p><pre class="crayon-plain-tag">&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;config&gt;
    &lt;modules&gt;
        &lt;Inchoo_ProductAlert&gt;
            &lt;active&gt;true&lt;/active&gt;
            &lt;codePool&gt;local&lt;/codePool&gt;
        &lt;/Inchoo_ProductAlert&gt;
    &lt;/modules&gt;
&lt;/config&gt;</pre><p></p>
<h3>2. Create file in app/code/local/Inchoo/ProductAlert/etc/ config.xml with the following content:</h3>
<p></p><pre class="crayon-plain-tag">&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;config&gt;
    &lt;modules&gt;
        &lt;Inchoo_ProductAlert&gt;
            &lt;version&gt;1.0.0.0&lt;/version&gt;
        &lt;/Inchoo_ProductAlert&gt;
    &lt;/modules&gt;
    &lt;global&gt;
        &lt;models&gt;
            &lt;productalert&gt;
                &lt;rewrite&gt;
                    &lt;observer&gt;Inchoo_ProductAlert_Model_Observer&lt;/observer&gt;
                &lt;/rewrite&gt;
            &lt;/productalert&gt;
        &lt;/models&gt;
    &lt;/global&gt;
&lt;/config&gt;</pre><p></p>
<p>You can see that we&#8217;ve rewritten Mage_ProductAlert_Model_Observer class</p>
<h3>3. Create file in /www/app/code/local/Inchoo/ProductAlert/Model/ Observer.php with the following content:</h3>
<p></p><pre class="crayon-plain-tag">&lt;?php
/**
 * ProductAlert observer
 *
 * @category   Inchoo
 * @package    Inchoo_ProductAlert
 * @author     &lt;ivan.galambos@inchoo.net&gt;
 */
class Inchoo_ProductAlert_Model_Observer extends Mage_ProductAlert_Model_Observer
{
     /**
     * Process stock emails
     *
     * @param Mage_ProductAlert_Model_Email $email
     * @return Mage_ProductAlert_Model_Observer
     */
    protected function _processStock(Mage_ProductAlert_Model_Email $email)
    {
        $email-&gt;setType('stock');
        foreach ($this-&gt;_getWebsites() as $website) {
            /* @var $website Mage_Core_Model_Website */
            if (!$website-&gt;getDefaultGroup() || !$website-&gt;getDefaultGroup()-&gt;getDefaultStore()) {
                continue;
            }
            if (!Mage::getStoreConfig(
                self::XML_PATH_STOCK_ALLOW,
                $website-&gt;getDefaultGroup()-&gt;getDefaultStore()-&gt;getId()
            )) {
                continue;
            }
            try {
                $wholeCollection = Mage::getModel('productalert/stock')
                    -&gt;getCollection()
//                    -&gt;addWebsiteFilter($website-&gt;getId())
                    -&gt;addFieldToFilter('website_id', $website-&gt;getId())
                    -&gt;addFieldToFilter('status', 0)
                ;
//                $wholeCollection-&gt;getSelect()-&gt;order('alert_stock_id DESC');
                /*       table: !product_alert_stock!
                alert_stock_id: 1
                   customer_id: 1
                    product_id: 1
                    website_id: 1
                      add_date: 2013-04-26 12:08:30
                     send_date: 2013-04-26 12:28:16
                    send_count: 2
                        status: 1
                */
            }
            catch (Exception $e) {
                Mage::log('error-1-collection $e=' . $e-&gt;getMessage(), false, 'product_alert_stock_error.log', true);
                $this-&gt;_errors[] = $e-&gt;getMessage();
                return $this;
            }
            $previousCustomer = null;
            $email-&gt;setWebsite($website);
            try {
                $originalCollection = $wholeCollection;
                $count = null;
                $page  = 1;
                $lPage = null;
                $break = false;
                while ($break !== true) {
                    $collection = clone $originalCollection;
                    $collection-&gt;setPageSize(1000);
                    $collection-&gt;setCurPage($page);
                    $collection-&gt;load();
                    if (is_null($count)) {
                        $count = $collection-&gt;getSize();
                        $lPage = $collection-&gt;getLastPageNumber();
                    }
                    if ($lPage == $page) {
                        $break = true;
                    }
                    Mage::log('page=' . $page, false, 'check_page_count.log', true);
                    Mage::log('collection=' . (string)$collection-&gt;getSelect(), false, 'check_page_count.log', true);
                    $page ++;
                    foreach ($collection as $alert) {
                        try {
                            if (!$previousCustomer || $previousCustomer-&gt;getId() != $alert-&gt;getCustomerId()) {
                                $customer = Mage::getModel('customer/customer')-&gt;load($alert-&gt;getCustomerId());
                                if ($previousCustomer) {
                                    $email-&gt;send();
                                }
                                if (!$customer) {
                                    continue;
                                }
                                $previousCustomer = $customer;
                                $email-&gt;clean();
                                $email-&gt;setCustomer($customer);
                            }
                            else {
                                $customer = $previousCustomer;
                            }
                            $product = Mage::getModel('catalog/product')
                                -&gt;setStoreId($website-&gt;getDefaultStore()-&gt;getId())
                                -&gt;load($alert-&gt;getProductId());
                            /* @var $product Mage_Catalog_Model_Product */
                            if (!$product) {
                                continue;
                            }
                            $product-&gt;setCustomerGroupId($customer-&gt;getGroupId());
                            if ($product-&gt;isSalable()) {
                                $email-&gt;addStockProduct($product);
                                $alert-&gt;setSendDate(Mage::getModel('core/date')-&gt;gmtDate());
                                $alert-&gt;setSendCount($alert-&gt;getSendCount() + 1);
                                $alert-&gt;setStatus(1);
                                $alert-&gt;save();
                            }
                        }
                        catch (Exception $e) {
                            Mage::log('error-2-alert $e=' . $e-&gt;getMessage(), false, 'product_alert_stock_error.log', true);
                            $this-&gt;_errors[] = $e-&gt;getMessage();
                        }
                    }
                }
                Mage::log(&quot;\n\n&quot;, false, 'check_page_count.log', true);
            } catch (Exception $e) {
                Mage::log('error-3-steps $e=' . $e-&gt;getMessage(), false, 'product_alert_stock_error.log', true);
            }
            if ($previousCustomer) {
                try {
                    $email-&gt;send();
                }
                catch (Exception $e) {
                    $this-&gt;_errors[] = $e-&gt;getMessage();
                }
            }
        }
        return $this;
    }
    /**
     * Run process send product alerts
     *
     * @return Inchoo_ProductAlert_Model_Observer
     */
    public function process()
    {
        Mage::log('ProductAlert started @' . now(), false, 'product_alert_workflow.log', true);
        $email = Mage::getModel('productalert/email');
        /* @var $email Mage_ProductAlert_Model_Email */
        $this-&gt;_processPrice($email);
        $this-&gt;_processStock($email);
        $this-&gt;_sendErrorEmail();
        Mage::log('ProductAlert finished @' . now(), false, 'product_alert_workflow.log', true);
        return $this;
    }
}</pre><p></p>
<p>You can see that we&#8217;ve overwritten 2 methods: process() and _processStock().<br />
In process() method we added Mage::log() for creating start&#038;end time in var/log/product_alert_workflow.log so we can know did script finish with it&#8217;s execution. Similarly to debug our enhancement in _processStock() method, we added few more Mage:log() calls so we can track if everything behave in the expected way.</p>
<p>For the end, if you don&#8217;t want to wait for your cron to be triggered, you can create a file in Magento root, let&#8217;s call it,</p>
<h3>inchoo_cron.php:</h3>
<p></p><pre class="crayon-plain-tag">&lt;?php
/**
 * @author     &lt;ivan.galambos@inchoo.net&gt;
 */
require_once 'app/Mage.php';
Mage::app();
try {
    Mage::getModel('productalert/observer')-&gt;process();
} catch (Exception $e) {
    Mage::log('error-0-start $e=' . $e-&gt;getMessage() . ' @' . now(), false, 'product_alert_stock_error.log', true);
}</pre><p></p>
<p>And that&#8217;s about it. Feel free after testing your functionality to remove/comment Mage::log() calls. And if you have similar issue with Product Alert Price functinality you can apply same idea and everything should work fine.</p>
<p>3 log files are going to be created if you apply this enhancement without removing Mage::log() calls:</p>
<ul>
<li><strong>product_alert_workflow</strong>.log &#8211; log start&#038;end time for each call to script</li>
<li><strong>check_page_count</strong>.log &#8211; log #of pages and query that should be run</li>
<li><strong>product_alert_stock_error</strong>.log &#8211; error messages from 0-3 places in code</li>
</ul>
<p>That&#8217;s about it. </p>
<p>Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/product-stock-alerts-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Indexing, Magento Connect, and Grab Bag</title>
		<link>http://mage-page.net/2013/04/n98-magerun-indexing-magento-connect-and-grab-bag/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-indexing-magento-connect-and-grab-bag/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 21:12:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-indexing-magento-connect-and-grab-bag/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>We&#8217;re almost at the end of our <code>n98-magerun</code> command review.  Today we&#8217;re going to blitz through the remaining commands on our plate</p>

<pre><code>$ n98-magerun list local
    Available commands for the "local-config:generate" namespace:
      local-config:generate   Generates local.xml config

$ n98-magerun list index
    Available commands for the "index" namespace:
      index:list          Lists all magento indexes
      index:reindex       Reindex a magento index by code
      index:reindex:all   Reindex all magento ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>We&#8217;re almost at the end of our <code>n98-magerun</code> command review.  Today we&#8217;re going to blitz through the remaining commands on our plate</p>
<pre><code>$ n98-magerun list local
    Available commands for the "local-config:generate" namespace:
      local-config:generate   Generates local.xml config

$ n98-magerun list index
    Available commands for the "index" namespace:
      index:list          Lists all magento indexes
      index:reindex       Reindex a magento index by code
      index:reindex:all   Reindex all magento indexes

$ n98-magerun list extension
    Available commands for the "extension" namespace:
      extension:download   Download magento-connect package
      extension:install    Install magento-connect package
      extension:list       List magento connection extensions
      extension:search     List magento connection extensions
      extension:upgrade    Upgrade magento-connect package
</code></pre>
<p>Let&#8217;s get to it.</p>
<h2>Local Config</h2>
<p>The <code>local-config:generate</code> command will recreate the local configuration file at <code>app/etc/local.xml</code>.</p>
<pre><code>$ n98-magerun local-config:generate

  Generate Magento local.xml  

Please enter the database host:localhost
Please enter the database username:merlin
Please enter the database password:password12345
Please enter the database name:magento_example_com
Please enter the session save:file
Please enter the admin frontname:admin
Generated config
</code></pre>
<p>This file is the first one loaded into the global configuration tree, and is generated by installing Magento. This command appears to exist as a fix for stores with a missing <code>local.xml</code>.  Consider the results if you run the command with <code>app/etc/local.xml</code> in place.</p>
<pre><code>$ n98-magerun local-config:generate
local.xml file already exists in folder "/path/to/magento/app/etc"
</code></pre>
<p>Also, <code>local-config:generate</code> relies on the existence of the <code>app/etc/local.xml.template</code> file that ships with Magento.  Running the command without this will result in the following error.</p>
<pre><code>File /Users/alanstorm/Sites2012/magento1point7pointzeropoint1.dev/app/etc/local.xml.template does not exist.
</code></pre>
<p>Finally, while there are interactive prompts for entering data, the script does <strong>no</strong> validation on the values.  Database credentials aren&#8217;t checked, it&#8217;s possible to enter an invalid session save type, etc.  Keep your wits about you when using this command.</p>
<h2>Indexer Commands</h2>
<p>The <code>index</code> category contains three commands for working with Magento&#8217;s indexes.  These commands are very similar to the <code>shell/indexer.php</code> script that ships with Magento.  For those new to the platform, a Magento &#8220;index&#8221; is conceptually like an index on a database column, but a more practical definition might be</p>
<p>&gt; An index takes data Magento either stores across many tables in a normalized-(ish) way or calculates, and then de-normalizes or caches it for performance and convenience reasons.</p>
<p>You can use the <code>index:list</code> command to fetch a list of all known Magento indexers, (also known as &#8220;index processes&#8221;).</p>
<pre><code>$ n98-magerun index:list

  Index list  

+---------------------------+-----------------+--------+
| code                      | status          | time   |
+---------------------------+-----------------+--------+
| catalog_product_attribute | pending         | 0      |
| catalog_product_price     | pending         | 2m 52s |
| catalog_url               | pending         | 5s     |
| catalog_product_flat      | pending         | 1m 27s |
| catalog_category_flat     | require_reindex | 1s     |
| catalog_category_product  | pending         | 0      |
| catalogsearch_fulltext    | pending         | 3s     |
| cataloginventory_stock    | pending         | 1s     |
| tag_summary               | pending         | 0      |
+---------------------------+-----------------+--------+
</code></pre>
<p>The <code>status</code> column indicates if Magento thinks a re-index is required (<code>pending</code> being the normal status), and the <code>time</code> column indicates how long the last re-index took.</p>
<p>You can run a specific index process with the <code>index:reindex</code> command</p>
<pre><code>$ n98-magerun index:reindex
$ n98-magerun index:reindex catalog_url

  Reindex  

Started reindex of: catalog_url
Estimated end: 2013-04-23 04:41:27 UTC
Successfully reindexed catalog_url (Runtime: 5s)
</code></pre>
<p>or re-index everything with the <code>index:reindex:all</code> command.</p>
<pre><code>$ n98-magerun index:reindex:all
Successfully reindexed catalog_product_attribute
Successfully reindexed catalog_product_price
Successfully reindexed catalog_url
Successfully reindexed catalog_product_flat
Successfully reindexed catalog_category_flat
Successfully reindexed catalog_category_product
Successfully reindexed catalogsearch_fulltext
Successfully reindexed cataloginventory_stock
Successfully reindexed tag_summary
</code></pre>
<h2>Magento Connect Commands</h2>
<p>The <code>extension</code> category contains commands related to Magento Connect.  Magento Connect is the repository of free Magento extensions maintained by eBay Inc.&#8217;s Magento division, as well as the ecosystem of tools for installing the extension packages.</p>
<p>While the <code>extension</code> commands may seem like a replacement for the bundled <code>./mage</code> script, these commands are  just wrappers for calls to <code>./mage</code>.  You&#8217;ll still need a fully installed and configured Magento Connect to run these commands.</p>
<p>The <code>extension:list</code> command will display a list of <strong>every Magento Connect extension</strong> that&#8217;s available.  As of this writing that&#8217;s 3800 extensions.</p>
<pre><code>$ mn98-magerun extension:list 
+---------------------+--------------------+--------+
| Package             | Version            | Stabi  |
+---------------------+--------------------+--------+
| Lib_Js_Calendar     | 1.51.1.1           | stable |
| Lib_Js_Ext          | 1.7.0.0            | stable |
| ... snipped ...     |                    |        |
| Ivan_ImageZoom      | 2.0.0              | stable |
| fullpagecache       | 1.0.0              | stable |
+---------------------+--------------------+--------+
</code></pre>
<p>If you&#8217;re looking for a specific extension, you can perform <a href="http://us2.php.net/stristr">a simple <code>stristr</code> search</a> on the name with the <code>extension:search</code> command.</p>
<pre><code>$ mn98-magerun extension:search Mage

+-------------------------+----------------+--------+
| Package                 | Version        | Stabi  |
+-------------------------+----------------+--------+
| Mage_Pear_Helpers       | 1.0.18800      | stable |
| Mage_All                | 1.0.19870      | stable |
| Mage_Oscommerce         | 1.1.20123      | dev    |
| Mage_Checkout           | 1.0            | dev    |
| Mage_Strikeiron         | 1.0.18800      | stable |
| Locale_Mage_Core_fr_FR  | 1.0.18800      | beta   |
| ... snipped ...         |                |        |
| mageokcustomoptions     | 1.0.0.0        | alpha  |
| Ivan_ImageZoom          | 2.0.0          | stable |
+-------------------------+----------------+--------+
</code></pre>
<p>Keep in mind <code>stristr</code>&#8217;s search is not a sophisticated algorithm. You&#8217;ll notice our search returned <code>Ivan_ImageZoom</code> due to the <code>mage</code> in <code>Image</code>.</p>
<p>Once you&#8217;ve found the extension you&#8217;re looking for, you may download it with the <code>extension:download</code> command</p>
<pre><code>$ n98-magerun extension:download Pulsestorm_Launcher
Saved to: /path/to/magento/downloader/.cache/community/Pulsestorm_Launcher-1.0.3.tgz
</code></pre>
<p>You can also download and automatically install a package with <code>extension:install</code>.</p>
<pre><code>$ n98-magerun extension:install Pulsestorm_Launcher
Checking dependencies of packages
Starting to download Pulsestorm_Launcher-1.0.3.tgz ...
...done: 8,946 bytes
Installing package community/Pulsestorm_Launcher 1.0.3
Package community/Pulsestorm_Launcher 1.0.3 installed successfully
Package installed: community/Pulsestorm_Launcher 1.0.3
</code></pre>
<p>And finally, you can use the <code>extension:upgrade</code> command to check-for-then-automatically-install an upgrade for an extension.</p>
<pre><code>$ n98-magerun extension:upgrade Pulsestorm_Launcher
Checking dependencies of packages
Already installed: community/Pulsestorm_Launcher 1.0.3, skipping
</code></pre>
<p>In the example above <code>n98-magerun</code> is telling us it didn&#8217;t do anything, since the latest version of the <a href="http://www.magentocommerce.com/magento-connect/pulse-storm-launcher-8493.html">Pulse Storm Launcher</a> is already installed.  That points to one of the weaknesses of the <code>extension</code> category of commands.  While the commands here are useful, you&#8217;ll still need to rely on <code>./mage</code> (or the Connect GUI) if you want to view a list of available upgrades, uninstall an extension, etc.</p>
<h2>Wrap Up</h2>
<p>And that completes our <em>command</em> coverage of <code>n98-magerun</code>.  There&#8217;s a few other commands that are worth checking out on your own.  The <code>cms</code> category has two commands that are Magento Enterprise Edition only, <code>cms:banner:toggle</code> for publishing a banner, and <code>cms:page:publish</code> for publishing a specific CMS page.  There&#8217;s also a <code>design:demo-notice</code> command which can toggle a demo notice on/off in your store.</p>
<p>Next time we&#8217;ll start digging into setting up your own <code>n98-magerun</code> development environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-indexing-magento-connect-and-grab-bag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Community Edition (CE) 1.8.0.0 Alpha &#8211; Now Available!</title>
		<link>http://mage-page.net/2013/04/magento-community-edition-ce-1-8-0-0-alpha-now-available/</link>
		<comments>http://mage-page.net/2013/04/magento-community-edition-ce-1-8-0-0-alpha-now-available/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 04:10:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento, Inc.]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/magento-community-edition-ce-1-8-0-0-alpha-now-available/</guid>
		<description><![CDATA[<p>We are excited to announce the release of Magento Community Edition 1.8.0.0- alpha1, available now for preview. This release focuses on major quality and stability improvements, performance enhancements and security</p>

<p>Key highlights include:</p>

<p><h3>Performance Improvements</h3></p>
This release provides better performance in a number of ways, including improved performance of the checkout process, optimized cache adapters for single-server systems and speedier large database lookups. You can even load a large number of tax rates (3,000+) without any impact to performance.

<p><h3>Enhanced Tax Calculation Algorithms</h3></p>
This latest version of Magento Community Edition improves tax calculation algorithms, eliminating potential rounding offsets that can be displayed on buyer facing screens. This release also provides additional support for Canadian tax requirements.

<p><h3>Functional Improvements</h3></p>
We have made approximately 350 functional improvements in key ...]]></description>
				<content:encoded><![CDATA[<p>We are excited to announce the release of Magento Community Edition 1.8.0.0- alpha1, available now for preview. This release focuses on major quality and stability improvements, performance enhancements and security</p>
<p>Key highlights include:</p>
<p>
<h3>Performance Improvements</h3>
</p>
<p>This release provides better performance in a number of ways, including improved performance of the checkout process, optimized cache adapters for single-server systems and speedier large database lookups. You can even load a large number of tax rates (3,000+) without any impact to performance.</p>
<p>
<h3>Enhanced Tax Calculation Algorithms</h3>
</p>
<p>This latest version of Magento Community Edition improves tax calculation algorithms, eliminating potential rounding offsets that can be displayed on buyer facing screens. This release also provides additional support for Canadian tax requirements.</p>
<p>
<h3>Functional Improvements</h3>
</p>
<p>We have made approximately 350 functional improvements in key areas, including the web store, shopping cart, admin order creation, import and export functionality, web API components and payment methods.</p>
<p>
<h3>Security Enhancements</h3>
</p>
<p>Through a number of enhancements, we have also strengthened the security of Magento Community Edition. Check out the full list of enhancements in our <a href="http://www.magentocommerce.com/knowledge-base/entry/ce-18-later-release-notes" title="Magento Community Edition (CE) 1.8.0.0 Alpha Release Notes">release notes</a>.</p>
<p>We encourage you to take this <a href="http://www.magentocommerce.com/download" title="Magento Community Edition (CE) 1.8.0.0 Alpha Preview Release">preview release</a> for a test drive and experiment with it. <b>Please note that we do not recommend that you use this release in a production environment.</b> We will incorporate the feedback we get from the community along with any open issues, in an upcoming production-ready version. <a href="http://www.magentocommerce.com/blog/comments/new-community-edition-release-process/" title="Learn more about alpha releases">Learn more</a> about alpha releases and the Magento Community Edition release process.</p>
<p><a href="http://www.magentocommerce.com/download" title="Download the Community Edition 1.8-alpha1 preview release"><img src="http://www.magentocommerce.com/images/uploads/download.png" style="border: 0;padding-top: 10px" alt="image" width="165" height="29" /></a></p>
<p>
<hr style="border:none;background:#bbb;height:1px;overflow:hidden" />
<!--table cellpadding="0" cellspacing="0" border="0"&gt;<br />
<tr>
<td valign="top" width="347" align="left"><a href="https://www.paypal.com/webapps/mpp/new-payment-solutions"><img src="http://info.magento.com/rs/magentocommerce/images/PayPal_Checkmark_347x150.gif" /></a></td>
<td valign="top" width="347" align="left"><a href="http://www.magentocommerce.com/go/"><img src="http://www.magentocommerce.com/images/uploads/0931_RSSFooterMainBlog_R1.jpg" /></a></td>
<p>&lt;/table&#8211;></p>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" width="694" align="left"><a href="http://www.magentocommerce.com/product/enterprise-edition?utm_source=Magento&amp;utm_medium=Banner&amp;utm_campaign=RSSFeed"><img src="http://www.magentocommerce.com/images/uploads/rss-feed-footer-for-magento-blog.jpg" style="border: 0" alt="image" width="694" height="150" /></a></td>
</tr>
</table>
<div>
<a href="http://feeds.feedburner.com/~ff/magento?a=OUu159P4M0k:DKTBA5v9pvE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/magento?d=yIl2AUoC8zA" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/magento?a=OUu159P4M0k:DKTBA5v9pvE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/magento?d=7Q72WNTAKBA" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/magento?a=OUu159P4M0k:DKTBA5v9pvE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/magento?i=OUu159P4M0k:DKTBA5v9pvE:V_sGLiPBpWU" border="0"/></a>
</div>
<p><img src="http://feeds.feedburner.com/~r/magento/~4/OUu159P4M0k" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/magento-community-edition-ce-1-8-0-0-alpha-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: System Commands</title>
		<link>http://mage-page.net/2013/04/n98-magerun-system-commands/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-system-commands/#comments</comments>
		<pubDate>Wed, 24 Apr 2013 18:50:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-system-commands/</guid>
		<description><![CDATA[<p>Today we&#8217;ll be covering the <code>n98-magerun</code> system (or <code>sys</code>) commands.</p>

<pre><code>$ n98-magerun.phar list sys

sys:check                        Checks Magento System
sys:cron:history                 Lists last executed jobs
sys:cron:list                    Lists all cronjobs
sys:cron:run                     Runs a cronjob by job code
sys:info              ...]]></description>
				<content:encoded><![CDATA[<p>Today we&#8217;ll be covering the <code>n98-magerun</code> system (or <code>sys</code>) commands.</p>
<pre><code>$ n98-magerun.phar list sys

sys:check                        Checks Magento System
sys:cron:history                 Lists last executed jobs
sys:cron:list                    Lists all cronjobs
sys:cron:run                     Runs a cronjob by job code
sys:info                         Prints infos about the current magento system.
sys:maintenance                  Toggles maintenance mode.
sys:modules:list                 List all installed modules
sys:setup:compare-versions       Compare module version with core_resource table.
sys:setup:run                    Runs all new setup scripts.
sys:store:config:base-url:list   Lists all base urls
sys:store:list                   Lists all installed store-views
sys:url:list                     Get all urls.
sys:website:list                 Lists all websites
</code></pre>
<p>These commands provide you with diagnostic information and allow you to perform common systems tasks from the comfort of <code>n98-magerun</code>&#8217;s command line interface.  Let&#8217;s get started.</p>
<h2>Maintenance Commands</h2>
<p>The <code>sys:info</code> command will print out some basic Magento system information.</p>
<pre><code>$ n98-magerun.phar sys:info

  Magento System Information  

Version                  : 1.7.0.1
Edition                  : Community
Cache Backend            : Zend_Cache_Backend_File
Cache Directory          : /path/to/magento/var/cache
Session                  : files
Crypt Key                : 18cea96f92f35a540d83a2fe7f33c005
Install Date             : Sun, 01 Jul 2012 17:06:09 +0000
</code></pre>
<p>This is one of those quick sanity check commands to help get your bearings in a new system, as well as ensure additional XML files aren&#8217;t interfering with the settings in <code>app/etc/local.xml</code>.</p>
<p>The <code>sys:check</code> command will run through a number of basic tests that ensure your Magento and PHP systems still contain the features, folders, and files needed to run Magento.</p>
<pre><code>$ n98-magerun.phar sys:check

  Check: Filesystem                           

Folder media found.
Folder var found.
Folder var/cache found.
Folder var/session found.
File app/etc/local.xml found.
File index.php.sample found.

  Check: PHP                    

Required PHP Module simplexml found.
Required PHP Module mcrypt found.
Required PHP Module hash found.
Required PHP Module gd found.
Required PHP Module dom found.
Required PHP Module iconv found.
Required PHP Module curl found.
Required PHP Module soap found.
Required PHP Module pdo found.
Required PHP Module pdo_mysql found.
Bytecode Cache apc found.

  Check: Security                         

app/etc/local.xml cannot be accessed from outside.

  Check: MySQL  

MySQL Version 5.5.29 found.
Required MySQL Storage Engine InnoDB found.
</code></pre>
<p>This is another command that&#8217;s useful to run when you inherit an existing Magento system.</p>
<p>If you end up finding something that needs to be fixed and you want to take the store down while you deploy a solution, the <code>sys:maintenance</code> command can be used to flip Magento in and out of maintenance mode.</p>
<pre><code>$ n98-magerun.phar sys:maintenance
Maintenance mode on

$ n98-magerun.phar sys:maintenance
Maintenance mode off
</code></pre>
<p>When Magento&#8217;s in maintenance mode, a &#8220;this site down for maintenance&#8221; placeholder page is rendered for all URLs.   This is normally controlled by the presence of a file named <code>maintenance.flag</code> in Magneto&#8217;s root folder, and all <code>sys:maintenance</code> does is create/delete this flag file.</p>
<p>The <code>sys:setup:compare-versions</code> command will compare the configured module versions with what&#8217;s in the <code>core_resource</code> table.</p>
<pre><code>$ n98-magerun.phar  sys:setup:compare-versions
┌────────────────────────────────────────┬──────────┬──────────┬──────────┬──────┐
│Setup                                   │Module    │DB        │Data      │Status│
├────────────────────────────────────────┼──────────┼──────────┼──────────┼──────┤
│default_setup                           │          │          │          │OK    │
├────────────────────────────────────────┼──────────┼──────────┼──────────┼──────┤
│default_write                           │          │          │          │OK    │
├────────────────────────────────────────┼──────────┼──────────┼──────────┼──────┤
│default_read                            │          │          │          │OK    │
├────────────────────────────────────────┼──────────┼──────────┼──────────┼──────┤
│core_setup                              │1.6.0.2   │1.6.0.2   │1.6.0.2   │OK    │
...
├────────────────────────────────────────┼──────────┼──────────┼──────────┼──────┤
│ajaxify_read                            │          │          │          │OK    │
└────────────────────────────────────────┴──────────┴──────────┴──────────┴──────┘

  No setup problems was found. 
</code></pre>
<p>Magento&#8217;s setup resources are similar to database migrations in other software systems.  They&#8217;re used to update the database when an extension is installed or upgraded.  This command makes sure that the modules in the system have installed their data, which is helpful when  diagnosing a setup script that&#8217;s not running.</p>
<p>Normally, setup resource scripts run automatically when Magento&#8217;s cache state is refreshed.  When a new page is loaded, an uncached Magento will check for new scripts to run, and then run them.  Because browsers themselves often cache pages, this can lead to situations where it&#8217;s not clear if a script has run or not.  That&#8217;s why we have the <code>sys:setup:run</code> command.  This command will automatically run any new setup resource scripts.</p>
<pre><code>$ n98-magerun.phar sys:setup:run
done
</code></pre>
<p>The command works by clearing Magento&#8217;s cache and then calling the <code>Mage_Core_Model_Resource_Setup::applyAllUpdates()</code> and <code>Mage_Core_Model_Resource_Setup::applyAllDataUpdates</code> methods.  Use it with care if your system is susceptible to cache warming problems.</p>
<h2>Cron Commands</h2>
<p>The <code>sys:cron</code> category provides insight into Magento&#8217;s normally opaque cron system.  These commands are related to Magento&#8217;s <strong>internal</strong> cron system, and not the external <code>*nix</code> cron.</p>
<p>The <code>sys:cron:list</code> command will examine the merged Magento <code>config.xml</code> tree and list out all properly configured cron jobs.</p>
<pre><code>$ n98-magerun.phar sys:cron:list

  Cronjob List  

    +-----------------------------------------+------+----+----+----+----+
    | Job                                     | m    | h  | D  | M  | WD |
    +-----------------------------------------+------+----+----+----+----+
    | aggregate_sales_report_bestsellers_data | 0    | 0  | *  | *  | *  |
    | aggregate_sales_report_coupons_data     | 0    | 0  | *  | *  | *  |
    | aggregate_sales_report_invoiced_data    | 0    | 0  | *  | *  | *  |
    | aggregate_sales_report_order_data       | 0    | 0  | *  | *  | *  |
    | aggregate_sales_report_refunded_data    | 0    | 0  | *  | *  | *  |
    | aggregate_sales_report_shipment_data    | 0    | 0  | *  | *  | *  |
    | aggregate_sales_report_tax_data         | 0    | 0  | *  | *  | *  |
    | captcha_delete_expired_images           | */10 | *  | *  | *  | *  |
    | captcha_delete_old_attempts             | */30 | *  | *  | *  | *  |
    | catalog_product_alert                   |      |    |    |    |    |
    | catalog_product_index_price_reindex_all | 0    | 2  | *  | *  | *  |
    | catalogrule_apply_all                   | 0    | 1  | *  | *  | *  |
    | core_clean_cache                        | 30   | 2  | *  | *  | *  |
    | currency_rates_update                   |      |    |    |    |    |
    | log_clean                               |      |    |    |    |    |
    | newsletter_send_all                     | */5  | *  | *  | *  | *  |
    | paypal_fetch_settlement_reports         |      |    |    |    |    |
    | persistent_clear_expired                | 0    | 0  | *  | *  | *  |
    | sales_clean_quotes                      | 0    | 0  | *  | *  | *  |
    | sitemap_generate                        |      |    |    |    |    |
    | system_backup                           |      |    |    |    |    |
    +-----------------------------------------+------+----+----+----+----+
</code></pre>
<p>If you&#8217;re trying to setup a custom cron job, this command is offers invaluable help in making sure your nodes are in the right spot and that  your minute, hour, day, month, day-of-the-week entries are correct.</p>
<p>There&#8217;s also a command (<code>sys:cron:run</code>) for manually running a cron job.</p>
<pre><code>$ n98-magerun.phar sys:cron:run log_clean
Run Mage_Log_Model_Cron::logClean done
</code></pre>
<p>This can be invaluable when you&#8217;re developing a new cron script, or debugging features that rely heavily on cron interaction.</p>
<p>The last cron command is <code>sys:cron:history</code>.</p>
<pre><code>$ n98-magerun.phar sys:cron:history

  Last executed jobs                        

+-----------+---------+---------------------+
| Job       | Status  | Finished            |
+-----------+---------+---------------------+
| log_clean | success | 2013-04-22 21:35:01 |
+-----------+---------+---------------------+
</code></pre>
<p>This will list out the last time each configured cron job has run (assuming they&#8217;ve run at all).  This is another one of those commands that&#8217;s useful when inheriting a Magento system.  In the example above, only the <code>log_clean</code> cron job has run.  This probably means the <code>cron.php</code> script (which runs Magento&#8217;s cron) was never setup correctly.</p>
<h2>Information Commands</h2>
<p>The <code>sys:modules:list</code> command is an alias for the <a href="http://magento-quickies.tumblr.com/post/48706331939/n98-magenrun-development-commands-part-2">already covered</a> <code>dev:module:list</code> command, and will list all the installed modules in the system.</p>
<pre><code>$ n98-magerun.phar.phar dev:module:list

  Magento Modules

+-----------+--------------------------------------+------------+----------+
| codePool  | Name                                 | Version    | Status   |
+-----------+--------------------------------------+------------+----------+
| core      | Mage_Core                            | 1.6.0.2    | active   |
| core      | Mage_Eav                             | 1.6.0.0    | active   |
...
</code></pre>
<p>According to the source code, <code>sys:modules:list</code> is depreciated, so you&#8217;re better off using <code>dev:module:list</code> in any shell scripts you write.</p>
<p>The <code>sys:store:list</code> command provides a list of all store view IDs and codes.</p>
<pre><code>$ n98-magerun.phar sys:store:list

  Magento Stores  

+-----+-------------------+
| id  | code              |
+-----+-------------------+
|   1 | default           |
|   2 | german            |
|   3 | french            |
|   4 | second_store_view |
+-----+-------------------+
</code></pre>
<p>The <code>sys:website:list</code> command does the same, except for Magento&#8217;s &#8220;website&#8221; objects.</p>
<pre><code>$ n98-magerun.phar sys:website:list

  Magento Websites  

+-----+----------------+
| id  | code           |
+-----+----------------+
|   1 | base           |
|   2 | second_website |
+-----+----------------+
</code></pre>
<p>The <code>sys:store:config:base-url:list</code> command will list the &#8220;base&#8221; url for each configured Magento store.</p>
<pre><code>$ n98-magerun.phar sys:store:config:base-url:list

  Magento Stores - Base URLs  

+-----+-------------------+-----------------------------+-----------------------------+
| id  | code              | unsecure_baseurl            | secure_baseurl              |
+-----+-------------------+-----------------------------+-----------------------------+
|   1 | default           | <a href="http://magento.example.com/">http://magento.example.com/</a> | <a href="http://magento.example.com/">http://magento.example.com/</a> |
|   2 | german            | <a href="http://magento.example.com/">http://magento.example.com/</a> | <a href="http://magento.example.com/">http://magento.example.com/</a> |
|   3 | french            | <a href="http://magento.example.com/">http://magento.example.com/</a> | <a href="http://magento.example.com/">http://magento.example.com/</a> |
|   4 | second_store_view | <a href="http://magento.example.com/">http://magento.example.com/</a> | <a href="http://magento.example.com/">http://magento.example.com/</a> |
+-----+-------------------+-------------------------------------------+---------------+
</code></pre>
<p>Magento allows users to set the base URL for a store in the <code>System -&gt; Configuration -&gt; Web</code> section of the system configuration.  This base URL will be used to generate all links and URLs in a particular Magento store.  The <code>sys:store:config:base-url:list</code> command is a nice sanity check if you&#8217;re seeing weird URL behavior, or working with systems that have myriad apache URL configurations pointing at a system.  It&#8217;s also a quick way to make sure a site&#8217;s using <code>https</code> urls for secure links (in the above example, you can see <code>secure_baseurl</code> is NOT doing this &#8212; no PCI for you).</p>
<p>Finally, the <code>sys:url:list</code> command will gather together and list Magento&#8217;s more &#8220;programatic&#8221; URLs for a particular store ID or code</p>
<pre><code>$ n98-magerun.phar sys:url:list --add-cmspages default
<a href="http://magento.example.com/">http://magento.example.com/</a>
<a href="http://magento.example.com/n98-magerun.phar/about-magento-demo-store">http://magento.example.com/n98-magerun.phar/about-magento-demo-store</a>
<a href="http://magento.example.com/n98-magerun.phar/customer-service">http://magento.example.com/n98-magerun.phar/customer-service</a>
<a href="http://magento.example.com/n98-magerun.phar/enable-cookies">http://magento.example.com/n98-magerun.phar/enable-cookies</a>
<a href="http://magento.example.com/n98-magerun.phar/privacy-policy-cookie-restriction-mode">http://magento.example.com/n98-magerun.phar/privacy-policy-cookie-restriction-mode</a>
<a href="http://magento.example.com/n98-magerun.phar/celebrity_home">http://magento.example.com/n98-magerun.phar/celebrity_home</a>
<a href="http://magento.example.com/n98-magerun.phar/celebrity_no_route">http://magento.example.com/n98-magerun.phar/celebrity_no_route</a>
<a href="http://magento.example.com/n98-magerun.phar/home">http://magento.example.com/n98-magerun.phar/home</a>
</code></pre>
<p>In the above example we&#8217;ve asked <code>sys:url:list</code> to give us all the CMS page URLs (<code>--add-cmspages</code>) for the <code>default</code> store view.  If you take a look at the command options, you can see it allows you to fetch CMS, products, and category URLs</p>
<pre><code>$ n98-magerun.phar help sys:url:list
...    
Options:
 --add-categories      Adds categories
 --add-products        Adds products
 --add-cmspages        Adds cms pages
 --add-all             Adds categories, products and cms pages
</code></pre>
<p>You could also list all three URL types with the <code>--add-all</code> option</p>
<pre><code>$ n98-magerun.phar sys:url:list --add-all default
</code></pre>
<p>Behind the scenes this command is using the resource models from the <code>sitemap</code> modules to gather together these URLs.  Keep in mind there may be more URLs browsable in your system via manual MVC routing, or rewrites added to the database/configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-system-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento 2 and Twig</title>
		<link>http://mage-page.net/2013/04/magento-2-and-twig/</link>
		<comments>http://mage-page.net/2013/04/magento-2-and-twig/#comments</comments>
		<pubDate>Wed, 24 Apr 2013 12:01:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Inchoo]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/magento-2-and-twig/</guid>
		<description><![CDATA[<p>Recently there has been some buzz around Magento getting support for Twig template engine. Looking at the CHANGELOG.markdown file under the Magento2 GitHub repository for 2.0.0.0-dev44 version commit, this seems to be more than just a buzz.<span></span> Here are the specific log entries mentioning the Twig:</p>
<ul>
<li>Introduced support for Twig templating</li>
<li>template rendering, including phtml, was abstracted into a Mage_Core_Block_Template_Engine to make support for other template engines easier</li>
<li>included Magento-specific Twig functions and filters</li>
<li>Converted product view page to demonstrate use of Twig templates and services</li>
</ul>
<p>So what exactly is Twig? Twig is a modern template engine for PHP, you can get it from <a href="http://twig.sensiolabs.org">http://twig.sensiolabs.org</a>. It is fast, secure and flexible, at least the “commercial” says so <img src="http://inchoo.net/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> . Twig ...]]></description>
				<content:encoded><![CDATA[<p>Recently there has been some buzz around Magento getting support for Twig template engine. Looking at the CHANGELOG.markdown file under the Magento2 GitHub repository for 2.0.0.0-dev44 version commit, this seems to be more than just a buzz.<span></span> Here are the specific log entries mentioning the Twig:</p>
<ul>
<li>Introduced support for Twig templating</li>
<li>template rendering, including phtml, was abstracted into a Mage_Core_Block_Template_Engine to make support for other template engines easier</li>
<li>included Magento-specific Twig functions and filters</li>
<li>Converted product view page to demonstrate use of Twig templates and services</li>
</ul>
<p>So what exactly is Twig? Twig is a modern template engine for PHP, you can get it from <a href="http://twig.sensiolabs.org">http://twig.sensiolabs.org</a>. It is fast, secure and flexible, at least the “commercial” says so <img src="http://inchoo.net/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> . Twig is developed by Fabien Potencier, the creator of the Symfony framework, and it is released under the new BSD license. </p>
<p>Even today, in 2013, there are many developers that will argue how PHP itself is a template engine itself so adding something like specialised template engines on top of it is an overkill. When you look at the Magento 1.x series, it uses pure PHP mixed with HTML within its *.phtml files, and the whole thing works. Well, it works more or less, until you get your developer assembling collection objects and coding in hundred of lines of business logic within .phtml file, logic that needs to be shared across few controllers, etc. Then the whole thing gets bunch of duplicated code, etc.</p>
<p>There are strong arguments why use template engine with PHP. I would strongly recommend reading the <a href="http://fabien.potencier.org/article/34/templating-engines-in-php">Templating Engines in PHP</a> article written by Fabien Potencier himself. Be worn doe, author himself has an article intro starting with “<em>This blog post is not for the faint-hearted!</em>”. I personally agree with his views and comments on the modern template language feature requirements such as: concision, template oriented syntax, reusability, security, etc. With that said, I personally welcome the support for Twig within Magento2.</p>
<p>So where are we with Magento 2 + Twig implementation. If you <em>git clone https://github.com/magento/magento2.git</em> project and pull it into your favorite IDE (NetBeans) then do a Find for “twig” string, you will get a result of “<em>Found 4,944 matches of twig in 397 files.</em>”. There is no point in listing all those files here, this is just to get a glimpse on things. Since everything major and core in Magento start from Mage_Core, if you do a same search on the /app/code/Mage/Core/ folder you will get a result of “<em>Found 47 matches of twig in 4 files.</em>”. Now this is the number of files we can start tracing from.</p>
<p>You can clearly see that there is a <em>Mage_Core_Block_Template_Engine_Twig</em> class that implements the <em>Mage_Core_Block_Template_EngineInterface</em> interface. I must say, this is a nice surprise, seeing Magento using interfaces. You can take this as a bit of sarcasm from my side given that Magento 1.x was all about class extending. Surprisingly, <em>Mage_Core_Block_Template_EngineInterface</em> interface is ultimately simple, it only holds one method “<em>public function render(Mage_Core_Block_Template $block, $templateFile, $vars);</em>”. Looking further at the <em>Mage_Core_Block_Template_Engine_Factory</em> class and its “<em>public function get($name)</em>” method, seems like built in stuff will cover standard *.phtml and new Twig templates.</p>
<p>I won’t go into further details about implementation and usage, maybe in some of my later articles, when I actually get to play with it.</p>
<p>To conclude, what I am personally hoping that the Twig templating support will achieve for Magento 2 is slightly cleaner 3rd party extension code in a first place. Primarily hoping not to see any more collection and business logic code within yesterdays *.phtml files, etc.</p>
<p>Would be interesting to hear your thought about this Magento move?</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/magento-2-and-twig/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unravelling Magento&#8217;s collectTotals: Introduction</title>
		<link>http://mage-page.net/2013/04/unravelling-magentos-collecttotals-introduction/</link>
		<comments>http://mage-page.net/2013/04/unravelling-magentos-collecttotals-introduction/#comments</comments>
		<pubDate>Wed, 24 Apr 2013 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Classy Llama]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/unravelling-magentos-collecttotals-introduction/</guid>
		<description><![CDATA[<div>
    <div>
            <div>
                    <img class="imagefield imagefield-field_banner_image" width="670" height="135" alt="" src="http://www.classyllama.com/sites/default/files/collectTotals-1.jpg?1366774276" />        </div>
        </div>
</div>
<p>In this series, I'll be explaining the process by which Magento handles calculating and displaying totals in the cart (i.e., subtotal, tax, discount, grand total, etc), and how to customize this process for your own purposes.</p>

<p>At its core, handling product prices and totals in an online shopping cart seems simple.  Multiply the cart quantities by product prices.  Add shipping. ...]]></description>
				<content:encoded><![CDATA[<div>
<div>
<div>
                    <img class="imagefield imagefield-field_banner_image" width="670" height="135" alt="" src="http://www.classyllama.com/sites/default/files/collectTotals-1.jpg?1366774276" />        </div>
</p></div>
</div>
<p>In this series, I&#8217;ll be explaining the process by which Magento handles calculating and displaying totals in the cart (i.e., subtotal, tax, discount, grand total, etc), and how to customize this process for your own purposes.</p>
<p>At its core, handling product prices and totals in an online shopping cart seems simple.  Multiply the cart quantities by product prices.  Add shipping.  Add tax.  And there you have it.  The first time you have reason to modify the way cart totals are calculated and displayed in Magento, however, what you&#8217;ll find is anything but simple.</p>
<p>&lt;!&#8211;</p>
<p>&#8211;&gt;</p>
<p><a href="http://www.classyllama.com/content/unravelling-magentos-collecttotals" target="_blank">read more</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/unravelling-magentos-collecttotals-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magenrun: Development Commands Part 2</title>
		<link>http://mage-page.net/2013/04/n98-magenrun-development-commands-part-2/</link>
		<comments>http://mage-page.net/2013/04/n98-magenrun-development-commands-part-2/#comments</comments>
		<pubDate>Tue, 23 Apr 2013 18:23:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magenrun-development-commands-part-2/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p><a href="http://magento-quickies.tumblr.com/post/48573495246/n98-magerun-development-toggle-commands">Last time</a> we covered the toggle related commands under the <code>dev</code> category.  Today we&#8217;ll be covering the remaining development commands</p>

<pre><code>dev:console                    Opens PHP interactive shell with initialized Mage::app() (Experimental)
dev:ide:phpstorm:meta          Generates meta data file for PhpStorm auto completion
dev:log:db                     Turn on/off database query logging
dev:log:size                ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p><a href="http://magento-quickies.tumblr.com/post/48573495246/n98-magerun-development-toggle-commands">Last time</a> we covered the toggle related commands under the <code>dev</code> category.  Today we&#8217;ll be covering the remaining development commands</p>
<pre><code>dev:console                    Opens PHP interactive shell with initialized Mage::app() (Experimental)
dev:ide:phpstorm:meta          Generates meta data file for PhpStorm auto completion
dev:log:db                     Turn on/off database query logging
dev:log:size                   Get size of log file
dev:module:create              Creates an registers new magento module.
dev:module:list                List all installed modules
dev:module:observer:list       Lists all registered observers
dev:module:rewrite:conflicts   Lists all magento rewrite conflicts
dev:module:rewrite:list        Lists all magento rewrites
dev:report:count               Get count of report files
dev:theme:duplicates           Find duplicate files in your theme
dev:theme:list                 Lists all available themes
</code></pre>
<p>Let&#8217;s get started.</p>
<h2>Miscellaneous Commands</h2>
<p>The <code>dev:console</code> command purports to offer an interactive shell for Magento PHP programming.  However, the feature is labeled as experimental, and currently <a href="https://github.com/netz98/n98-magerun/issues/101">has some blocking issues</a>.  That&#8217;s enough to put it on the skip list for now.</p>
<p>The <code>dev:ide:phpstorm:meta</code> command is for users of the PHP Storm IDE, (no relation)</p>
<pre><code>$ n98-magerun.phar dev:ide:phpstorm:meta
Generated definitions for blocks group
Generated definitions for helpers group
Generated definitions for models group
Generated definitions for resource models group
Generated definitions for resource helpers group
File .phpstorm.meta.php generated
</code></pre>
<p>This command will generate a PHP Storm meta-data file that allows the IDE to auto-complete code, intellisense style.  You can <a href="http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata">read about these meta-data files on the JetBrains</a> site.  I&#8217;m more a  <a href="http://ctags.sourceforge.net/">crusty old ctags crank</a>, so that&#8217;s all I know about that.</p>
<h2>Logging Commands</h2>
<p>The <code>dev:log:db</code> command might seem like it belongs in our toggle article, but it&#8217;s not a system configuration toggle.  Instead, this toggles <strong>database</strong> logging on or off.</p>
<p>What, what?!  Magento has database logging?  Let&#8217;s run the command</p>
<pre><code>$ n98-magerun.phar dev:log:db
Looking in /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php
Changed $_debug to true
Changed $_logAllQueries to true
Done. You can tail var/debug/pdo_mysql.log
</code></pre>
<p>Ah ha.  The <code>Varien_Db_Adapter_Pdo_Mysql</code> class has two protected properties, <code>$_debug</code> and <code>$_logAllQueries</code>.  These properties are used to toggle logging to the <code>var/debug/pdo_mysql.log</code> file.  However, Magento doesn&#8217;t offer a straightforward &#8220;public&#8221; programming interface to toggle these values.  So, the <code>dev:log:db</code> command <strong>modifies the core <code>Varien_Db_Adapter_Pdo_Mysql</code> library file</strong> to toggle these values to true.</p>
<p>You&#8217;ll need to make the decision on whether to use this command yourself.  Personally, I wouldn&#8217;t use it outside of my development environment.  The code that modifies this files is solid, but it&#8217;s regular expression based, and may blow up when it encounters an unexpected input file. This is less a comment on the skill of the Netz98 developers (which is legion), and more a comment on the <a href="http://stackoverflow.com/a/1732454/4668">seductive yet destructive powers of the regular expressions elder gods</a>.</p>
<p>Next up is the <code>dev:log:size</code> command.  This command can be used to monitor the size of your <code>var/log/system.log</code>, <code>var/log/exception.log</code>, and <code>pdo_mysql.log</code> files.</p>
<pre><code>$ n98-magerun.phar dev:log:size 
[1] exception.log
[2] system.log
[3] pdo_mysql.log
Please select a log file: 2
14438845
</code></pre>
<p>The file size will be listed in bytes.  You&#8217;ll need to do some maths, or <a href="https://www.google.com/search?safe=off&amp;q=14438845+bytes+in+MB&amp;oq=14438845+bytes+in+MB&amp;gs_l=serp.3..19.2724.4692.0.5028.6.6.0.0.0.0.79.330.6.6.0...0.0...1c.1.9.serp.zFksKNwzjNM">have google do them</a>, to <a href="https://github.com/netz98/n98-magerun/issues/124">get a human readable</a> file size ouf of the command.</p>
<p>The <code>dev:report:count</code> command is a similar reporting command.  This one will tell you how many &#8220;report&#8221; logs Magento has generated.</p>
<pre><code>$ n98-magerun.phar dev:report:count
</code></pre>
<p>Magento &#8220;reports&#8221; are PHP exceptions that, for some reason or another, couldn&#8217;t be caught in the main application try/catch block that  logs to <code>exception.log</code>.   Instead, Magento will log these exceptions to  <code>var/reports/</code>, one exception per file.</p>
<p>One possible use of the <code>dev:report:count</code> command would be in a cron to monitor this folder.  Another would be as a generic diagnostic step to see what&#8217;s going on with an unfamiliar system.</p>
<h2>Theme Commands</h2>
<p>There&#8217;s two commands under the <code>dev:theme</code> category, <code>dev:theme:list</code> and <code>dev:theme:duplicates</code>.  The <code>dev:theme:list</code> command will show you all the themes currently installed into your Magento system.</p>
<pre><code>$ n98-magerun.phar dev:theme:list
+-----------------+
| name            |
+-----------------+
| base/default    |
| default/blank   |
| default/default |
| default/iphone  |
| default/modern  |
+-----------------+
</code></pre>
<p>The results are in the standard <code>package-name/theme-name</code> format.</p>
<p>The <code>dev:theme:duplicates</code> command is used for theme cleanup.  Given two themes, it will tell you if they have identical theme files.</p>
<pre><code>$ n98-magerun.phar dev:theme:duplicates default/default
/path/to/magento/app/design/frontend/default/default/layout/customer.xml

$ n98-magerun.phar dev:theme:duplicates default/default base/default
/path/to/magento/app/design/frontend/default/default/layout/customer.xml    
</code></pre>
<p>In the above example, <code>n98-magerun</code> is telling us the <code>default/default</code> theme has an identical <code>customer.xml</code> file to the <code>base/default</code> theme (if omitted, the second argument defaults to <code>base/default</code>).  This command is mainly useful in cleaning up old &#8220;pre base design package&#8221; themes where the original <code>default</code> theme&#8217;s files were used as the starting point.</p>
<h2>Module Commands</h2>
<p>The last category of commands we&#8217;ll cover today are those under the <code>dev:module</code> hierarchy.  These are commands to help you with Magento&#8217;s strict module system.  That&#8217;s module as in Magento&#8217;s <strong>framework</strong> modules, and not Magento Connect extensions.  Magento Connect extensions are collections of files, Magento modules are code files organized in a special way such that the framework addresses them as a unit.</p>
<p>First, <code>dev:module:list</code> will list every module in the system.</p>
<pre><code>$ n98-magerun.phar dev:module:list

  Magento Modules

+-----------+--------------------------------------+------------+----------+
| codePool  | Name                                 | Version    | Status   |
+-----------+--------------------------------------+------------+----------+
| core      | Mage_Core                            | 1.6.0.2    | active   |
| core      | Mage_Eav                             | 1.6.0.0    | active   |
| core      | Mage_Page                            | 1.6.0.0    | active   |
| core      | Mage_Install                         | 0.7.0      | active   |
| core      | Mage_Admin                           | 1.6.1.0    | active   |
| core      | Mage_Rule                            | 1.6.0.0    | active   |
| core      | Mage_Adminhtml                       | 0.7.1      | active   |
| core      | Mage_AdminNotification               | 1.6.0.0    | active   |
| core      | Mage_Cron                            | 1.6.0.0    | active   |
| core      | Mage_Directory                       | 1.6.0.1    | active   |
| core      | Mage_Dataflow                        | 1.6.0.0    | active   |
| core      | Mage_Cms                             | 1.6.0.0.1  | active   |
| core      | Mage_Index                           | 1.6.0.0    | active   |
| core      | Mage_Customer                        | 1.6.2.0.1  | active   |
| core      | Mage_Catalog                         | 1.6.0.0.14 | active   |
| core      | Mage_CatalogRule                     | 1.6.0.3    | active   |
| core      | Mage_CatalogIndex                    | 1.6.0.0    | active   |
| core      | Mage_CatalogSearch                   | 1.6.0.0    | active   |
| core      | Mage_Payment                         | 1.6.0.0    | active   |
| core      | Mage_Sales                           | 1.6.0.7    | active   |
| core      | Mage_CatalogInventory                | 1.6.0.0.2  | active   |
| core      | Mage_Shipping                        | 1.6.0.0    | active   |
| core      | Mage_SalesRule                       | 1.6.0.3    | active   |
| core      | Mage_Usa                             | 1.6.0.1    | active   |
| core      | Mage_Paygate                         | 1.6.0.0    | active   |
| core      | Mage_Checkout                        | 1.6.0.0    | active   |
| core      | Mage_Backup                          | 1.6.0.0    | active   |
| core      | Mage_Paypal                          | 1.6.0.2    | active   |
| core      | Mage_Poll                            | 1.6.0.0    | active   |
| core      | Mage_GoogleCheckout                  | 1.6.0.1    | active   |
| core      | Mage_Log                             | 1.6.0.0    | active   |
| core      | Mage_Review                          | 1.6.0.0    | active   |
| core      | Mage_Rating                          | 1.6.0.0    | active   |
| core      | Mage_Widget                          | 1.6.0.0    | active   |
| core      | Mage_Tag                             | 1.6.0.0    | active   |
| core      | Mage_Reports                         | 1.6.0.0.1  | active   |
| core      | Mage_GoogleAnalytics                 | 1.6.0.0    | active   |
| core      | Mage_Tax                             | 1.6.0.3    | active   |
| core      | Mage_Wishlist                        | 1.6.0.0    | active   |
| core      | Mage_PaypalUk                        | 1.6.0.0    | active   |
| core      | Mage_Media                           | 1.6.0.0    | active   |
| core      | Mage_GiftMessage                     | 1.6.0.0    | active   |
| core      | Mage_Contacts                        | 1.6.0.0    | active   |
| core      | Mage_Sendfriend                      | 1.6.0.0    | active   |
| core      | Mage_Sitemap                         | 1.6.0.0    | active   |
| core      | Mage_Rss                             | 1.6.0.0    | active   |
| core      | Mage_ProductAlert                    | 1.6.0.0    | active   |
| core      | Mage_Api                             | 1.6.0.0    | active   |
| core      | Mage_Oauth                           | 1.0.0.0    | active   |
| core      | Mage_Authorizenet                    | 1.5.0.0    | active   |
| core      | Mage_Bundle                          | 1.6.0.0.1  | active   |
| core      | Mage_Captcha                         | 1.7.0.0.0  | active   |
| core      | Mage_Centinel                        | 1.6.0.0    | active   |
| core      | Mage_Compiler                        | 1.6.0.0    | active   |
| core      | Mage_Connect                         | 1.6.0.0    | active   |
| core      | Mage_Newsletter                      | 1.6.0.1    | active   |
| core      | Mage_Downloadable                    | 1.6.0.0.2  | active   |
| core      | Mage_ImportExport                    | 1.6.0.2    | active   |
| core      | Mage_Api2                            | 1.0.0.0    | active   |
| core      | Mage_PageCache                       | 1.6.0.0    | active   |
| core      | Mage_Persistent                      | 1.0.0.0    | active   |
| core      | Mage_Weee                            | 1.6.0.0    | active   |
| core      | Mage_CurrencySymbol                  | 1.0.0.0.0  | active   |
| core      | Mage_XmlConnect                      |            | inactive |
| local     | Alanstormdotcom_Commercebug          | 2.0.0      | active   |
| local     | Alanstormdotcom_Developermanual      | 1.1.2      | active   |
| local     | Alanstormdotcom_Systemsearch         | 0.1.0      | active   |
| local     | Alphacard_MageCatalogBlockNavigation |            | inactive |
| community | Belvg_Devhelper                      | 1.0.0      | active   |
| community | Fishpig_AttributeSplash              | 2.2.0.6    | active   |
| community | IG_LightBox2                         |            | active   |
| community | Insidetm_Integration                 | 0.1.0      | active   |
| local     | Nofrills_Booklayout                  | 0.1.0      | active   |
| community | Phoenix_Moneybookers                 | 1.6.0.0    | active   |
| community | Pulsestorm_Additemgrid               | 0.1.0      | active   |
| community | Pulsestorm_Chaos                     |            | active   |
| community | Pulsestorm_Contenttypes              | 0.1.0      | active   |
| community | Pulsestorm_Customerpage              | 0.1.0      | active   |
| community | Pulsestorm_Eschewxml                 | 0.1.0      | active   |
| community | Pulsestorm_Helloworld2               | 0.1.0      | active   |
| community | Pulsestorm_Launcher                  | 1.0.3      | active   |
| community | Pulsestorm_Modulelist                | 0.2.2      | active   |
| community | Pulsestorm_Requestset                | 0.1.0      | active   |
| community | Pulsestorm_Setuptest                 | 0.1.0      | active   |
| community | ST_Bettercms                         | 1.0.0.1    | active   |
| local     | Sp_Ajaxify                           | 0.1.0      | active   |
| community | Substance_Teamproducts               | 0.1.0      | active   |
| community | Wish_Scheduleproduct                 |            | inactive |
+-----------+--------------------------------------+------------+----------+
</code></pre>
<p>Next, the <code>dev:module:observer:list</code> command will list any observers configured in the system.  Observers are code added to the system that listen for specific Magento events.  Observer based programming allows you to add functionality to Magento without the need to change any Magento code.</p>
<p>The <code>dev:module:observer:list</code> command requires that you specify which configuration &#8220;area&#8221; (<code>global</code>, <code>adminhtml</code>, or <code>frontend</code>) you&#8217;d like to search in</p>
<pre><code>$ n98-magerun.phar dev:module:observer:list
[1] global
[2] adminhtml
[3] frontend
Please select a area:1

  Observers: global                           
┌────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│adminhtml_controller_action_predispatch_start                                   │adminhtml/observer::bindStore                                                   │
│                                                                                │adminhtml/observer::massactionPrepareKey                                        │
├────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│admin_user_authenticate_after                                                   │adminhtml/observer::clearCacheConfigurationFilesAccessLevelVerification         │
├────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
etc ...
</code></pre>
<p>The report will list out the event name (<code>adminhtml_controller_action_predispatch_start</code>) as well as the <code>model-name::method-name</code> (<code>adminhtml/observer::bindStore</code>) of each observer.</p>
<p>The <code>dev:module:rewrite:list</code> command will list all configured Magento class rewrites in the system.  For those new to the system, Magento has a class rewrite system which allows you to replace core Magento model classes with your own.  This implements a primitive duck-typing/monkey-patching system, and can be used to modify system behavior where observers aren&#8217;t present.</p>
<pre><code>$ n98-magerun.phar dev:module:rewrite:list

  Rewrites              

    +--------+---------------------------------+---------------------------------------------------------------+
    | Type   | Class                           | Rewrite                                                       |
    +--------+---------------------------------+---------------------------------------------------------------+
    | models | core/layout_update              | Alanstormdotcom_Commercebug_Model_Layout_Update               |
    | models | catalog/layer_filter_item       | Fishpig_AttributeSplash_Model_Layer_Filter_Item               |
    | models | sitemap/sitemap                 | Fishpig_AttributeSplash_Model_Sitemap                         |
    | blocks | catalog/product_view_attributes | Fishpig_AttributeSplash_Block_Catalog_Product_View_Attributes |
    | blocks | widget/adminhtml_widget         | ST_Bettercms_Block_Adminhtml_Widget                           |
    +--------+---------------------------------+---------------------------------------------------------------+
</code></pre>
<p>Running this command will let you know right away if you can safely rewrite a class without impacting another extension in the system.  When you&#8217;ve inherited a system or just installed a new module,  the <code>dev:module:rewrite:conflicts</code> command will give you a quick heads up as to any conflicting rewrites in the system.</p>
<pre><code>$ n98-magerun.phar dev:module:rewrite:conflicts

  Conflicts  

┌────────┬──────────────────────────────┬────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────┐
│blocks  │widget/adminhtml_widget       │Pulsestorm_Cantplaywithothers_Blocks_Adminhtml_Widget,      │ST_Bettercms_Block_Adminhtml_Widget                         │
│        │                              │ST_Bettercms_Block_Adminhtml_Widget                         │                                                            │
└────────┴──────────────────────────────┴────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────┘
1 conflict was found!
</code></pre>
<p>For those new to Magento, the rewrite system works by replacing which class is instantiated, via a factory method.  This means one rewrite always &#8220;wins out&#8221; over another.  The <code>dev:module:rewrite:conflicts</code> command will identify these conflicts for you.</p>
<p>The last command we&#8217;ll mention today is <code>dev:module:create</code>.  This command can be used to create the files and directories needed for a skeleton module</p>
<pre><code>$ n98-magerun.phar dev:module:create Pulsestorm Testmodule local
Created directory: /path/to/magentoapp/code/local/Pulsestorm/Testmodule
Created directory: /path/to/magentoapp/code/local/Pulsestorm/Testmodule/etc
Created file: /path/to/magentoapp/etc/modules/Pulsestorm_Testmodule.xml
Created file: /path/to/magentoapp/code/local/Pulsestorm/Testmodule/etc/config.xml
</code></pre>
<p>This command takes three arguments.  The first (<code>Pulsestorm</code>) is the module package name, the second (<code>Testmodule</code>) is the module name itself, and the third (<code>local</code>) argument is the module code pool.</p>
<p>This command also supports a number of arguments for creating modules of certain types, or containing certain features.</p>
<pre><code>$ n98-magerun.phar help dev:module:create
Usage:
 dev:module:create [--add-blocks] [--add-helpers] [--add-models] [--add-setup] [--add-all] [--modman] [--add-readme] [--add-composer] [--author-name[="..."]] [--author-email[="..."]] [--description[="..."]] vendorNamespace moduleName [codePool]

Arguments:
 vendorNamespace       Namespace (your company prefix)
 moduleName            Name of your module.
 codePool              Codepool (local,community) (default: "local")

Options:
 --add-blocks          Adds blocks
 --add-helpers         Adds helpers
 --add-models          Adds models
 --add-setup           Adds SQL setup
 --add-all             Adds blocks, helpers and models
 --modman              Create all files in folder with a modman file.
 --add-readme          Adds a readme.md file to generated module
 --add-composer        Adds a composer.json file to generated module
 --author-name         Author for readme.md or composer.json
 --author-email        Author for readme.md or composer.json
</code></pre>
<p>Once you become <a href="http://alanstorm.com/category/magento#magento_for_php_developers">more familiar</a> with Magento&#8217;s various module features, the use of these options will become self evident.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magenrun-development-commands-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[SOLVED] Warning: Your Magento folder does not have sufficient write permissions</title>
		<link>http://mage-page.net/2013/04/solved-warning-your-magento-folder-does-not-have-sufficient-write-permissions/</link>
		<comments>http://mage-page.net/2013/04/solved-warning-your-magento-folder-does-not-have-sufficient-write-permissions/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 17:09:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mukesh Chapagain]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/solved-warning-your-magento-folder-does-not-have-sufficient-write-permissions/</guid>
		<description><![CDATA[You might get this error when you go to Magento Connect Manager (System -&#62; Magento Connect -&#62; Magento Connect Manager) of your Magento installation. This means that Magento Connect is unable to write files to your server. Warning: Your Magento folder does not have sufficient write permissions. The solution to this problem is to set [...]<p><a href="http://blog.chapagain.com.np/solved-warning-your-magento-folder-does-not-have-sufficient-write-permissions/">[SOLVED] Warning: Your Magento folder does not have sufficient write permissions</a> is a post from: <a href="http://blog.chapagain.com.np">Mukesh Chapagain&#039;s Blog</a></p>

<strong>Related posts:</strong><ol>
<li><a href="http://blog.chapagain.com.np/linux-command-change-permission-of-files-or-folders-only/" rel="bookmark" title="Linux command: Change permission of files or folders">Linux command: Change permission of files or folders</a></li>
<li><a href="http://blog.chapagain.com.np/magento-installing-new-language-package-step-by-step-guide/" rel="bookmark" title="Magento: Installing New Language Package [Step-by-Step Guide]">Magento: Installing New Language Package [Step-by-Step Guide]</a></li>
<li><a href="http://blog.chapagain.com.np/how-to-install-sample-data-for-magento/" rel="bookmark" title="How to Install Sample Data for Magento?">How to Install Sample ...]]></description>
				<content:encoded><![CDATA[<p>You might get this error when you go to Magento Connect Manager (System -&gt; Magento Connect -&gt; Magento Connect Manager) of your Magento installation. This means that Magento Connect is unable to write files to your server. Warning: Your Magento folder does not have sufficient write permissions. The solution to this problem is to set [...]
<p><a href="http://blog.chapagain.com.np/solved-warning-your-magento-folder-does-not-have-sufficient-write-permissions/">[SOLVED] Warning: Your Magento folder does not have sufficient write permissions</a> is a post from: <a href="http://blog.chapagain.com.np">Mukesh Chapagain&#039;s Blog</a></p>
<p><strong>Related posts:</strong>
<ol>
<li><a href="http://blog.chapagain.com.np/linux-command-change-permission-of-files-or-folders-only/" rel="bookmark" title="Linux command: Change permission of files or folders">Linux command: Change permission of files or folders</a></li>
<li><a href="http://blog.chapagain.com.np/magento-installing-new-language-package-step-by-step-guide/" rel="bookmark" title="Magento: Installing New Language Package [Step-by-Step Guide]">Magento: Installing New Language Package [Step-by-Step Guide]</a></li>
<li><a href="http://blog.chapagain.com.np/how-to-install-sample-data-for-magento/" rel="bookmark" title="How to Install Sample Data for Magento?">How to Install Sample Data for Magento?</a></li>
<li><a href="http://blog.chapagain.com.np/magento-solution-of-warning-invalid-argument-supplied-for-foreach-in-templatecatalogproductlisttoolbar-phtml/" rel="bookmark" title="Magento: Solution of Warning: Invalid argument supplied for foreach() in …/template/catalog/product/list/toolbar.phtml">Magento: Solution of Warning: Invalid argument supplied for foreach() in &#8230;/template/catalog/product/list/toolbar.phtml</a></li>
<li><a href="http://blog.chapagain.com.np/magento-product-edit-warning-invalid-argument-supplied-for-foreach/" rel="bookmark" title="Magento: Product Edit Warning: Invalid argument supplied for foreach()">Magento: Product Edit Warning: Invalid argument supplied for foreach()</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/solved-warning-your-magento-folder-does-not-have-sufficient-write-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Maximum Allowed Order Amount</title>
		<link>http://mage-page.net/2013/04/magento-maximum-allowed-order-amount/</link>
		<comments>http://mage-page.net/2013/04/magento-maximum-allowed-order-amount/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 07:29:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Inchoo]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/magento-maximum-allowed-order-amount/</guid>
		<description><![CDATA[<p>Recently I have been working on a project that had its own set of small fraud prevention features. One such feature was maximum allowed order amount. While it may sound strange at first; why would someone want to limit the maximum amount of order?! Given the nature of the product that shop was selling (cannot disclose that information) that feature request seemed pretty reasonable. <span></span>If you look at the Magento admin configuration area, you will see that Magento offers the opposite feature called Minimum Order Amount. You can find it under <strong>System &#62; Configuration &#62; Sales &#62; Sales &#62; Minimum Order Amount</strong>.</p>
<p>Minimum Order Amount functions slightly different than our Maximum Allowed Order Amount. The main difference is that with Maximum ...]]></description>
				<content:encoded><![CDATA[<p>Recently I have been working on a project that had its own set of small fraud prevention features. One such feature was maximum allowed order amount. While it may sound strange at first; why would someone want to limit the maximum amount of order?! Given the nature of the product that shop was selling (cannot disclose that information) that feature request seemed pretty reasonable. <span></span>If you look at the Magento admin configuration area, you will see that Magento offers the opposite feature called Minimum Order Amount. You can find it under <strong>System &gt; Configuration &gt; Sales &gt; Sales &gt; Minimum Order Amount</strong>.</p>
<p>Minimum Order Amount functions slightly different than our Maximum Allowed Order Amount. The main difference is that with Maximum Allowed Order Amount you are not suppose to add anything new to the cart itself if it exceeds the maximum limit. So how do we do that. Answer is simple, event/observer system. All we need to do is to find the right event in Magento and hook an observer on it. After careful tracing, few try and fail, and a tip from my coworker Matej, the most logical event for implementing Maximum Allowed Order Amount seemed to be <strong>sales_quote_save_before</strong>. Additionally, it makes sense to implement the Maximum Allowed Order Amount functionality only on the frontend area, since we do not want to limit the admin created orders. With that in mind, we only needed to add the following to our extension config.xml file:</p>
<p></p><pre class="crayon-plain-tag">&lt;config&gt;
    &lt;frontend&gt;
        &lt;events&gt;
            &lt;sales_quote_save_before&gt;
                &lt;observers&gt;
                    &lt;inchoo_maxorderamount_enforceSingleOrderLimit&gt;
                        &lt;class&gt;inchoo_maxorderamount/observer&lt;/class&gt;
                        &lt;method&gt;enforceSingleOrderLimit&lt;/method&gt;
                    &lt;/inchoo_maxorderamount_enforceSingleOrderLimit&gt;
                &lt;/observers&gt;
            &lt;/sales_quote_save_before&gt;
        &lt;/events&gt;
    &lt;/frontend&gt;
&lt;/config&gt;</pre><p></p>
<p>And the following logic into our Observer.php model class file:</p>
<p></p><pre class="crayon-plain-tag">class Inchoo_MaxOrderAmount_Model_Observer
{
    private $_helper;
    public function __construct()
    {
        $this-&gt;_helper = Mage::helper('inchoo_maxorderamount');
    }
    /**
     * No single order can be placed over the amount of X
     */
    public function enforceSingleOrderLimit($observer)
    {
        if (!$this-&gt;_helper-&gt;isModuleEnabled()) {
            return;
        }
        $quote = $observer-&gt;getEvent()-&gt;getQuote();
        if ((float)$quote-&gt;getGrandTotal() &gt; (float)$this-&gt;_helper-&gt;getSingleOrderTopAmount()) {
            $formattedPrice = Mage::helper('core')-&gt;currency($this-&gt;_helper-&gt;getSingleOrderTopAmount(), true, false);
            Mage::getSingleton('checkout/session')-&gt;addError(
                $this-&gt;_helper-&gt;__($this-&gt;_helper-&gt;getSingleOrderTopAmountMsg(), $formattedPrice));
            Mage::app()-&gt;getFrontController()-&gt;getResponse()-&gt;setRedirect(Mage::getUrl('checkout/cart'));
            Mage::app()-&gt;getResponse()-&gt;sendResponse();
            exit;
        }
    }
}</pre><p></p>
<p>The real success with this approach lies in the single “<strong>Mage::getSingleton(&#8216;checkout/session&#8217;)-&gt;addError()</strong> &#8230;” line of code. Triggering this line of code here, within sales_quote_save_before event, makes Magento refuse to update (add new items) the shopping cart if the amount of new products exceeds the Maximum Allowed Order Amount. More or less thats it.</p>
<p>You can download <strong><a href="https://github.com/ajzele/Inchoo_MaxOrderAmount" title="Inchoo_MaxOrderAmount">Inchoo_MaxOrderAmount</a></strong> Magento extension from <a href="https://github.com/ajzele?tab=repositories" title="GitHub - Branko Ajzele">my GitHub account</a>. It adds a nice little configuration area for this extension under <strong>System &gt; Configuration &gt; Sales &gt; Sales &gt; Maximum Order Amount</strong>. On top of just limiting the maximum allowed order amount, there is also some extra functionality regarding the admin email notifications in case certain orders pass certain amount values. As I said, this extension is inspired by simple fraud prevention functionalities on a project we have been working on recently.</p>
<p>Hope you find it useful, if not for practical application then maybe for educational reasons.<br />
Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/magento-maximum-allowed-order-amount/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Development Toggle Commands</title>
		<link>http://mage-page.net/2013/04/n98-magerun-development-toggle-commands/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-development-toggle-commands/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 00:49:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-development-toggle-commands/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>Today we&#8217;re going to start in the on the <code>n98-magerun</code> commands under the <code>dev</code> category.</p>

<pre><code>$ n98-magerun.phar list dev
...
dev:console                    Opens PHP interactive shell with initialized Mage::app() (Experimental)
dev:ide:phpstorm:meta          Generates meta data file for PhpStorm auto completion
dev:log                        Toggle development log (system.log, exception.log)
dev:log:db                 ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>Today we&#8217;re going to start in the on the <code>n98-magerun</code> commands under the <code>dev</code> category.</p>
<pre><code>$ n98-magerun.phar list dev
...
dev:console                    Opens PHP interactive shell with initialized Mage::app() (Experimental)
dev:ide:phpstorm:meta          Generates meta data file for PhpStorm auto completion
dev:log                        Toggle development log (system.log, exception.log)
dev:log:db                     Turn on/off database query logging
dev:log:size                   Get size of log file
dev:module:create              Creates and registers new magento module.
dev:module:list                List all installed modules
dev:module:observer:list       Lists all registered observers
dev:module:rewrite:conflicts   Lists all magento rewrite conflicts
dev:module:rewrite:list        Lists all magento rewrites
dev:profiler                   Toggles profiler for debugging
dev:report:count               Get count of report files
dev:symlinks                   Toggle allow symlinks setting
dev:template-hints             Toggles template hints
dev:template-hints-blocks      Toggles template hints block names
dev:theme:duplicates           Find duplicate files in your theme
dev:theme:list                 Lists all available themes
dev:translate:admin            Toggle inline translation tool for admin
dev:translate:shop             Toggle inline translation tool for shop
</code></pre>
<p>Given the length of this list, we won&#8217;t get to all the commands in this article.  Today we&#8217;re going to focus on the toggle commands. The toggle commands will flip specific Magento system configuration variables on or off. Because of this, in addition to covering how the <code>n98-magerun</code> commands work, we&#8217;ll also end up teaching you a little about development related system configuration settings.</p>
<p>Let&#8217;s get to it!</p>
<p>The <code>dev:log</code> command will flip Magento&#8217;s logging on/off.  This is the logging you&#8217;d normally turn on/off in the <code>System -&gt; Configuration -&gt; Developer -&gt; Log Settings</code> section of the admin console.  Magento is littered with calls to <code>Mage::log</code> which, if logging is on, will write debugging output to <code>var/log/system.log</code>.  Additionally, there are certain exceptions in Magento which will be caught by the main application loop and written out to <code>var/log/exception.log</code>.</p>
<p>The syntax for the command is as follows.</p>
<pre><code>$ n98-magerun.phar dev:log
[1] default - English
[2] french - French
[3] german - German
[4] second_store_view - Second Store View
Please select a store: 1
Development Log disabled for store default
</code></pre>
<p>Without arguments, the <code>dev:log</code> command will ask you for a store view, and then toggle logging on or off.  If it&#8217;s currently on, it will toggle off.  If its currently off, it will toggle on.  If you want to set the logging value for the <strong>default</strong> configuration scope, just use the <code>--global</code> option.</p>
<pre><code>$ n98-magerun.phar dev:log --global
Development Log enabled
</code></pre>
<p>You can also force an on/off state with the <code>--on</code> or <code>--off</code> options.</p>
<pre><code>$ n98-magerun.phar dev:log --on 2
Development Log enabled for store german

$ n98-magerun.phar dev:log --on 2
Development Log enabled for store german
</code></pre>
<p>You&#8217;ll also notice in the above commands that we&#8217;re passing in the <code>store_id</code> directly. Like most <code>n98-magerun</code> store arguments, you may substitute the store code here as well</p>
<pre><code>$ n98-magerun.phar dev:log --on german
</code></pre>
<p>The <code>--on</code>, <code>--off</code>, <code>--global</code>, and store parameters are, unless otherwise noted, shared by all the toggle commands.  From this point on we&#8217;ll refer to them as the &#8220;standard toggle options&#8221;</p>
<p>The next toggle is the <code>dev:profiler</code> command.  This toggles the settings at <code>System -&gt; Configuration -&gt; Developer -&gt; Debug</code>.  If you comment out the <code>#Varien_Profiler::enable();</code> line in <code>index.php</code>, Magento will profile the time it takes for certain operations to complete.  When this option is toggled to on, this information will be output at the bottom of the HTML page.</p>
<p>The syntax for the command is as follows, and supports the standard toggle options mentioned above.</p>
<pre><code>$ n98-magerun.phar dev:profiler --on 3
Profiler enabled for store french
</code></pre>
<p>Next up is the <code>dev:symlinks</code> command.  This toggles the settings at <code>System -&gt; Configuration -&gt; Developer -&gt; Template Settings</code>.  The command name <code>symlinks</code> is slightly misleading.  With this feature on, programmers can write code or configure their setup to load templates outside the <code>app/design</code> folder hierarchy.  While not recommended for production sites, this command was introduced specifically for developers who setup their development and staging environments using symlinks.</p>
<p>The syntax for the command is as follows, and supports the standard toggle options mentioned above.</p>
<pre><code>$ n98-magerun.phar dev:symlinks --on 3
Symlinks allowed for store french
</code></pre>
<p>Next up are <code>dev:template-hints</code> and <code>dev:template-hints-blocks</code>.  These commands toggle the options at <code>System -&gt; Configuration -&gt; Developer -&gt; Debug</code>,  (these options do not show up for the default store view).  Template path and blocks hints will <a href="https://support.sweettoothrewards.com/entries/21255937-How-do-I-turn-on-template-path-hints-">add a short string to the frontend of Magento</a> indicating which part of the page was rendered by which <code>phtml</code> template.</p>
<p>The syntax for these commands are as follows, and both support the standard toggle options mentioned above <strong>except</strong> for the <code>--global</code> option.</p>
<pre><code>$ n98-magerun.phar dev:template-hints --on 3
Template Hints enabled for store french

$ n98-magerun.phar dev:template-hints-blocks --on 3
Template Hints Blocks enabled for store french
</code></pre>
<p>The <code>--global</code> option is omitted in deference to Magento&#8217;s preference these settings not be displayed in the UI for the default store view.</p>
<p>Finally, we have the <code>dev:translate:admin</code> and <code>dev:translate:shop</code> commands.  These commands toggle the inline translation feature in Magento.  The inline translation features adds a clickable bounding box to each translatable string in Magento.  Clicking this box allows end-users to enter an alternate translation for the string.  These translations are stored in the database, and merged with the standard <code>gettext</code> style locale <code>CSV</code> files. These toggles are normally managed via the <code>System -&gt; Configuration -&gt; Developer -&gt; Translate Inline</code> section of the system configuration.</p>
<p>The syntax for these commands is as follows, with the <code>admin</code> command toggling the feature in the admin console application, and the <code>shop</code> command toggling the features in the frontend application.</p>
<pre><code>$ n98-magerun.phar dev:translate:shop --off 1
Inline Translation disabled for store default
$ n98-magerun.phar dev:translate:admin --off 
Inline Translation (Admin) disabled
</code></pre>
<p>Both commands support the <code>--on</code> and <code>--off</code> options.  Neither supports the <code>--global</code> option, and only <code>dev:translate:shop</code> supports the store argument, (as the admin <code>store_id</code> should always be zero)</p>
<p>That&#8217;s it for today.  Next time we&#8217;ll get to the non-toggle command under the <code>dev</code> category.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-development-toggle-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Customer Commands</title>
		<link>http://mage-page.net/2013/04/n98-magerun-customer-commands/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-customer-commands/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 18:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-customer-commands/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>Similar to the <a href="http://magento-quickies.tumblr.com/post/48214416789/n98-magerun-admin-and-cache-commands">already covered admin commands</a>, <code>n98-magerun</code> also has commands for managing customer accounts.</p>

<pre><code>$ n98-magerun.phar list customer
Available commands for the "customer" namespace:
  customer:change-password   Changes the password of a customer.
  customer:create            Creates a customer.
  customer:create:dummy      Creates a dummy customers.
  customer:info              Show infos about a customer
  customer:list              Lists customers
</code></pre>

<p>The <code>customer:list</code> command allows you to view all the ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>Similar to the <a href="http://magento-quickies.tumblr.com/post/48214416789/n98-magerun-admin-and-cache-commands">already covered admin commands</a>, <code>n98-magerun</code> also has commands for managing customer accounts.</p>
<pre><code>$ n98-magerun.phar list customer
Available commands for the "customer" namespace:
  customer:change-password   Changes the password of a customer.
  customer:create            Creates a customer.
  customer:create:dummy      Creates a dummy customers.
  customer:info              Show infos about a customer
  customer:list              Lists customers
</code></pre>
<p>The <code>customer:list</code> command allows you to view all the customers in the system.</p>
<pre><code>$ n98-magerun.phar customer:list
+---+-----------------------------+------+-------+------+
|   | email                       | fir  | last  | web  |
+---+-----------------------------+------+-------+------+
| 1 | john.doe@example.com        | John | Doe   | base |
| 2 | December23559PM@example.com | Alan | Storm | base |
| 3 | March18947PM@example.com    | Alan | Storm | base |
| 4 | March22235PM@example.com    | Alan | Storm | base |
+---+-----------------------------+------+-------+------+
</code></pre>
<p>The <code>customer:info</code> command will, via interactive prompts, allow you to fetch information about a specific customer based on their email address and <code>website_id</code>.</p>
<pre><code>$ n98-magerun.phar customer:info
Email: December23559PM@example.com
[1] base - Main Website
[2] second_website - Second Website
Please select a website: 1
+---------------------------+-----------------------------+
| Attribute                 | Value                       |
+---------------------------+-----------------------------+
| Associate to Website      | Main Website                |
| entity_id                 | 2                           |
| entity_type_id            | 1                           |
| attribute_set_id          | 0                           |
| Email                     | December23559PM@example.com |
| Customer Group            | General                     |
| Create In                 |                             |
| Created At                | 2012-12-24 01:59:59         |
| updated_at                | 2012-12-24 01:59:59         |
| is_active                 | 1                           |
| disable_auto_group_change | 0                           |
| First Name                | Alan                        |
| Last Name                 | Storm                       |
| Created From              | English                     |
+---------------------------+-----------------------------+
</code></pre>
<p>The email address and <code>website_id</code> (or website code) may also be passed in via arguments to the <code>customer:info</code> command to avoid the interactive prompts.</p>
<pre><code>$ n98-magerun.phar customer:info December23559PM@example.com 1
$ n98-magerun.phar customer:info December23559PM@example.com base
</code></pre>
<p>Just like the admin commands, there&#8217;s also a command to change a customer&#8217;s password.  This is extra useful if you&#8217;ve inherited a Magento system and need to log in as a particular user in your development environment.</p>
<pre><code>$ n98-magerun.phar customer:change-password
Email: December23559PM@example.com
Password:password12345
[1] base - Main Website
[2] second_website - Second Website
Please select a website: 1
Password successfully changed
</code></pre>
<p>You may also use the <code>customer:create</code> command to quickly create a new customer account.</p>
<pre><code>$ n98-magerun.phar customer:create
Email: April191119AM@example.com
Password: password12345
Firstname:Robert
Lastname:Hoffner
[1] base - Main Website
[2] second_website - Second Website
Please select a website: 1
Customer April191119AM@example.com successfully created
</code></pre>
<p>Interestingly, if <code>customer:create</code> is too much typing for you, there&#8217;s also a the <code>customer:create:dummy</code> command.  This command will allow you to create an  arbitrary number of fake (or &#8220;dummy&#8221;) user accounts.  The <code>customer:create:dummy</code> command doesn&#8217;t have interactive prompts for all its arguments, so you&#8217;ll need to supply them on the command line</p>
<pre><code>$ n98-magerun.phar customer:create:dummy 5 en_US 1
</code></pre>
<p>The first argument (<code>5</code> above) is the number of dummy accounts you want to create.  The second argument (<code>en_US</code> above) is a valid language locale , and the final argument (<code>1</code> for us) is the <code>website_id</code> the customer should be created with.</p>
<p>You&#8217;re probably wondering about the <code>locale</code> requirement.  This is required by the PHP <code>Faker</code> library, which is used to create the fake data that populates the customer data.  For example, with the <code>en_US</code> value used above</p>
<pre><code>$ n98-magerun.phar customer:create:dummy 5 en_US 1
Customer dedric.koch@example.org with password qz4mDjct successfully created
Customer cwuckert@example.com with password Nz!g_?WN successfully created
Customer karl.shanahan@example.com with password hhJyLppA successfully created
Customer johnston.buddy@example.org with password h$6$MfZy successfully created
Customer quitzon.rhett@example.com with password X2FW?LTT successfully created    
</code></pre>
<p>the email addresses created are all valid for the <code>en_US</code> locale.  However, if we change that to <code>sr_RS</code></p>
<pre><code>$ n98-magerun.phar customer:create:dummy 5 sr_RS 1
Customer Николета.Невенић@example.com with password !-..=94d successfully created
Customer Дафина.Лазић@example.com with password NyEm8!W- successfully created
Customer Вуча.Матушић@example.com with password 6R66GZC* successfully created
Customer Ђурисава.Комленић@example.org with password Yy?uPGj7 successfully created
Customer Алекса.Делић@example.com with password zmv6sSh? successfully created
</code></pre>
<p>we&#8217;ll end up with email addresses more appropriate for a serbian locale.  If you&#8217;re having trouble remembering a particular the locale ID code, the <code>help</code> for the dump command has you covered.</p>
<pre><code>$ n98-magerun.phar help customer:create:dummy
...
Help:
 Supported Locales:

 - cs_CZ
 - ru_RU
 - bg_BG
 - en_US
 - it_IT
 - sr_RS
 - sr_Cyrl_RS
 - sr_Latn_RS
 - pl_PL
 - en_GB
 - de_DE
 - sk_SK
 - fr_FR
 - es_AR
 - de_AT
</code></pre>
<p>The <code>customer:create:dummy</code> command can be a huge boon when setting up development and/or staging stores.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-customer-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ultimate Module creator 1.6.0</title>
		<link>http://mage-page.net/2013/04/ultimate-module-creator-1-6-0/</link>
		<comments>http://mage-page.net/2013/04/ultimate-module-creator-1-6-0/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 10:09:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Marius Strajeru]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/ultimate-module-creator-1-6-0/</guid>
		<description><![CDATA[A new version of Ultimate Module Creator (v1.6.0) is available on Magento connect <a href="http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15449/s/ultimate-modulecreator-8949/">http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15449/s/ultimate-modulecreator-8949/</a> starting April 19th 2013.<br />A few details about it: <a href="http://marius-strajeru.blogspot.ro/p/ultimate-module-creator.html#v1-6-0">http://marius-strajeru.blogspot.ro/p/ultimate-module-creator.html#v1-6-0</a> <br />The source code is also available on <a href="https://github.com/tzyganu/moduleCreator">github</a>]]></description>
				<content:encoded><![CDATA[<p>A new version of Ultimate Module Creator (v1.6.0) is available on Magento connect <a href="http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15449/s/ultimate-modulecreator-8949/">http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15449/s/ultimate-modulecreator-8949/</a> starting April 19th 2013.<br />A few details about it: <a href="http://marius-strajeru.blogspot.ro/p/ultimate-module-creator.html#v1-6-0">http://marius-strajeru.blogspot.ro/p/ultimate-module-creator.html#v1-6-0</a> <br />The source code is also available on <a href="https://github.com/tzyganu/moduleCreator">github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/ultimate-module-creator-1-6-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-Magerun: Config Commands</title>
		<link>http://mage-page.net/2013/04/n98-magerun-config-commands/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-config-commands/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 23:15:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-config-commands/</guid>
		<description><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>

<p>Magento is a module based system — each code module has a file named <code>config.xml</code> which contains configuration information related to the module.  Magento will merge all the <code>config.xml</code> files into a single global configuration tree.  This tree is then available for all modules and core library code to read  from.  This configuration tree is also where the admin console&#8217;s <a href="http://alanstorm.com/custom_magento_system_configuration">system configuration variables</a> are <a href="http://alanstorm.com/category/magento#dispatch">stored</a>.</p>

<p>Today we&#8217;ll review the  three <code>n98-magerun</code> command related to the global configuration tree.</p>

<pre><code>$ n98-magerun.phar list config

...

Available commands for the "config" namespace:
  config:dump   Dump merged xml config
  config:get    Get ...]]></description>
				<content:encoded><![CDATA[<p><em>This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a></em></p>
<p>Magento is a module based system — each code module has a file named <code>config.xml</code> which contains configuration information related to the module.  Magento will merge all the <code>config.xml</code> files into a single global configuration tree.  This tree is then available for all modules and core library code to read  from.  This configuration tree is also where the admin console&#8217;s <a href="http://alanstorm.com/custom_magento_system_configuration">system configuration variables</a> are <a href="http://alanstorm.com/category/magento#dispatch">stored</a>.</p>
<p>Today we&#8217;ll review the  three <code>n98-magerun</code> command related to the global configuration tree.</p>
<pre><code>$ n98-magerun.phar list config

...

Available commands for the "config" namespace:
  config:dump   Dump merged xml config
  config:get    Get a core config item
  config:set    Set a core config item
</code></pre>
<p>The <code>config:dump</code> command will dump the entire merged tree to your console.</p>
<pre><code>$ n98-magerun.phar config:dump
&amp;lt;?xml version="1.0"?&amp;gt;




        Sun, 01 Jul 2012 17:06:09 +0000
</code></pre>
<p>If that much XML is a little overwhelming, you can use an xpath expression to filter the results.</p>
<pre><code>$ n98-magerun.phar config:dump global/models/catalog
&amp;lt;?xml version="1.0"?&amp;gt;

  Mage_Catalog_Model
  catalog_resource

    Fishpig_AttributeSplash_Model_Layer_Filter_Item
</code></pre>
<p>The other two items related to the system configuration variables.  If you have a variable&#8217;s path, you can grab its currently set value</p>
<pre><code>$ n98-magerun.phar config:get web/seo/use_rewrites
+----------------------+----------+----------+---+
| Path                 | Scope    | Scope-ID |   |
+----------------------+----------+----------+---+
| web/seo/use_rewrites | default  |    0     | 1 |
+----------------------+----------+----------+---+
</code></pre>
<p>You can also specify a partial path to see all set configuration values — just make sure your path ends with a trailing <code>/</code></p>
<pre><code>$ n98-magerun.phar config:get web/
+-----------------------+----------+----------+-----------------------------+
| Path                  | Scope    | Scope-ID | Value                       |
+-----------------------+----------+----------+-----------------------------+
| web/secure/base_url   | default  |    0     | <a href="http://magento.example.dev/">http://magento.example.dev/</a> |
| web/seo/use_rewrites  | default  |    0     | 1                           |
| web/unsecure/base_url | default  |    0     | <a href="http://magento.example.dev/">http://magento.example.dev/</a> |
+-----------------------+----------+----------+-----------------------------+
</code></pre>
<p>The <code>config:get</code> command will only fetch a value <strong>if its been set</strong>.  If there&#8217;s no entry in <code>core_config_data</code>, this command <strong>will not</strong> return the value set in a <code>config.xml</code> file&#8217;s &#8220; node.</p>
<p>Since we have a command to get configuration variables, it&#8217;s no surprise there&#8217;s a command to set configuration variables as well.</p>
<pre><code>$ n98-magerun.phar config:set web/seo/use_rewrites 0
web/seo/use_rewrites =&amp;gt; 0

$ n98-magerun.phar config:get web/seo/use_rewrites
+----------------------+----------+----------+---+
| Path                 | Scope    | Scope-ID |   |
+----------------------+----------+----------+---+
| web/seo/use_rewrites | default  |    0     | 0 |
+----------------------+----------+----------+---+
</code></pre>
<p>Without any options, the command will set the value for the <code>default</code> scope, and with a scope ID of <code>0</code>.  Valid values for <strong>Scope</strong> are <code>default</code>, <code>websites</code>, or <code>stores</code>.  The <code>Scope-ID</code> field is a numeric ID that correlates to the the website or store ID the configuration value should apply to.</p>
<p>We can find the syntax for these options by looking at the <code>config:set</code> command&#8217;s help</p>
<pre><code>$ n98-magerun.phar help config:set
Usage:
 config:set [--scope[="..."]] [--scope-id[="..."]] [--encrypt] path value

Arguments:
 path                  The config path
 value                 The config value

Options:
 --scope               The config value's scope (default: "default")
 --scope-id            The config value's scope ID (default: "0")
</code></pre>
<p>Looking at the <code>Usage</code> section above, we see <code>n98-magerun</code> uses the <code>--</code> option style, followed by an equal sign.  That means if we wanted to set values scoped for the store with an ID of 1, we&#8217;d use the following</p>
<pre><code>$ n98-magerun.phar config:set --scope=stores --scope-id=1 web/seo/use_rewrites 0
web/seo/use_rewrites =&amp;gt; 0
</code></pre>
<p>It&#8217;s important to be careful here — Magento UI for setting scoped configuration variables including options for hiding certain configuration fields at certain scope levels.  The <code>n98-magerun</code> tool will allow you to bypass these restrictions by setting values directly</p>
<p>For example, Magento disables setting template path hints at the default level — both to avoid hints in the admin console, as well as ensure a developer doesn&#8217;t accidentally turn on hints for a store they&#8217;re not working on.  You can bypass this restriction with</p>
<pre><code>$ n98-magerun.phar config:set dev/debug/template_hints 1
dev/debug/template_hints =&amp;gt; 1
</code></pre>
<p>There&#8217;s certainly a debate to be had about using user interface to enforce data restrictions — but that&#8217;s a larger conversation for another time.  For now, just remember that <code>n98-magerun</code> is a power tool: understand what it&#8217;s doing before embracing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-config-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect Magento Homepage to Your Website Root</title>
		<link>http://mage-page.net/2013/04/redirect-magento-homepage-to-your-website-root/</link>
		<comments>http://mage-page.net/2013/04/redirect-magento-homepage-to-your-website-root/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 08:16:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ecommerce Web Design]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/redirect-magento-homepage-to-your-website-root/</guid>
		<description><![CDATA[If your Magento installation is in a subdirectory rather than a root install, you may wish to not have two homepages on your site. You may want to direct /shop or /products to your main homepage &#8216;/&#8217;. Doing this via .htaccess can be tricky, so we&#8217;ve found a neat way to do it with observers. [...]]]></description>
				<content:encoded><![CDATA[<p>If your Magento installation is in a subdirectory rather than a root install, you may wish to not have two homepages on your site. You may want to direct /shop or /products to your main homepage &#8216;/&#8217;. Doing this via .htaccess can be tricky, so we&#8217;ve found a neat way to do it with observers. [...]</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/redirect-magento-homepage-to-your-website-root/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Highlights from Magento’s 2013 Imagine eCommerce Conference</title>
		<link>http://mage-page.net/2013/04/highlights-from-magentos-2013-imagine-ecommerce-conference/</link>
		<comments>http://mage-page.net/2013/04/highlights-from-magentos-2013-imagine-ecommerce-conference/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 07:09:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento, Inc.]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/highlights-from-magentos-2013-imagine-ecommerce-conference/</guid>
		<description><![CDATA[<img src="http://www.magentocommerce.com/images/uploads/1Imagine.jpg" style="border: 0" alt="image" width="575" height="136" />
<img src="http://www.magentocommerce.com/images/uploads/2Imagine.jpg" style="border: 0" alt="image" width="575" height="114" />
<p>Last week, 1500 developers and merchants from 45 countries descended upon the M Resort in Las Vegas for the <a href="http://www.imagineecommerce.com/" title="2013 Imagine eCommerce conference">2013 Imagine eCommerce conference</a> to network and share their ecommerce ideas, innovations and best practices around the Magento Platform. Here’s a recap of the most memorable moments and takeaways.</p>
<p><u>Day One</u></p>
<p>Day One focused on how Magento is driving quality in the marketplace and how developers and technology partners can achieve further ecosystem success. The day concluded with sessions on <a href="http://www.imagineecommerce.com/seo-in-magento-implementations/" title="best practice search engine optimization techniques">best practice search engine optimization techniques</a> and a networking “<a href="http://www.imagineecommerce.com/imagine-2013-day-1-recap/" title="BarCamp">BarCamp</a>” event for developers to learn ...]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.magentocommerce.com/images/uploads/1Imagine.jpg" style="border: 0" alt="image" width="575" height="136" /><br />
<img src="http://www.magentocommerce.com/images/uploads/2Imagine.jpg" style="border: 0" alt="image" width="575" height="114" /></p>
<p>Last week, 1500 developers and merchants from 45 countries descended upon the M Resort in Las Vegas for the <a href="http://www.imagineecommerce.com/" title="2013 Imagine eCommerce conference">2013 Imagine eCommerce conference</a> to network and share their ecommerce ideas, innovations and best practices around the Magento Platform. Here’s a recap of the most memorable moments and takeaways.</p>
<p><u>Day One</u></p>
<p>Day One focused on how Magento is driving quality in the marketplace and how developers and technology partners can achieve further ecosystem success. The day concluded with sessions on <a href="http://www.imagineecommerce.com/seo-in-magento-implementations/" title="best practice search engine optimization techniques">best practice search engine optimization techniques</a> and a networking “<a href="http://www.imagineecommerce.com/imagine-2013-day-1-recap/" title="BarCamp">BarCamp</a>” event for developers to learn about a myriad of Magento topics in short, rapid-fire presentations. Among the most popular topic “tracks” were “Developing Magento Apps using the Mobile SDK,” “Previewing Extensibility in Magento 2” and an “Open Forum” with Magento Chief Technology Officer, Matthew Mengerink.</p>
<p><img src="http://www.magentocommerce.com/images/uploads/3Imagine.jpg" style="border: 0" alt="image" width="575" height="259" /></p>
<p><u>Day Two</u></p>
<p>Day Two kicked events into high gear, with <a href="http://www.imagineecommerce.com/imagine-2013-day-2-morning-keynotes-welcome-to-the-art-of-commerce/" title="keynotes">keynotes</a> from eBay Inc. Chief Executive Officer John Donahoe, Magento Co-Founder and Chief Operating Officer Roy Rubin, Jeff Jordan of Andreessen Horowitz and Magento Chief Technology Officer, Matthew Mengerink. </p>
<p><img src="http://www.magentocommerce.com/images/uploads/4Imagine.jpg" style="border: 0" alt="image" width="575" height="133" /></p>
<p>Roy Rubin was the day’s first main speaker. He addressed Magento’s amazing year of growth for both the platform, as well as for the customers and ecosystem worldwide.  He also spoke to the conference theme — “The Art of Commerce” — and inspired the audience by conveying to them that they are the artists, and with the Magento tools available, they have the continued ability to create something powerful and unique.</p>
<p>Rubin was followed by John Donahoe, whose keynote focused on how technology is “obliterating” the lines between online and offline, calling it all “connected commerce.”  In this commerce revolution, he said, the individual is at the center and the consumer is in charge. Jeff Jordan, meanwhile, spoke to existing trends in the ecommerce market, like the physical retailer disadvantage and show-rooming 2.0, and Matthew Mengerink closed out the morning keynotes with a discussion on how to push the boundaries of how we think about things and how the commerce of today no longer marries yesterday’s principles.</p>
<p>Afternoon breakout sessions from the <a href="http://www.imagineecommerce.com/technology-breakout-sessions-optimizing-for-performance-stability/" title="technology">technology</a> and <a href="http://www.imagineecommerce.com/tips-for-growing-your-business/" title="business tracks">business tracks</a> were standing room only, and included topics ranging from “Creating Successful Magento ERP Integrations,” “<a href="http://www.imagineecommerce.com/strategic-marketing-track-the-search-continues-trends-in-seo-and-sem/" title="SEO/SEM Trends for 2013">SEO/SEM Trends for 2013</a>” and “Where, Why, and How of Responsive Web Design.” In particular, Roy Rubin highlighted how Magento is leveraging the power of  eBay Inc. to create an even brighter future and that moving forward,  “this will translate into more benefits for merchants.”</p>
<p>Day Two concluded with a keynote by Sharon Meers, Magento’s Head of Enterprise Strategy, who took to the stage to share Magento’s tremendous success within the fashion industry. She kicked off the segment with a discussion of how <a href="http://www.magentocommerce.com/product/enterprise-edition" title="Magento Enterprise Edition">Magento Enterprise Edition</a> has become the platform of choice for many of the world’s most prestigious brands and concluded with a live, <a href="http://www.imagineecommerce.com/imagine-2013-day-2-afternoon-keynotes-the-fashionable-art-of-commerce/" title="fashion runway showdown">fashion runway showdown</a> with 14 models showcasing the latest looks from Magento customers <a href="http://shop.custobarcelona.com/us/en/?___store=en_usa&amp;___from_store=en_row&amp;_country=US" title="Custo Barcelona">Custo Barcelona</a>, <a href="https://www.erinfetherston.com/" title="Erin Fetherston">Erin Fetherston</a>, <a href="http://www.missguided.co.uk/" title="Missguided">Missguided</a>, <a href="http://www.nanettelepore.com/" title="Nanette Lepore">Nanette Lepore</a>, <a href="http://www.paulsmith.co.uk/us-en/shop/" title="Paul Smith">Paul Smith</a>, <a href="https://www.rebeccaminkoff.com/" title="Rebecca Minkoff">Rebecca Minkoff</a> and <a href="http://us.zadig-et-voltaire.com/us/" title="Zadig &amp; Voltaire">Zadig &amp; Voltaire</a>.</p>
<p><img src="http://www.magentocommerce.com/images/uploads/5Imagine.jpg" style="border: 0" alt="image" width="575" height="283" /></p>
<p><u>Day Three</u></p>
<p>Jimmy Duvall, Head of Product for Magento, introduced the Magento Enterprise 1.13 release and spoke to how the release was designed to enable large and growing merchants to scale more effectively and support even greater numbers of visitors and buyers to their core eCommerce sites, while streamlining their back-end operations.</p>
<p>PayPal Chief Technology Officer James Barrese also addressed the crowd on Day Three and announced that two new <a href="https://www.thepaypalblog.com/2013/04/magento-imagine-2013-paypal-provides-%E2%80%9Cin-aisle-selling%E2%80%9D-and-%E2%80%9Corder-ahead%E2%80%9D-capabilities-for-magento-community/" title="PayPal extensions">PayPal extensions</a> – “order ahead” and “in-aisle selling” – would immediately be available on Magento Connect.</p>
<p>Closing out the morning session was “Freakanomics” co-author Steven Levitt, who captivated the audience with his anecdotes and stories. His most poignant messages were that people don’t spend enough time thinking about ideas, and that we often overlook even the most obvious ones. Further, he exclaimed that we can make up for the low quantity of ideas by the high quality of ideas. Even one or two breakthrough ideas per year from each of us can help bring about great change, he said.</p>
<p><img src="http://www.magentocommerce.com/images/uploads/6Imagine.jpg" style="border: 0" alt="image" width="575" height="140" /></p>
<p>For more detailed write-ups and recaps of the Magento conference, be sure to check out the <a href="http://www.imagineecommerce.com/" title="Imagine website">Imagine website</a> and stay tuned for more photos and videos from the event.</p>
<p>
<hr style="border:none;background:#bbb;height:1px;overflow:hidden" />
<!--table cellpadding="0" cellspacing="0" border="0"&gt;<br />
<tr>
<td valign="top" width="347" align="left"><a href="https://www.paypal.com/webapps/mpp/new-payment-solutions"><img src="http://info.magento.com/rs/magentocommerce/images/PayPal_Checkmark_347x150.gif" /></a></td>
<td valign="top" width="347" align="left"><a href="http://www.magentocommerce.com/go/"><img src="http://www.magentocommerce.com/images/uploads/0931_RSSFooterMainBlog_R1.jpg" /></a></td>
<p>&lt;/table&#8211;></p>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" width="694" align="left"><a href="http://www.magentocommerce.com/product/enterprise-edition?utm_source=Magento&amp;utm_medium=Banner&amp;utm_campaign=RSSFeed"><img src="http://www.magentocommerce.com/images/uploads/rss-feed-footer-for-magento-blog.jpg" style="border: 0" alt="image" width="694" height="150" /></a></td>
</tr>
</table>
<div>
<a href="http://feeds.feedburner.com/~ff/magento?a=wRzrEAMOPs0:CpXE_-g-hnU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/magento?d=yIl2AUoC8zA" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/magento?a=wRzrEAMOPs0:CpXE_-g-hnU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/magento?d=7Q72WNTAKBA" border="0"/></a> <a href="http://feeds.feedburner.com/~ff/magento?a=wRzrEAMOPs0:CpXE_-g-hnU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/magento?i=wRzrEAMOPs0:CpXE_-g-hnU:V_sGLiPBpWU" border="0"/></a>
</div>
<p><img src="http://feeds.feedburner.com/~r/magento/~4/wRzrEAMOPs0" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/highlights-from-magentos-2013-imagine-ecommerce-conference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N98-magerun: Admin and Cache Commands</title>
		<link>http://mage-page.net/2013/04/n98-magerun-admin-and-cache-commands/</link>
		<comments>http://mage-page.net/2013/04/n98-magerun-admin-and-cache-commands/#comments</comments>
		<pubDate>Wed, 17 Apr 2013 19:04:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alan Storm]]></category>

		<guid isPermaLink="false">http://mage-page.net/2013/04/n98-magerun-admin-and-cache-commands/</guid>
		<description><![CDATA[<p>Today we&#8217;ll be covering <code>n98-magerun</code>&#8217;s <code>admin</code> and <code>cache</code> commands.  You can see the internal descriptions for these commands by using the top-level <code>list</code> command.</p>

<pre><code>$ n98-magerun.phar list admin

...
Available commands for the "admin" namespace:
  admin:notifications          Toggles admin notifications
  admin:user:change-password   Changes the password of a adminhtml user.
  admin:user:create            Create admin user.
  admin:user:list              List admin users.

...

$ n98-magerun.phar list cache

...
Available commands for the "cache" namespace:
  cache:clean     Clean magento cache
  cache:disable   Disables magento caches
  cache:enable   ...]]></description>
				<content:encoded><![CDATA[<p>Today we&#8217;ll be covering <code>n98-magerun</code>&#8217;s <code>admin</code> and <code>cache</code> commands.  You can see the internal descriptions for these commands by using the top-level <code>list</code> command.</p>
<pre><code>$ n98-magerun.phar list admin

...
Available commands for the "admin" namespace:
  admin:notifications          Toggles admin notifications
  admin:user:change-password   Changes the password of a adminhtml user.
  admin:user:create            Create admin user.
  admin:user:list              List admin users.

...

$ n98-magerun.phar list cache

...
Available commands for the "cache" namespace:
  cache:clean     Clean magento cache
  cache:disable   Disables magento caches
  cache:enable    Enables magento caches
  cache:flush     Flush magento cache storage
  cache:list      Lists all magento caches

...
</code></pre>
<h2>Admin Commands</h2>
<p>The commands in the <code>admin</code> hierarchy relate to Magento&#8217;s backend admin console, (sometimes referred to as the <code>adminhtml</code> area). With <code>n98-magerun</code> you can get a list of all the admin users in a particular system</p>
<pre><code>$ n98-magerun.phar admin:user:list
+-----+----------+----------------------+--------+
| id  | username | email                | status |
+-----+----------+----------------------+--------+
|   1 | admin    | owner@example.com    | active |
|   2 | astorm   | astorm@example.com   | active |
|   3 | alan     | alan@example.com     | active |
+-----+----------+----------------------+--------+
</code></pre>
<p>There&#8217;s also an interactive command for creating new users</p>
<pre><code>$ n98-magerun.phar admin:user:create
Username:test
Email:test@example.com
Password:password12345luggage
Firstname:Bob
Lastname:Hoffner

User test successfully created
</code></pre>
<p>While useful, it appears this command doesn&#8217;t allow you to assign users to a particular admin role — you&#8217;ll need to login and assign a role through the GUI.</p>
<p>The final user command, <code>admin:user:change-password</code> will let you change an admin user&#8217;s password.</p>
<pre><code>$ n98-magerun.phar admin:user:change-password
Username:astorm
Password:password12345luggage

Password successfully changed
</code></pre>
<p>This command is particularly useful if you&#8217;re inheriting a Magento system, setting up a development environment, and no one knows the password for the super user account.</p>
<p>There&#8217;s one more <code>admin</code> command to cover, but this one isn&#8217;t in the <code>user</code> category.  The <code>admin:notifications</code> command allows you to toggle the admin notification bar (and the occasional accompanying modal ajax alert) on or off.</p>
<pre><code>$ n98-magerun.phar admin:notifications
Admin Notifications hidden
</code></pre>
<p>This is accomplished by toggling the <em>Disable Module Output</em> system configuration setting for the <code>Mage_AdminNotification</code> module.</p>
<h2>Cache Commands</h2>
<p>If there&#8217;s one thing Magento teaches you, its the art of cache programming.  Magento has multiple different types of data it caches — you can see a list of the caches, including their enabled/disabled state, with the <code>cache:list</code> command.</p>
<pre><code>$ n98-magerun.phar cache:list

  Cache list  

+-------------+----------+
| code        | status   |
+-------------+----------+
| config      | enabled  |
| layout      | enabled  |
| block_html  | enabled  |
| translate   | enabled  |
| collections | enabled  |
| eav         | enabled  |
| config_api  | enabled  |
| config_api2 | disabled |
+-------------+----------+
</code></pre>
<p>You can also enable every cache type with the <code>cache:enable</code> command</p>
<pre><code>$ n98-magerun.phar cache:enable
</code></pre>
<p>or disable every cache type with the <code>cache:disable</code> command</p>
<pre><code>$ n98-magerun cache:disable
</code></pre>
<p>Unfortunately, there doesn&#8217;t appear to be a way to enable or disable individual cache types.  If you need that functionality, you&#8217;ll need to hop into the GUI admin.</p>
<p>Fortunately, the <code>cache:clean</code> command allows you finely grained control over which cache you want to clean.</p>
<pre><code>$ n98-magerun.phar cache:clean config
config cache cleaned
</code></pre>
<p>as well as an argument-less version that will clear each Magento cache type</p>
<pre><code>$ n98-magerun.phar cache:clean 
block_html cache cleaned
collections cache cleaned
config cache cleaned
config_api cache cleaned
config_api2 cache cleaned
eav cache cleaned
layout cache cleaned
translate cache cleaned
</code></pre>
<p>Cleaning a cache means removing all its keys from the cache storage engine, which will prompt Magento to rebuild the cache items.</p>
<p>Despite having a typed cache system, it&#8217;s posible to stick items in the Magento cache without assigning the data to a particular type.  There&#8217;s also Zend Framework code that drops items into the cache without regards for Magento&#8217;s types.  To get this data out of the cache, you&#8217;ll need to flush the entire cache store engine with the <code>cache:flush</code> command</p>
<pre><code>$ n98-magerun.phar cache:flush
Cache cleared
</code></pre>
<p>Cleaning the cache is like a surgeon going in and cutting out the parts o the cache that are no longer needed.  Flushing the cache is like chemo therapy — obliterating everything to ensure the parts you want are gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://mage-page.net/2013/04/n98-magerun-admin-and-cache-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
