<?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>Magento Design and Development &#187; eav</title>
	<atom:link href="http://inchoo.net/tag/eav/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Fri, 10 Sep 2010 10:39:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Magento 1.4 new things in EAV attributes</title>
		<link>http://inchoo.net/ecommerce/magento/magento-1-4-new-things-in-eav-atributes/</link>
		<comments>http://inchoo.net/ecommerce/magento/magento-1-4-new-things-in-eav-atributes/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 10:41:54 +0000</pubDate>
		<dc:creator>Domagoj Potkoc</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[eav]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=4183</guid>
		<description><![CDATA[If you install new version of Magento 1.4, you can see that existing differences in structures of eav attributes. Earlier all data of EAV attributes were in table eav_attribute, now in new version eav_attribute table is smaller, beacuse a lot of fileds moved in new tables. Structure of mysql table eav_attribute, Magento version 1.4: Structure [...]]]></description>
			<content:encoded><![CDATA[<p>If you install new version of Magento 1.4, you can see that existing differences in structures of eav attributes. Earlier all data of EAV attributes were in table <strong>eav_attribute</strong>, now in new version eav_attribute table is smaller, beacuse a lot of fileds moved in new tables.<br />
<span id="more-4183"></span><br />
<strong>Structure of mysql table eav_attribute, Magento version 1.4:</strong><br />
<a href="http://inchoo.net/wp-content/uploads/2010/03/eav_attributes_magento1.4.jpg" rel="lightbox[4183]"><img src="http://inchoo.net/wp-content/uploads/2010/03/eav_attributes_magento1.4-637x300.jpg" alt="" title="eav_attributes_magento1.4" width="637" height="300" class="alignnone size-medium wp-image-4186" /></a></p>
<p><strong>Structure of mysql table eav_attribute, Magento version 1.3:</strong><br />
<a href="http://inchoo.net/wp-content/uploads/2010/03/eav_attributes_magento1.3.jpg" rel="lightbox[4183]"><img src="http://inchoo.net/wp-content/uploads/2010/03/eav_attributes_magento1.3-637x514.jpg" alt="" title="eav_attributes_magento1.3" width="637" height="514" class="alignnone size-medium wp-image-4188" /></a></p>
<p>In new version of Magento, we have new table as: <strong>catalog_eav_attribute, customer_eav_attribute</strong> and so on&#8230;..</p>
<p>One important thing: the model <strong>Mage_Eav_Model_Entity_Setup</strong> has changes in new version of Magento.  I have a problems with update attributes.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/magento-1-4-new-things-in-eav-atributes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Escape from EAV the Magento way</title>
		<link>http://inchoo.net/ecommerce/magento/escape-from-eav-the-magento-way/</link>
		<comments>http://inchoo.net/ecommerce/magento/escape-from-eav-the-magento-way/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 23:01:04 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[eav]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=2182</guid>
		<description><![CDATA[One of the differences between Magento eCommerce platform and lets say WordPress, when looked from developer point of view, is &#8220;avoid raw queries&#8221; approach. For a web application, Magento is massive system. His database, although not so massive but surely breathtaking with around 220 tables forces you to use &#8220;eye candy&#8221; EAV model to do [...]]]></description>
			<content:encoded><![CDATA[<p>One of the differences between Magento eCommerce platform and lets say WordPress, when looked from developer point of view, is &#8220;avoid raw queries&#8221; approach. For a web application, Magento is massive system. His database, although not so massive but surely breathtaking with around 220 tables forces you to use &#8220;eye candy&#8221; EAV model to do even simple things.<span id="more-2182"></span></p>
<p>For instance, if I were to tell you that I want you to retrieve 5 simple products from database that have price in the range of 200-600USD you would most likely spent 1-4 hours trying to work out the query. In the end you would be lucky if you even get the query that wont break on next Magento upgrade. Let me just remind you on some of the things you need to be careful in example above.</p>
<p>Your query would have to take in consideration the at least the following states: is my product visibility such that it can be seen in Catalog and search result, is my product enabled or disabled, is is out of stock, which website and store view has it been assigned, is it assigned to only one category and that category is disabled by some chance, does it have special price assigned, does it have promotion rules assigned, does it have content (descriptions) for multilingual site assigned.</p>
<p>All of those and more are questions that one has to take into consideration when doing raw database queries. It makes no sense to create query that fetches product and all its appropriate info (price, quantity, description&#8230;) if that product is disabled or assigned to category that is disabled. For instance, if you need &#8220;featured&#8221; product functionality and you manually create raw query that extracts one &#8220;featured&#8221; product to lets say home page. There you create nice block holding all the necessary info of the product with a link for lets say &#8220;Add to cart&#8221; or &#8220;View product&#8221;. Clicking one of those two link would give you most likely 404 if the product is disable or any other condition that enables the product to be shown is disabled.</p>
<p>So basically, raw SQL queries in Magento are a &#8220;no no&#8221; for most of the time. Too much work and you never know what they will change in future upgrades. Which brings me to this new trend of theirs which I like to call &#8220;Escape from EAV&#8221;.</p>
<p><a title="The Soul is trying to escape from Hell // The Gates of Hell" href="http://en.wikipedia.org/wiki/The_Gates_of_Hell" target="_blank"><img class="size-full wp-image-2282 alignright" title="Gates of Hell" src="http://inchoo.net/wp-content/uploads/2009/06/gates_of_hell.jpg" alt="Gates of Hell" width="310" height="324" /></a>EAV, also know as Entity Attribute Value was suppose to bee (or is) the next big thing in OOP. Anyhow, Magento and his way of EAV have two huge downfalls called LACK OF DOCUMENTATION and WHAT WILL THEY CHANGE IN NEXT UPGRADE. The other day I was working on a Magento  shop that had 22 000 products. Almost all of them were simple products, just about 600 were grouped. The store was initially installed on Magento 1.2 version. Site was pretty much 95% complete from both graphic and development perspective. Anyhow, Magento version 1.3.1 was released and on client demand we decide to to upgrade. Important thing to keep in mind is that in version 1.3 Magento introduce &#8220;change in philosophy&#8221; concerning the EAV model.</p>
<p>Altough EAV sounds great (and really is great for most of the time), it can really slow things down with all those JOINS executed on database. So the Magento team decided to do a little flat tabling. Basically we now have massive data duplication in MySQL where data is taken from various tables and copied int one, the flat table. Flat tables were introduced for both Products and categories, in regards to various website and store views.</p>
<p>Basically Magento has the power to &#8220;on the fly&#8221; create tables and do the &#8220;magical&#8221; copying of data from various tables to the flat tables. I assume they were looking for a faster way to &#8220;assemble&#8221; Product objects in Magento which in turn should boost the speed of collection object i grew so found about. I can live with duplicated data in database, I mean I am not the one writing them down. But let me get back to real world scenario.</p>
<p>As I mentioned, store I have been working on had more than 20 000 products. Due to limitations of both MySQL and PHP failed to do Rebuilt that you can find in System &gt; Configuration &gt; Cache management. This failure caused corrupted data in database. This manifested with &#8220;empty&#8221; attributes (attributes not showing up in Layered navigation). I resolved the issue by &#8220;re saving&#8221; all of the 20 000 product with custom script I wrote. After that i noticed the data in flat tables got rebuild as well. This of course took several hours. Magento EAV model seems OK on paper, but with store that hold&#8217;s large number of products it simply does not work, at least not in way in which their collection objects are built. Changes introduced in form of flat tables in versions 1.3  should, to some extent, improve work with stores that have large numbers of products. However this improvement seems to come in form of &#8220;copy all data from scattered tables to single flat table&#8221;.</p>
<p>Solutions like these are nightmare when it comes to upgrading the store that already has large number of products in. System is expected to handle part of the job transparently but it failed, leaving the client with corrupted database.</p>
<p>So, a word of advice for upgrading an existing Magento store: NEVER do it on live site. Let professional developer transfer live site and database to his dev machine, or make a copy on some sub folder on live site. Magento&#8217;s extreme out of the box feature rich capabilities, open source philosophy and good marketing have made it extremely popular but be careful, free is such a a loose term.</p>
<p>I am really anxious to see the future path of EAV vs Flat model in Magento.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/escape-from-eav-the-magento-way/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Magento MySQL database diagram</title>
		<link>http://inchoo.net/ecommerce/magento/magento-mysql-database-structure/</link>
		<comments>http://inchoo.net/ecommerce/magento/magento-mysql-database-structure/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 21:36:00 +0000</pubDate>
		<dc:creator>Tomislav Bilic</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[eav]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=241</guid>
		<description><![CDATA[If you worked with osCommerce, Zen Cart, CRE Loaded or any similar eCommerce platform before, you might find Magento database structure quite confusing when you see it for the first time. I advise you not to rush too much figuring out what is what by glancing through database. Try to spend first few hours getting [...]]]></description>
			<content:encoded><![CDATA[<p>If you worked with osCommerce, Zen Cart, CRE Loaded or any similar eCommerce platform before, you might find Magento database structure quite confusing when you see it for the first time. I advise you not to rush too much figuring out what is what by glancing through database. Try to spend first few hours getting familiar with some background. For purposes of flexibility, the Magento database heavily utilizes an Entity-Attribute-Value (EAV) data model. As is often the case, the cost of flexibility is complexity. Is there something in Magento that is simple from developers point of view?</p>
<p><span id="more-241"></span></p>
<p>Data manipulation in Magento is often more knowledge demanding  than that typical use of traditional relational tables. Therefore, an understanding of EAV principles and how they have been modeled into Magento it is HIGHLY recommended before making changes to the Magento data or the Magento schema (<a class="urlextern" title="http://en.wikipedia.org/wiki/Entity-attribute-value_model" rel="nofollow" href="http://en.wikipedia.org/wiki/Entity-attribute-value_model">Wikipedia: Entity-attribute-value_model</a>). Varien has simplified the identification of EAV related tables with consistent naming conventions. Core EAV tables are prefixed with “EAV_”. Diagrams in this post contain a section labeled “EAV” which displays Magento’s core EAV tables and thier relationships to non-EAV tables.</p>
<p><img class="alignnone size-medium wp-image-236" title="layout_example1" src="http://inchoo.net/wp-content/uploads/2008/10/layout_example1-637x352.png" alt="" width="637" height="352" /></p>
<p><a href="http://inchoo.net/wp-content/uploads/2008/10/magento_v116-database_diagram.pdf">Download Magento 1.1.6 MySQL database diagram (PDF, 173kb)</a></p>
<p>Database diagrams and documents found in this post are intended to mirror the database schema as defined by Varien. Table relationships depicted in the diagrams represent <strong>only those relationships explicitly defined as Foreign Keys in the Magento database</strong>. Additional informal/undiagrammed table relationships may also exist, so when modifying the schema or directly manipulating data it is important to identify and evaluate possible changes to these tables as well (and the tables they relate to, and the tables they relate to&#8230;).</p>
<p>The author of Database Diagram is Gordon Goodwin, IT Consultant. You can see his info in the PDF.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/magento-mysql-database-structure/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
