Alternatives to Entity-Attribute-Value (EAV)?

There is a difference between EAV done faithfully or badly; 5NF done by skilled people or by those who are clueless. Sixth Normal Form is the Irreducible Normal Form (no further Normalisation is possible). It eliminates many of the problems that are common, such as The Null Problem, and provides the ultimate method identifying missing … Read more

ALTER TABLE in Magento setup script without using SQL

You can use such methods within your setup script: Use Varien_Db_Ddl_Table class to create new tables, where you can configure all the fields, keys, relations in combination with $this->getConnection()->createTable($tableObject) Example: /* @var $this Mage_Core_Model_Resource_Setup */ $table = new Varien_Db_Ddl_Table(); $table->setName($this->getTable(‘module/table’)); $table->addColumn(‘id’, Varien_Db_Ddl_Table::TYPE_INT, 10, array(‘unsigned’ => true, ‘primary’ => true)); $table->addColumn(‘name’, Varien_Db_Ddl_Table::TYPE_VARCHAR, 255); $table->addIndex(‘name’, ‘name’); $table->setOption(‘type’, … Read more

Magento – Retrieve products with a specific attribute value

Almost all Magento Models have a corresponding Collection object that can be used to fetch multiple instances of a Model. To instantiate a Product collection, do the following $collection = Mage::getModel(‘catalog/product’)->getCollection(); Products are a Magento EAV style Model, so you’ll need to add on any additional attributes that you want to return. $collection = Mage::getModel(‘catalog/product’)->getCollection(); … Read more

Modeling Product Variants

You could have a design like: +—————+ +——————-+ | PRODUCTS |—–< PRODUCT_VARIANTS | +—————+ +——————-+ | #product_id | | #product_id | | product_name | | #variant_id | +—————+ | sku_id | | +——————-+ | | +——–^——–+ +——–^——–+ | PRODUCT_OPTIONS |—–< VARIANT_VALUES | +—————–+ +—————–+ | #product_id | | #product_id | | #option_id | | #variant_id … Read more

Entity Attribute Value Database vs. strict Relational Model Ecommerce

There’s a few general pros and cons I can think of, there are situations where one is better than the other: Option 1, EAV Model: Pro: less time to design and develop a simple application Pro: new entities easy to add (might even be added by users?) Pro: “generic” interface components Con: complex code required … Read more

Entity Attribute Value Database vs. strict Relational Model Ecommerce

There’s a few general pros and cons I can think of, there are situations where one is better than the other: Option 1, EAV Model: Pro: less time to design and develop a simple application Pro: new entities easy to add (might even be added by users?) Pro: “generic” interface components Con: complex code required … Read more