entity-attribute-value

eav_entity_type without quote at installation

匆匆过客 提交于 2019-12-07 10:33:08
问题 the origin... I have a module with a setup script (common mysql4-upgrade-0.1.0-0.1.1.php), adding an attribute to quote: $eav = new Mage_Eav_Model_Entity_Setup('sales_setup'); $eav->addAttribute('quote', 'my_attribute', array('type' => 'varchar')); If I run my magento store on an empty DB, setups scripts run and a 'Wrong entity ID' error breaks the process. Call stack points to my setup script. ...looking for... If I go to database, I see eav_entity_type table filled but only with 8 types:

Join/Pivot items with EAV table

允我心安 提交于 2019-12-07 08:32:35
问题 I have a table like below which would have the product description ╔════╦══════════════╦══════╗ ║ Id ║ name ║ price║ ╠════╬══════════════╬══════╣ ║ 1 ║ Apple ║ 23 ║ ║ 2 ║ shirt ║ 148 ║ ║ 3 ║ computer ║ 101 ║ ║ 4 ║ printer ║ 959 ║ ╚════╩══════════════╩══════╝ and another table which is holding the attributes like linked by the ID ╔════╦══════════════╦══════╗ ║ Id ║ attr_name ║ Value║ ╠════╬══════════════╬══════╣ ║ 1 ║ color ║ red ║ ║ 1 ║ size ║ xl ║ ║ 1 ║ brand ║ App ║ ║ 2 ║ color ║ blue║ ║ 2

Make WTForms set field label from database model

匆匆过客 提交于 2019-12-07 07:41:53
问题 I have three tables: components , attributes and attribute_values . Each component can have many attribute_values . Each attribute_value belongs to one attribute . Yeah, it's the dreaded EAV pattern... I have created these two forms: class AttributeValueForm(Form): attribute = HiddenField() value = StringField('Value') class ComponentForm(Form): ... non-related fields left out ... attribute_values = FieldList(FormField(AttributeValueForm)) These are the SQLAlchemy models: class Component(db

properties table pattern vs storing all properties in json column [duplicate]

一个人想着一个人 提交于 2019-12-07 04:35:28
This question already has answers here : When can I save JSON or XML data in an SQL Table (8 answers) Storing JSON in database vs. having a new column for each key (10 answers) Closed 8 months ago . I'd like some feedback on having all properties a model can have in a properties table accessed via relationship (using laravel relationships) vs storing all properties/settings in the same table but in a json column. Currently, my application has a propeties table called settings that is also polymorphic in nature so multiple models can store their properties there. This table has columns like key

MySQL Update multiple rows on a single column based on values from that same column

允我心安 提交于 2019-12-07 01:37:27
问题 I have a table that looks like the following: ID Key Value Order 1 gender m 0 2 gender f 0 34 age 10 0 35 age 80 0 To update these rows I have to use the following: UPDATE `DemoGroup` SET `value` = 'male' WHERE `value` = 'm' UPDATE `DemoGroup` SET `value` = 'female' WHERE `value` = 'f' UPDATE `DemoGroup` SET `value` = '10-19' WHERE `value` = '10' UPDATE `DemoGroup` SET `value` = '80-89' WHERE `value` = '80' Is there a way to consolidate this into one update statement, without using the ID

Magento: Setting a custom attribute on the sales/order_shipment model

限于喜欢 提交于 2019-12-06 17:25:40
I'm trying to add an EAV attribute called "vendorping" to the sales/order_shipment model. To accomplish this, I created the following file in my module: // app\code\local\Jb\Vendorping\sql\vendorping_setup\mysql4-install-0.1.0.php $this->startSetup(); $sql = 'SELECT entity_type_id FROM `'.$this->getTable('eav_entity_type').'` WHERE entity_type_code = \'shipment\''; $row = Mage::getSingleton('core/resource') ->getConnection('core_read') ->fetchRow($sql); $entityTypeId = $row['entity_type_id']; $c = array( 'entity_type_id' => $entityTypeId, 'attribute_code' => 'vendorping', 'backend_type' =>

Entity attribute value model - Performance alternative?

£可爱£侵袭症+ 提交于 2019-12-06 16:03:04
问题 I work with PHP and mySQL. I have a page table and a meta table. It looks a little bit like this. Page table page_id | headline | content -------------------------- 1 | My headline | My content 2 | Another one | Another text Meta table id | page_id | meta_key | meta_value ------------------------------------ 1 | 2 | seo_title | Hello world 2 | 2 | price | 299 I've read that this type of model is called EAV. I also read that it is bad for performance. My meta table is made for any kind of

Designing a database : Which is the better approach? [closed]

别等时光非礼了梦想. 提交于 2019-12-06 12:07:26
Closed . This question is opinion-based . It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 6 years ago . I am designing a database and am wondering which approach should I use. I am going to describe the database I intend to design and the possible approaches that I can use to store the data in the tables. Please recommend which approach I should use and why? About the data: A) I have seven attributes that need to be taken care of. These are just examples and not the actual

EAV Select query from spreaded value tables

泪湿孤枕 提交于 2019-12-06 09:39:21
I have the following SQL Server database structure I have to use to query data. The model could be wrong; I appreciate arguments if that's the case so I can ask for changes. If not, I need a query to get tabbed data in the format I will detail below. The structure goes like this: CLIENTS : ClientID ClientName ----------------------- 1 James 2 Leonard 3 Montgomery ATTRIBUTES : AttributeID AttributeName ----------------------------- 1 Rank 2 Date 3 Salary 4 FileRecordsAmount ATTRIBUTES_STRING : ClientID AttributeID AttributeStringValue 1 1 Captain 2 1 Chief Surgeon 3 1 Chief Engineer ATTRIBUTES

How make this eav query to make horizontal result

丶灬走出姿态 提交于 2019-12-06 04:37:28
问题 The case: tables: product: product_id|name | ------------------------ 1 |iphone 4 | 2 |gallaxy 2 | 3 |blackbery 6 | product_attribute: id|product_id|attribute_id -------------------------------------------------- 1 |1 |2 2 |1 |6 . . . attribute: ------------------------------ attribute_id|name |value| 1 |width |300 2 |width |320 3 |width |310 4 |height|390 5 |height|370 6 |height|380 should get result: product_id|height|width 1 |380 |320 ...................... Edit: height and width