entity-attribute-value

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

本秂侑毒 提交于 2019-12-23 03:33:09
问题 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'];

Convert two columns into key-value json object?

安稳与你 提交于 2019-12-21 04:19:23
问题 Using FOR JSON AUTO or FOR JSON PATH on the following record set (which representing a product's attributes): attribute | value ----------------- color | red size | small will produce: [{"attribute":"color","value":"red"},{"attribute":"size","value":"small"}] Is there any way to produce the following Instead: {"color":"red","size":"small"} Note that as every product attribute is different than others; so this record set is different for every product. PIVOTing is not an option as it needs

How to define structure in a tag-based organization?

自作多情 提交于 2019-12-21 02:38:24
问题 [former title: Is there a way to force a relationship structure on a tag-based organizational methodology?] I have some entities, and they have a series of attributes. Some of the attributes affect what other attributes the entity can have, many of the attributes are organized into groups, and occasionally entities are requited to have certain numbers of attributes from certain groups, or possibly a range of attributes from certain groups. Is there a way to model these sorts of tag-to-tag

Table Module vs. Domain Model

落花浮王杯 提交于 2019-12-20 09:15:28
问题 I asked about Choosing a method to store user profiles the other day and received an interesting response from David Thomas Garcia suggesting I use the Table Module design pattern. It looks like this is probably the direction I want to take. Everything I've turned up with Google seems to be fairly high level discussion, so if anyone could point me in the direction of some examples or give me a better idea of the nuts and bolts involved that would be awesome. 回答1: The best reference is

Filtering EAV table with multiple conditions

为君一笑 提交于 2019-12-19 09:10:10
问题 I have 2 tables: Table objects : object_id | object_group_id Table attributes : attr_id | attr_object_id | attr_property_id | attr_value Now, I want to get all object_id where object_group_id = 1 and filters two attributes: (attr_property_id = 1 AND attr_value <= '100000') AND (attr_property_id = 2 AND attr_value > '2000') I was trying to construct some queries, like this: SELECT * FROM objects as o /* filter1 join */ INNER JOIN attributes AS f1 ON o.object_id = f1.attr_object_id AND f1.attr

is EAV - Hybrid a bad database design choice

故事扮演 提交于 2019-12-18 10:19:39
问题 We have to redesign a legacy POI database from MySQL to PostgreSQL. Currently all entities have 80-120+ attributes that represent individual properties. We have been asked to consider flexibility as well as good design approach for the new database. However new design should allow: n no. of attributes/properties for any entity i.e. no of attributes for any entity are not fixed and may change on regular basis. allow content admins to add new properties to existing entities on the fly using

Too many tables; MySQL can only use 61 tables in a join

戏子无情 提交于 2019-12-17 18:55:47
问题 What is the best way to export data from multiple tables in MySQL. I'm basically working with product details. Say a product has 150 attributes of data. How can I export that in a single row and then export it to a flat file in CSV or tabdelimited format. Getting error Too many tables; MySQL can only use 61 tables in a join /**** Get Resultset *****/ $rs = mysql_query($sql); /**** End of Get Resultset *****/ $objProfileHistory->addHistory($this->profile_id, "Loaded ". mysql_num_rows($rs)."

(PHP & mySQL) Treat rows as columns

不问归期 提交于 2019-12-14 03:06:52
问题 I am working on PHP & mySQL based website. I am trying to setup the 'Settings' page in administration panel where I can enter different settings to manage the site. The settings can range upto 100 (or even more) depending upon the requirements. So instead of making 100 columns (and increase if I have to add more columns in future), I want to store the data in row wise format and fetch the values as if I am fetching it from columns. REFERENCE: I found a similar real life implementation of such

in MySQL, is it good to have 500 Columns in one table?

一世执手 提交于 2019-12-13 08:35:19
问题 in MySQL, is it good to have 500 Columns in one table? the rows will be increasing daily, the maximum row count would be less than or equal to 1million. just to give a brief, these are my column headers TableName: process_detail id, process_id, item_id, item_category, attribute1,attribute2,attribute3,...,attribute500,user_id1_update_time,user_id2_update_time,user_id1_comments,user_id2_comments all attributes are varchar with length maximum 30. but less than 30. and i have 25 item_categories.

Are there more elegant ways of querying data based on values stored in attribute-value table?

强颜欢笑 提交于 2019-12-13 04:10:57
问题 I have an attribute-value table av that looks like this: | attribute | value | ~~~~~~~~~~~~~~~~~~~~~ | a1 | A1 | | b1 | BB1 | | b2 | BB2 | For simplicity, assume varchar(255) on both attribute and value columns, unique index on attribute . I need to use the values of specific attributes in a query, which looks like this: SELECT * FROM t1 ,t2 WHERE t1.a1 = "A1" -- Value of "a1" attribute AND t1.id = t2.id AND t2.b1 = "BB1" -- Value of "b1" attribute AND t2.b2 = "BB2" -- Value of "b2" attribute