<?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>Quanbit Research</title>
	<atom:link href="http://research.quanbit.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://research.quanbit.com</link>
	<description>Quanbit Research</description>
	<lastBuildDate>Tue, 24 Apr 2012 19:28:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Creating an Authors module in Magento &#8211; Part 4</title>
		<link>http://research.quanbit.com/2012/04/20/creating-an-authors-module-in-magento-part-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-an-authors-module-in-magento-part-4</link>
		<comments>http://research.quanbit.com/2012/04/20/creating-an-authors-module-in-magento-part-4/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 23:05:49 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[QBMageModuleShell]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=679</guid>
		<description><![CDATA[This is the fourth and last part of our series of posts on how to create an Authors module using the QbMageModuleShell tool we developed. In the first post we showed how to create the module and set up a basic author model, in the second post we showed how to create a simple frrontend view of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-174 postimage" title="Create Authors Module" src="http://research.quanbit.com/wp-content/uploads/2012/04/blocks.jpg" alt="Create Authors Module" width="590" height="210" /></p>
<p>This is the fourth and last part of our series of posts on how to create an Authors module using the QbMageModuleShell tool we developed. In <a href="http://research.quanbit.com/2012/04/09/creating-an-authors-module-in-magento-part-1/" title="Creating an Authors module in Magento – Part 1">the first post </a>we showed how to create the module and set up a basic author model, in the <a href="http://research.quanbit.com/2012/04/12/creating-an-authors-module-in-magento-part-2/" title="Creating an Authors module in Magento – Part 2">second post</a> we showed how to create a simple frrontend view of our data, and in the <a href="http://research.quanbit.com/2012/04/18/creating-an-authors-module-in-magento-part-3/" title="Creating an Authors module in Magento – Part 3">third post</a> we added to the product an &#8220;author&#8221; attribute, to be able to choose the author for a product</span></span>. In this post we will show the author insde a product&#8217;s view page.<span id="more-679"></span></p>
<p>For that end, we&#8217;ll need to accomplish some things:</p>
<ul>
<li>Create a block for the tab</li>
<li>Create a template for the tab</li>
<li>Add the tab to the product page layout.</li>
</ul>
<h2>Create a block for the tab</h2>
<p>&nbsp;</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/03/New-block.png"><img class="aligncenter size-medium wp-image-680" title="New block" src="http://research.quanbit.com/wp-content/uploads/2012/03/New-block-300x155.png" alt="" width="300" height="155" /></a></p>
<p>To do this, we&#8217;ll create the block in product/tab/author, which extends Mage_Catalog_Block_Product_View_Attributes.</p>
<p>We will need to open the &#8220;Create PHP Class&#8221; slider in the module&#8217;s page, in QBMageModuleShell. There, we will use <em>block/product/tab/author</em> as the pathname, and<em> Mage_Catalog_Block_Product_View_Attributes</em> in the extends field.</p>
<p>We will then add to the created file, <em>app/code/community/Quanbit/QBAuthors/Block/Product/Tab/Author.php</em>, the following methods:</p>
<pre>function getAuthor(){
 return Mage::getModel('qbauthors/author')
           -&gt;load($this-&gt;getProduct()-&gt;getAuthor());
}</pre>
<pre>function getAuthorLink(){
 return Mage::getBaseUrl().'qbauthors/author/view?id='
           .$this-&gt;getAuthor()-&gt;getId();
}</pre>
<h2>Create a template for the tab</h2>
<p>Then, we create the file for the template, called <em>app/design/frontend/default/default/template/qbauthors/product/author.phtml</em>, and add the following content:</p>
<pre>&lt;?php
$author = $this-&gt;getAuthor();</pre>
<pre>if($author):
?&gt;
&lt;div class="box-collateral box-up-sell"&gt;
 &lt;h2&gt;Author: &lt;a href="&lt;?php echo $this-&gt;getAuthorLink()?&gt;"&gt;
    &lt;?php echo $author-&gt;getName()?&gt;
 &lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;?php endif ?&gt;</pre>
<h2>Add the tab to the product page layout</h2>
<p>Finally, we need to tell Magento to use that block, and that template, in the product view page. To do that, we need to edit the qbauthors.xml file, and add the the following (just before the last <em>&lt;/layout&gt;</em> tag):</p>
<pre>&lt;catalog_product_view&gt;
 &lt;reference name="product.info"&gt;
   &lt;block type="qbauthors/product_tab_author" as="author" 
         name="product.author" template="qbauthors/product/author.phtml"&gt;
   &lt;action method="addToParentGroup"&gt;&lt;group&gt;detailed_info&lt;/group&gt;&lt;/action&gt;
   &lt;/block&gt;
 &lt;/reference&gt;
&lt;/catalog_product_view&gt;</pre>
<p>This is adding the block to that page.</p>
<p>This is the final result:</p>
<p>&nbsp;</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/03/Product-View.png"><img class="aligncenter size-medium wp-image-681" title="Product View" src="http://research.quanbit.com/wp-content/uploads/2012/03/Product-View-300x155.png" alt="" width="300" height="155" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/04/20/creating-an-authors-module-in-magento-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Authors module in Magento &#8211; Part 3</title>
		<link>http://research.quanbit.com/2012/04/18/creating-an-authors-module-in-magento-part-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-an-authors-module-in-magento-part-3</link>
		<comments>http://research.quanbit.com/2012/04/18/creating-an-authors-module-in-magento-part-3/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 13:52:24 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[QBMageModuleShell]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=651</guid>
		<description><![CDATA[This is the third part of our series of posts on how to create an Authors module using the QbMageModuleShell tool we developed. In the first post we showed how to create the module and set up a basic author model, and in the second part we showed how to create a simple frrontend view of our [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-174 postimage" title="Create Authors Module" src="http://research.quanbit.com/wp-content/uploads/2012/03/link.jpg" alt="Create Authors Module" width="590" height="210" /></p>
<p>This is the third part of our series of posts on how to create an Authors module using the QbMageModuleShell tool we developed. In the <a title="Creating an Authors module in Magento – Part 1" href="http://research.quanbit.com/2012/04/09/creating-an-authors-module-in-magento-part-1/">first post</a> we showed how to create the module and set up a basic author model, and in the <a title="Creating an Authors module in Magento – Part 2" href="http://research.quanbit.com/2012/04/12/creating-an-authors-module-in-magento-part-2/">second part</a> we showed how to create a simple frrontend view of our data. In this post we will create a new product attribute set for our store (a Book) and link each book to its author.<span id="more-651"></span></p>
<h2>Defining the Attribute and Attribute Set</h2>
<p>In Magento, Products have a special structure, which is called the Entity Attribute Value model (EAV). That structure allows the administrators of the site, to easily add attributes to the products, and even create different sets of attributes. We&#8217;re going to take advantage of that, by creating a new attribute (the &#8220;author&#8221;) and a new attrribute set (the &#8220;book&#8221;).</p>
<p>First of all, we need to edit, in our module, the file /etc/attributes.yml (create if it&#8217;s not there already). Here, we will write the following content:</p>
<pre>attribute:
 catalog_product:
  author:
   source: qbauthors/author
   visible_on_front: true
   input: select
attribute_set:
 catalog_product:
  book:
   attributes: [author]</pre>
<p>In the first few lines, we&#8217;re creating the attribute, and setting some non-default values:</p>
<ol>
<li>that there is a Source for our data (the Authors model we already created), and</li>
<li>that this data should be available in the frontend, and</li>
<li>that we should see a &#8220;select&#8221; for choosing among the different options</li>
</ol>
<p>In the last lines, we create the Book attribute setm and add the author attribute to it.</p>
<p>After writing the file, we need to go to this module&#8217;s page inside QBMageModuleShell, and do &#8220;Create Migrations&#8221;. That way, the tool will read the file we just created, and  generate the attributes creation script. Afterwards,  &#8221;Run Migrations&#8221;, so Magento knows that the next time we load a page, it will need to run the migration scripts for this module again. <strong>WARNING!</strong> The creation script will erase all the data for the module, so you should back it up first.</p>
<h2>Viewing the result</h2>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/03/Products-List.png"><img class="aligncenter size-medium wp-image-654" title="Products List" src="http://research.quanbit.com/wp-content/uploads/2012/03/Products-List-300x155.png" alt="" width="300" height="155" /></a></p>
<p>To check how everything worked, we&#8217;re going to create a new Product. When we go to the New product page, inside Magento&#8217;s admin, we will be able to choose &#8220;Book&#8221; from the dropdown of attribute sets. After choosing it and clicking it, we will be able to create the new Book.</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/03/New-Product.png"><img class="aligncenter size-medium wp-image-653" title="New Product" src="http://research.quanbit.com/wp-content/uploads/2012/03/New-Product-300x155.png" alt="" width="300" height="155" /></a></p>
<p>Here, in the new tab created called &#8220;Book&#8221;, there is a dropdown where you can choose an author from our previously loaded list.</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/03/Author-Attribute.png"><img class="aligncenter size-medium wp-image-652" title="Author Attribute" src="http://research.quanbit.com/wp-content/uploads/2012/03/Author-Attribute-300x155.png" alt="" width="300" height="155" /></a></p>
<p>The created Attribute and Attribute set are standard EAV objects of Magento, so if you want to use the EAV editor inside Magento (in <em>Catalog &gt; Attributes</em>) to change them in any way, you&#8217;re free to use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/04/18/creating-an-authors-module-in-magento-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Authors module in Magento &#8211; Part 2</title>
		<link>http://research.quanbit.com/2012/04/12/creating-an-authors-module-in-magento-part-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-an-authors-module-in-magento-part-2</link>
		<comments>http://research.quanbit.com/2012/04/12/creating-an-authors-module-in-magento-part-2/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 23:12:40 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=484</guid>
		<description><![CDATA[This is the second part of our series of posts on how to create an Authors module using the QbMageModuleShell tool we developed. In the first post we showed how to create the module and set up a basic author model. In this post we will create a frontend view to list and view the details [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-174 postimage" title="Create Authors Module" src="http://research.quanbit.com/wp-content/uploads/2012/03/view.jpg" alt="Create Authors Module" width="590" height="210" /></p>
<p>This is the second part of our series of posts on how to create an Authors module using the QbMageModuleShell tool we developed. In the <a title="Creating an Authors module in Magento – Part 1" href="http://research.quanbit.com/2012/04/09/creating-an-authors-module-in-magento-part-1/">first post</a> we showed how to create the module and set up a basic author model. In this post we will create a frontend view to list and view the details of the authors in the store.<span id="more-484"></span></p>
<h2>Creating the Frontend View</h2>
<p>A Frontend View allows a visitor of the website to view some type of information. We will create a view to list the authors, and then another one to view the details of a specific author. To create the frontend view, go to the module view and choose &#8220;Create Model Frontend View&#8221;. In the text field, choose the same name we chose for the last class (&#8220;author&#8221; in our case) and hit the &#8220;Create Model Frontend View&#8221; button.</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/02/CreateView.png"><img class="aligncenter size-medium wp-image-498" title="CreateView" src="http://research.quanbit.com/wp-content/uploads/2012/02/CreateView-300x144.png" alt="" width="300" height="144" /></a></p>
<p style="text-align: left;">For those of you that are interested, the tool basically created a controller, a Block and a couple of templates to display both the list and the detail view. It also registered the layout for the controller in the layout file, and the route for the controller in the config file.</p>
<h2>Check it out!</h2>
<p>And that&#8217;s it! The frontend view is created and completed. In order to try it out, we will add two authors. In order to do that, login to the store admin, and go to the CRUD page we created last class. There, add a couple of authors to try the frontend for yourself.</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Admin-list.png"><img class="aligncenter size-medium wp-image-485" title="Admin list" src="http://research.quanbit.com/wp-content/uploads/2012/02/Admin-list-300x88.png" alt="" width="300" height="88" /></a></p>
<p style="text-align: left;">Now we need to navigate to the right url to see the authors (no menu item is added to the frontend). The url has the form of: http://&lt;&lt;magento&gt;&gt;/&lt;&lt;module short name&gt;&gt;/&lt;&lt;model name&gt;&gt;, so in our case this would be http://magento.localhost/qbauthors/author. As you can see this url takes is to a list of authors (ok, I admit it, the styles are not great, but that&#8217;s work for the frontend designer of the store <img src='http://research.quanbit.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).</p>
<p style="text-align: center;"><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Listado.png"><img class="aligncenter size-medium wp-image-487" title="Listado" src="http://research.quanbit.com/wp-content/uploads/2012/02/Listado-300x155.png" alt="" width="300" height="155" /></a></p>
<p>As you would expect, by clicking in the name of an Author you can navigate to the detail page.</p>
<h2><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Author.png"><img class="aligncenter size-medium wp-image-486" title="Author" src="http://research.quanbit.com/wp-content/uploads/2012/02/Author-300x152.png" alt="" width="300" height="152" /></a></h2>
<p>&nbsp;</p>
<h2>Customizations and fine-tuning</h2>
<p>While useful for creating the skeleton of your module, QbMageModuleShell doesn&#8217;t take care of the pages styles. As a result you will surely want to customize them and adapt to your store needs. To do that, you can edit the template files in the app/design/frontend/default/default/template/qbauthors/author/ folder. Don&#8217;t be afraid to changing them in any way, because if you make a mistake you can easily regenerate all the files again using the steps above. Just be sure to backup your modifications first, since regenerating the model will overwrite the existing files.</p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/04/12/creating-an-authors-module-in-magento-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Authors module in Magento &#8211; Part 1</title>
		<link>http://research.quanbit.com/2012/04/09/creating-an-authors-module-in-magento-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-an-authors-module-in-magento-part-1</link>
		<comments>http://research.quanbit.com/2012/04/09/creating-an-authors-module-in-magento-part-1/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 12:02:54 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[QBMageModuleShell]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=436</guid>
		<description><![CDATA[In &#8220;Creating Magento modules the easy way&#8221; we argued for the need of a tool to automate the process of creating some Magento artifacts. We also opened to the community a tool that we have been using internally in Quanbit. We are now presenting a series of posts that will show how to create an [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-174 postimage" title="Create Authors Module" src="http://research.quanbit.com/wp-content/uploads/2012/03/admin.jpg" alt="Create Authors Module" width="590" height="210" /></p>
<p>In &#8220;<a href="http://research.quanbit.com/2012/03/29/creating-magento-modules-the-easy-way/">Creating Magento modules the easy way</a>&#8221; we argued for the need of a tool to automate the process of creating some Magento artifacts. We also opened to the community a tool that we have been using internally in <a title="Quanbit" href="http://www.quanbit.com/" target="_blank">Quanbit</a>. We are now presenting a series of posts that will show how to create an Authors module for our Magento store using QbMageModuleShell, our automation application for Magento.<span id="more-436"></span></p>
<h2>Login</h2>
<p>In order to start creating Magento artifacts we will need to install QbMageModuleShell. Assuming that you have downloaded it to your local machine, you should go to the front page in http://localhost:8080/ and see someting like the image below. Here you should enter the path to the Magento Installation (e.g. /home/alex/Projects/MagentoPlugins/qbauthors).</p>
<p style="text-align: center;"><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Login2.png"><img class="aligncenter  wp-image-462" title="Login" src="http://research.quanbit.com/wp-content/uploads/2012/02/Login2.png" alt="" width="590" /></a></p>
<p>&nbsp;</p>
<h2>Creating the Module</h2>
<p>If everything went ok you should see a list of all the available modules like the one shown in the image below (of course the exact modules being listed will vary according to your custom Magento installation).</p>
<p style="text-align: center;"><a href="http://research.quanbit.com/wp-content/uploads/2012/02/List-modules.png"><img class="aligncenter size-medium wp-image-496" title="List modules" src="http://research.quanbit.com/wp-content/uploads/2012/02/List-modules-300x144.png" alt="" width="300" height="144" /></a></p>
<p>Since we are going to create our own module, we click on the &#8220;New Module&#8221; button. In the new module form we will choose &#8220;Community&#8221;, and enter our package and module name (Quanbit and QBAuthors respectively). We finally hit the &#8220;Create Module&#8221; button and the work is done!</p>
<p style="text-align: left;"><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Create-Module2.png"><img class="aligncenter size-medium wp-image-464" title="Create Module" src="http://research.quanbit.com/wp-content/uploads/2012/02/Create-Module2-300x78.png" alt="" width="300" height="78" /></a><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Create-Module2.png"><br />
</a>If you want to check that everything went as expected you can go back to the module list, search for the new module, and click on &#8220;view&#8221;.</p>
<h2>Creating the Model</h2>
<p style="text-align: center;"><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Module-Page1.png"><img class="aligncenter size-medium wp-image-466" title="Module Page" src="http://research.quanbit.com/wp-content/uploads/2012/02/Module-Page1-300x226.png" alt="" width="300" height="226" /></a></p>
<p>There, we will create this model: a class Author, with the name, birthdate, and bio of the author. To do that, we will use our favourite text editor and edit the <strong>/app/code/community/Quanbit/QBAuthors/etc/model.yml</strong> file. That is a YAML file which contains the definition of each model class. We will add there this definition:</p>
<pre>author:
   name: string
   birthdate: date
   bio: text</pre>
<p>After we save that file, we will have all the information needed to create the model, and the CRUD for it. Going back to QbMageModuleShell, we need to access the module, and then perform the following steps:</p>
<ul>
<li><strong>Create Model</strong>: Here we will write just &#8220;author&#8221; and the application will create all model files necessary (including the resources files).</li>
<li><strong>Create Model Admin</strong>: Here we will write &#8220;author&#8221; once again, and this will create a Backend controller that will allow us to perform CRUD operations on this class of the model. We will be able to access it from catalog/authors in the backend menu.</li>
<li><strong>Create Migrations</strong>: This operation creates a migration file, with the &#8220;create table&#8221; SQL Query for the authors table.</li>
<li><strong>Run Migrations: </strong>In this step, what we are actually doing, is instructing Magento that in the next page load, it should run all migrations from this module all over again. So, we will see no change in the database until we load any page of our store or backend.</li>
</ul>
<p>After all that, we have all the necessary files for the module to work. If we now navigate to our magento admin, and login there, we will find in Catalog/Authors the fully working admin for the Authors.</p>
<p><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Magento-Admin.png"><img class="aligncenter size-medium wp-image-451" title="Magento Admin" src="http://research.quanbit.com/wp-content/uploads/2012/02/Magento-Admin-300x191.png" alt="" width="300" height="191" /></a></p>
<p>&nbsp;</p>
<h2>In the next classes we&#8217;ll see:</h2>
<div>
<ul>
<li><a title="Creating an Authors module in Magento – Part 2" href="http://research.quanbit.com/2012/04/12/creating-an-authors-module-in-magento-part-2/">2nd Class: Adding a controller to list all authors and view them.</a></li>
<li><a href="http://research.quanbit.com/2012/04/18/creating-an-authors-module-in-magento-part-3/" title="Creating an Authors module in Magento – Part 3">3rd Class: Adding an &#8220;author&#8221; attribute to the product, with a source model.</a></li>
<li><a href="http://research.quanbit.com/2012/04/20/creating-an-authors-module-in-magento-part-4/" title="Creating an Authors module in Magento – Part 4">4th Class: Creating a Block for showing the products of an Author in it&#8217;s view.</a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/04/09/creating-an-authors-module-in-magento-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Magento modules the easy way</title>
		<link>http://research.quanbit.com/2012/03/29/creating-magento-modules-the-easy-way/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-magento-modules-the-easy-way</link>
		<comments>http://research.quanbit.com/2012/03/29/creating-magento-modules-the-easy-way/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 12:35:36 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=434</guid>
		<description><![CDATA[Anyone that has already tried to create a Magento module knows what a hassle it can be: creating the folders in the right places, setting the right files distributed among the private configuration of the module and the global configuration of Magento, the layout files, and so on. And if this wasn&#8217;t enough, creating a class for [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-174 postimage" title="Magento Module Shell" src="http://research.quanbit.com/wp-content/uploads/2012/03/Module-creator.jpg" alt="Magento Module Shell" width="590" height="210" /></p>
<p>Anyone that has already tried to create a Magento module knows what a hassle it can be: creating the folders in the right places, setting the right files distributed among the private configuration of the module and the global configuration of Magento, the layout files, and so on. And if this wasn&#8217;t enough, creating a class for a Block or a Model does not get any easier: again the right names in the files, registering everything in the configuration files, etc, etc, etc.<span id="more-434"></span></p>
<p>Being such a cumbersome, error prone and repetitive process makes it an ideal candidate for automation. So we created a simple application called QBMageModuleShell. Although it was originally a command line application used for internal development, we have added a web frontend and released it to the community. In QBMageModuleShell you can point to your Magento installation and have the application perform some of these repetitive tasks for you. We have already <span style="color: #000000;">implemented several components to handle things like creating, deleting, enabling and disabling modules, building blocks, controllers and model classes, creating CRUD Admin for model classes, creating and running migrations, </span>and we are adding more stuff every day. Let me show you just a hint of the app:</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://research.quanbit.com/wp-content/uploads/2012/02/Module.png"><img class="aligncenter size-medium wp-image-502" title="Module" src="http://research.quanbit.com/wp-content/uploads/2012/02/Module-300x221.png" alt="" width="300" height="221" /></a></p>
<p>If you are willing to try it you can download it <a href="http://research.quanbit.com/magento/qbmagemoduleshell/">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/03/29/creating-magento-modules-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wilkinson is back! (Or at least I hope so)</title>
		<link>http://research.quanbit.com/2012/02/06/wilkinson-is-back-or-at-least-i-hope-so/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wilkinson-is-back-or-at-least-i-hope-so</link>
		<comments>http://research.quanbit.com/2012/02/06/wilkinson-is-back-or-at-least-i-hope-so/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 15:39:26 +0000</pubDate>
		<dc:creator>andres</dc:creator>
				<category><![CDATA[People we respect]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=413</guid>
		<description><![CDATA[Hernán Wilkinson is not only a guy who knows a lot about Object Oriented Programming and TDD, but also an excellent teacher. If you ever get the chance of hearing him speak (whether it is a talk at a conference, assisting to one of his courses in the university or by hiring his training services) [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-524 postimage" title="WilkinsonIsBack" src="http://research.quanbit.com/wp-content/uploads/2012/02/WilkinsonIsBack.jpeg" alt="" width="590" height="210" /></p>
<p><a href="http://www.10pines.com/content/who-we-are" target="_blank">Hernán Wilkinson</a> is not only a guy who knows <strong>a lot</strong> about Object Oriented Programming and TDD, but also an excellent teacher. If you ever get the chance of hearing him speak (whether it is a talk at a conference, assisting to one of his <a href="http://www.dc.uba.ar/rrhh/profesores/wilkinson" target="_blank">courses in the university</a> or by hiring his <a href="http://www.10pines.com/content/training-services">training services</a>) I would recommend that you don&#8217;t miss it.</p>
<p><span id="more-413"></span></p>
<p>Being such a fig fan of his talks I was quite happy last week when I started to see some blog articles written by him, in particular about the importance of using good names when we program. You can get a small taste of it here:</p>
<blockquote><p>&#8230;Good names make our lives easier, on the other hand, bad names make us feel in hell. Bad names suck energy from us because we have to <strong>“re-think”</strong> every time we see that bad name what it really means, what it is the real purpose of that thing being named. At the end, bad names obligate us to do the work that other should have done, that is why we <em>“hate”</em> programs written by others and we <em>“hate”</em> them more if they are badly written, if the names are bad&#8230;</p></blockquote>
<p>So, if you want to be a better programmer, please take a minute and go to read them: <a title="About &quot;names&quot; when designing with Objects" href="http://www.10pines.com/content/about-names-when-designing-objects" target="_blank">About &#8220;names&#8221; when designing with Objects</a> and <a title="The &quot;Art of Naming&quot;" href="http://www.10pines.com/content/art-naming" target="_blank">The &#8220;Art of Naming&#8221;</a>.</p>
<p>And as a bonus, if you like digging in the OOP history you may want to read the following page: <a title="Dr. Alan Kay  on the Meaning of “Object-Oriented Programming”" href="http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en" target="_blank">Dr. Alan Kay  on the Meaning of “Object-Oriented Programming”<cite title="person"></cite></a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/02/06/wilkinson-is-back-or-at-least-i-hope-so/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More flexibility for Magento&#8217;s cart options</title>
		<link>http://research.quanbit.com/2012/01/25/more-flexibility-for-magentos-cart-options/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=more-flexibility-for-magentos-cart-options</link>
		<comments>http://research.quanbit.com/2012/01/25/more-flexibility-for-magentos-cart-options/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 15:48:56 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[QBShippingAndPaymentFilters]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=328</guid>
		<description><![CDATA[When developing a project for one of our biggest clients, we realized that Magento had some very powerful and interesting rules for applying discounts on the shopping carts. Those rules take into account the amount of items in the shopping cart, the shipping address, the categories of the products and several other attributes. However, while [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-334 postimage" title="shipping-cart-filters" src="http://research.quanbit.com/wp-content/uploads/2012/01/paypal-shopping-cart.jpg" alt="" width="590" height="210" /></p>
<p>When developing a project for one of our biggest clients, we realized that Magento had some very powerful and interesting rules for applying discounts on the shopping carts. Those rules take into account the amount of items in the shopping cart, the shipping address, the categories of the products and several other attributes. However, while rules are very powerful, the possible actions to be performed are quite few. You can apply discounts or free shipping, but we needed something else: we needed to be able to enable or disable a shipping method based on the cart products.<br />
<span id="more-328"></span><br />
Imagine this: you are running your e-commerce site and you want your customer to be able to choose overnight delivery only if he/she is buying a product from the &#8216;offers&#8217; category. Thus, you would like to tell Magento to enable the overnight delivery only if there&#8217;s at least one product with the &#8216;offers&#8217; category in the cart.</p>
<p>That&#8217;s how QBShippingAndPaymentFilters was born. With this module you will be able to create rules to enable or disable either payments or shipping methods. These rules use the full power of Magento&#8217;s shopping cart rules and enable you to present the right options for the customer based on them.</p>
<p>For the example presented before you can set up a rule for doing exactly that; of course we assume that the overnight delivery shipping method is properly configured and disabled from Magento&#8217;s admin interface (it is the module&#8217;s responsibility to enable it when the conditions are met). As you can imagine, the same approach can be used for enabling and disabling payment methods.</p>
<p>If you like to try it out you can go to the <a href="http://research.quanbit.com/qbshippingandpaymentfilters">product page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/01/25/more-flexibility-for-magentos-cart-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elgg 1.8.3 released!</title>
		<link>http://research.quanbit.com/2012/01/18/elgg-1-8-3-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=elgg-1-8-3-released</link>
		<comments>http://research.quanbit.com/2012/01/18/elgg-1-8-3-released/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 12:08:58 +0000</pubDate>
		<dc:creator>andres</dc:creator>
				<category><![CDATA[Elgg]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=350</guid>
		<description><![CDATA[Although this is a bit of old news, I wanted to mention it: last week the release of elgg 1.8.3 was announced. I have to say I&#8217;m pretty amazed by the release speed of these guys. Keep up the good work!]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-351 postimage" title="OldNews" src="http://research.quanbit.com/wp-content/uploads/2012/01/OldNews.jpg" alt="" width="510" height="210" /></p>
<p>Although this is a bit of old news, I wanted to mention it: last week the <a href="http://blog.elgg.org/pg/blog/cash/read/203/elgg-183-released" target="_blank">release of elgg 1.8.3 was announced</a>. I have to say I&#8217;m pretty amazed by the release speed of these guys. Keep up the good work!</p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2012/01/18/elgg-1-8-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elgg 1.8.2 has been released</title>
		<link>http://research.quanbit.com/2011/12/21/elgg-1-8-2-has-been-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=elgg-1-8-2-has-been-released</link>
		<comments>http://research.quanbit.com/2011/12/21/elgg-1-8-2-has-been-released/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 15:52:33 +0000</pubDate>
		<dc:creator>andres</dc:creator>
				<category><![CDATA[Elgg]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=275</guid>
		<description><![CDATA[Just a quick update: elgg 1.8.2 has been released. You can find the bugfixes and enhancements in the announcement. We are very happy to have contributed with our small grain of sand and hope to keep doing so.]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-279 postimage" title="Elgg 1.8.2" src="http://research.quanbit.com/wp-content/uploads/2011/12/Elgg-182.jpg" alt="Elgg 1.8.2" width="590" height="210" /></p>
<p>Just a quick update: elgg 1.8.2 has been released. You can find the bugfixes and enhancements in <a href="http://blog.elgg.org/pg/blog/cash/read/202/elgg-182-released">the announcement</a>.<br />
We are very happy to have contributed with our small grain of sand and hope to keep doing so.</p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2011/12/21/elgg-1-8-2-has-been-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a &#8220;Hello World&#8221; Test with QBElggTestsForPHPUnit</title>
		<link>http://research.quanbit.com/2011/12/16/writing-a-hello-world-test-with-qbelggtestsforphpunit/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=writing-a-hello-world-test-with-qbelggtestsforphpunit</link>
		<comments>http://research.quanbit.com/2011/12/16/writing-a-hello-world-test-with-qbelggtestsforphpunit/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 20:57:45 +0000</pubDate>
		<dc:creator>andres</dc:creator>
				<category><![CDATA[Elgg]]></category>
		<category><![CDATA[QBElggTestsForPHPUnit]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://research.quanbit.com/?p=260</guid>
		<description><![CDATA[&#160; Writing a test with QBElggTestsForPHPUnit is not much different that writing a standard test with PHPUnit. In future posts we will see how to tweak things a little (like adding custom fixtures) but right now I&#8217;m just going to show you how to write a very simple tests: the HelloWorldTest . The purpose of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-261 postimage" title="Hello World" src="http://research.quanbit.com/wp-content/uploads/2011/12/Hello-World.jpeg" alt="Hello World" width="590" height="210" /></p>
<p>&nbsp;</p>
<p>Writing a test with QBElggTestsForPHPUnit is not much different that writing a standard test with PHPUnit. In future posts we will see how to tweak things a little (like adding custom fixtures) but right now I&#8217;m just going to show you how to write a very simple tests: the HelloWorldTest . The purpose of this test is two-folded:<span id="more-260"></span></p>
<ul>
<li>Showing a simple example of a test.</li>
<li>Showing that each test runs on a &#8220;clean&#8221; DB state.</li>
</ul>
<p>To do this we will create a test case class with two test methods (testCreateNewObject1 and testCreateNewObject2) such that the second test depends on the first one. This will ensure that testCreateNewObject1 will run always before testCreateNewObject2 (check the <a href="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.test-dependencies">@depends PHPUnit directive</a>).</p>
<p>In testCreateNewObject1 we are going to create a new object, save it to the DB and check that it has a valid GUID. But that&#8217;s not it: we are also going to pass the GUID of the object to the next test and see what happens when testCreateNewObject2 creates a new object. If the tests don&#8217;t share the same DB state then creating a new object should yield the same GUID, since both tests where executed on &#8220;clean&#8221; DBs. As a matter of fact, the GUID created in testCreateNewObject1 should not even be a valid entity GUID in testCreateNewObject2.</p>
<p>So, here goes the code with the necessary comments:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../QBElggTestsForPHPUnit/model/ElggTestCase.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> HelloWorldTest <span style="color: #000000; font-weight: bold;">extends</span> ElggTestCase<br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #009933; font-style: italic;">/**<br />
* We are going to test that creating an object in<br />
* different tests yields the same GUID. To do this<br />
* we create an object in one test and pass the GUID to<br />
* another test that depends on this one.<br />
*<br />
* @return int GUID<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testCreateNewObject1<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ElggObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Hello World Test!&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertInternalType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'integer'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertNotNull</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertNotEquals</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* Now we check that there is no entity with<br />
* the previously created GUID and that if<br />
* we create a new object we get that GUID<br />
* again.<br />
*<br />
* @depends testCreateNewObject1<br />
*<br />
* @param int $guid<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testCreateNewObject2<span style="color: #009900;">&#40;</span><span style="color: #000088;">$guid</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertEquals</span><span style="color: #009900;">&#40;</span>get_entity<span style="color: #009900;">&#40;</span><span style="color: #000088;">$guid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ElggObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;A new object&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertInternalType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'integer'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertNotNull</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertNotEquals</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertEquals</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGUID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>We can now run this test in the console by doing:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">phpunit <span style="color: #660033;">--process-isolation</span> HelloWorldTest.php<br />
PHPUnit 3.6.3 by Sebastian Bergmann.<br />
<br />
..<br />
<br />
Time: <span style="color: #000000;">6</span> seconds, Memory: 2.75Mb<br />
<br />
OK <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span> tests, <span style="color: #000000;">8</span> assertions<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>And that is pretty much it <img src='http://research.quanbit.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://research.quanbit.com/2011/12/16/writing-a-hello-world-test-with-qbelggtestsforphpunit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

