Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Add parent_item_id to sales_flat_order_item #15

Open
alexkleger opened this issue Oct 25, 2016 · 2 comments
Open

Add parent_item_id to sales_flat_order_item #15

alexkleger opened this issue Oct 25, 2016 · 2 comments

Comments

@alexkleger
Copy link

alexkleger commented Oct 25, 2016

In situations where the simple and configurable product_type are each inserted as separate rows on SFOI, we use this field to filter out the simple rows. This prevents duplication.

parent_item_id references the item_id of the equivalent configurable row, for example:

| item_id | order_id | product_id | product_type | parent_item_id |
|---------|----------|------------|--------------|----------------|
| 35169   | 7738     | 9947       | configurable |                |
| 35170   | 7738     | 9940       | simple       | 35169          |
| 35171   | 7738     | 9947       | configurable |                |
| 35172   | 7738     | 9930       | simple       | 35171          |
| 35173   | 7738     | 9947       | configurable |                |
| 35174   | 7738     | 9932       | simple       | 35173          |
| 134858  | 28095    | 6629       | configurable |                |
| 134859  | 28095    | 6628       | simple       | 134858         |
| 134860  | 28095    | 6614       | configurable |                |
| 134861  | 28095    | 10856      | simple       | 134860         |
| 134862  | 28095    | 10726      | configurable |                |
| 134863  | 28095    | 10721      | simple       | 134862         |

parent_item_id = INT(10), default to null

@robertjmoore
Copy link
Contributor

@alexkleger is this actually creating an issue in the sample data, or do you just want this added for illustrative purposes? From what I can see, the data generated now doesn't even use product_type in this way (it seems to be inserting a category name like "tools" in to that field). Do we need to revamp how product/items data is generated in order to make this issue relevant or am I overcomplicating things?

@alexkleger
Copy link
Author

@robertjmoore you are correct. I missed that there wasn't an open issue for product_type yet.

The data should be generated as in the above example — two rows for each product, where one row is simple, one row configurable.

BUT a workaround here is to simply to add a non-null parent_item_id to all the rows, as the goal of this is to be able to add a clause in the "Order items we count" filter set restricting the data to where parent_item_id is not null. This is how the SEs prevent double counting of items sold.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants