1 item, many configuration options - magento

Example item
___________________________________________________
| ITEM | COLOR | SIZE | QTY | PRICE | SKU |
===================================================
| Shirt | Black | S | 35 | $8.00 | ShirtBS |
| Shirt | Black | M | 52 | $8.00 | ShirtBM |
| Shirt | Black | L | 19 | $8.00 | ShirtBL |
| Shirt | Black | XL | 27 | $8.00 | ShirtBXL |
| Shirt | Black | XXL | 16 | $10.00 | ShirtBXXL |
| Shirt | White | S | 17 | $8.00 | ShirtWS |
| Shirt | White | M | 20 | $8.00 | ShirtWM |
| Shirt | White | XXL | 9 | $10.00 | ShirtWXXL |
---------------------------------------------------
Currently I have my items set up as
Item 1 - $8 - Qty 16
Shirt (Black)
- select box (size) - options S|M|L|XL|XXL (+$2) { SKU starting ShirtB- }
Item 2 - $8 - Qty 9
Shirt (White)
- select box (size) - options S|M|XXL (+$2) { SKU starting ShirtW- }
Is there a configuration where my customer can view it as 1 item, where they select color and size options will change based on color they choose, and SKU will follow with proper selection?
Even better if quantities follow through, currently I am setting base quantity on whatever the lowest number is (so Shirt (White) lists 9 available and Shirt (Black) lists 16; using my example above)
Item - $8
- select box (color) - options Black|White
+ selected 'Black'
- select box (size) - options S|M|L|XL|XXL (+$2) {SKU starting ShirtB- }
+ selected 'White'
- select box (size) - options S|M|XXL (+$2) { SKU starting ShirtW- }
I am willing to accept paid add-on's through Magento store if necessary (and not prohibitive in cost), although I would hope that this functionality is built in and I am just not able to find it
My import is through MAGMI, so special bonus points if it can be easily accomplished this way

The behaviour you describe is typically handled by a standard "configurable product" in magento.
see this tutorial
Magmi is able to process configurable products through its "configurable" plugin.
Depending on the pricing model that suits you the most , you may also try "Simple Configurable Products" extension.

Related

ArrayFormula - If cell contains match, combine other cells with TEXTJOIN

I have a Google Sheet that contains names of characters, together with corresponding values for the group name, "selected" and attack power. It looks like this:
Sheet1
| NAME | GROUP NAME | SELECTED | ATTACK POWER |
|:---------|:-----------|----------:|-------------:|
| guile | Team Red | 1 | 333 |
|----------|------------|-----------|--------------|
| blanka | Team Red | 1 | 50 |
|----------|------------|-----------|--------------|
| sagat | Team Red | | 500 |
|----------|------------|-----------|--------------|
| ruy | Team Blue | 1 | 450 |
|----------|------------|-----------|--------------|
| vega | Team Blue | 2 | 150 |
Sheet2
In my second sheet, I have two columns. Group name, which contains names of each team from Sheet1 and names, which contains my current ArrayFormula:
=ARRAYFORMULA(TEXTJOIN(CHAR(10); 1;
REPT('Sheet1'!A:A; 1*('Sheet1'!B:B=A2))))
Using this formula I can combine all characters into one cell (with textjoin, repeated with row breaks) based on the value in Group name. The result looks like the following:
| GROUP NAME | NAME |
|:-----------|:--------------------------|
| Team Red | guile |
| | blanka |
| | sagat |
|------------|---------------------------|
| Team Blue | ruy |
| | vega |
|------------|---------------------------|
The problem is that I only want to combine the characters with having a selected value of 1. End-result should instead look like this:
| GROUP NAME | NAME |
|:-----------|:--------------------------|
| Team Red | guile |
| | blanka |
|------------|---------------------------|
| Team Blue | ruy |
|------------|---------------------------|
I tried the following setup using a IF-statement, but it just returns a string of FALSE:
=ARRAYFORMULA(TEXTJOIN(CHAR(10); 1;
REPT(IF('Sheet1'!C:C="1";'Sheet1'!A:A); 1*('Sheet1'!B:B=A2))))
Can this be one?
paste in F2 cell:
=UNIQUE(FILTER(B:B, C:C=1))
paste in G2 cell and drag down:
=TEXTJOIN(CHAR(10), 1, FILTER(A:A, B:B=F2, C:C=1))
or G2 cell be like:
=ARRAYFORMULA(TEXTJOIN(CHAR(10), 1,
REPT(FILTER(Sheet1!A:A, Sheet1!C:C=1), 1*(FILTER(Sheet1!B:B, Sheet1!C:C=1)=F2))))

Split a single row into multiple rows with grouping data check - Hive

Now I'm using the query below in hive to split a row into multiple rows, but I also want to group a "Product" column based on "Category" column each group will match by the order of the group and have ";" to sperate each group and have "," separate item in the group.
SELECT id, customer, prodcut_split
FROM orders lateral view explode(split(product,';')) products AS prodcut_split
Here is my data look like now
| id | Customer| Category | Product |
+----+----------+---------------------------+-----------------------------------+
| 1 | John | Furniture; Technology | Bookcases, Chairs; Phones, Laptop |
| 2 | Bob | Office supplies; Furniture| Paper, Blinders; Tables |
| 3 | Dylan | Furniture | Tables, Chairs, Bookcases |
my desired result will look like:
| id | Customer| Category | Product |
+----+----------+----------------+-----------+
| 1 | John | Furniture | Bookcases |
| 1 | John | Furniture | Chairs |
| 1 | John | Technology | Phones |
| 1 | John | Technology | Laptop |
| 2 | Bob | Office supplies| Paper |
| 2 | Bob | Office supplies| Blinders |
| 2 | Bob | Furniture | Tables |
| 3 | Dylan | Furniture | Tables |
| 3 | Dylan | Furniture | Chairs |
| 3 | Dylan | Furniture | Bookcases |
I have tried this one and it's work well, all credit goes to this question: Hive - Split delimited columns over multiple rows, select based on position
select id,customer ,category, products
from
(
SELECT id, category, product
FROM tale_name
lateral VIEW posexplode(split(category,';')) category AS pos_category, category_split
lateral VIEW posexplode(split(product,';')) product AS pos_product, product_split
WHERE pos_category = pos_product) a
lateral view explode(split(product_split,',')) product_split AS products

Get average value for every N tuples in Apache Pig

Assuming I have a table with two columns CUSTTYPE and AMOUNT. I want to add a third column NTILE which I can then group on and use to get my averages, something like below:
CUSTTYPE | AMOUNT | NTILE
----------+---------+----------
RETAIL | 78.00 | 1
RETAIL | 234.00 | 1
RETAIL | 249.00 | 1
RETAIL | 278.00 | 2
RETAIL | 392.00 | 2
RETAIL | 498.00 | 2
RETAIL | 500.00 | 3
RETAIL | 738.00 | 3
RETAIL | 1250.00 | 3
RETAIL | 2029.00 | 4
RETAIL | 2393.00 | 4
RETAIL | 3933.00 | 4
Essentially, I am trying to take the average of every n terms (here, n=3):
CUSTTYPE | AMOUNT | NTILE
----------+---------+----------
RETAIL | 187.00 | 1
RETAIL | 389.33 | 2
RETAIL | 829.33 | 3
RETAIL | 2785.0 | 4
From the Pig reference here, it seems this could be achieved using Over() but I could not find an example of how this could be done. Thoughts?
You can rank every record of your data using RANK operator:
http://pig.apache.org/docs/r0.14.0/basic.html#rank
like this:
A = LOAD 'path' AS (schema);
B = RANK A;
and then divide each rank by 3:
C = FOREACH B generate ($0 + 1) / 3 as NTILE, CUSTTYPE, AMOUNT;

Magento Layered navigation filters for grouped products

In few words - problem is same as in this question Magento - Layered navigation, configurable products, multiple filters active issue
We have products (configutable / grouped / bundle), that have there linked simple products.
That linked products have own attributes, and configurable have its own.
Layered Navigation gets all availiable options for linked products and add them into parent product, so when we getting different combinations of filters, we can set options for non existing simple products
Example:
SKU | Type | Country | City | Linked Skus
--------------------------------------------------------
SP1 | Simple | USA | NY | -
SP2 | Simple | USA | LA | -
SP3 | Simple | Russia | Moscow | -
SP4 | Simple | Russia | St. Pitersburg | -
GP1 | Grouped | - | - | SP1, SP2
GP2 | Grouped | - | - | SP1, SP3, SP4
In that way we can check in filters Country = USA AND City = Moscow and magento will show us product GP2 as availiable for this combination of filters.
The reason of that is that in index table catalog_product_index_eav it would have something like:
SKU | Attribute | Value
--------------------------------
GP1 | Country | USA
GP1 | City | NY
GP1 | City | LA
GP2 | Country | USA
GP2 | Country | Russia
GP2 | City | NY
GP2 | City | Moscow
GP2 | City | St. Pitersburg
So for this selection USA + Moscow it would show result product GP2 because it have linked simples, that have values in attributes for USA and Moscow, but really not one simple have selected USA + Moscow at same time, so showing GP2 for such filters is mistake
Is there any extentions / ideas how to solve this?
Only one idea that comes to me is to add into catalog_product_index_eav additional column linked_id and for simples put into it zero value or simple entity_id value, but for grouped / configurable etc. generate index based for every linked simple + parent attribute values.
On this example it would look like:
SKU | Attribute | Linked Sku | Value
----------------------------------------
GP1 | Country | SP1 | USA
GP1 | Country | SP2 | USA
GP1 | City | SP1 | NY
GP1 | City | SP2 | LA
GP2 | Country | SP1 | USA
GP2 | Country | SP3 | Russia
GP2 | Country | SP4 | Russia
GP2 | City | SP1 | NY
GP2 | City | SP3 | Moscow
GP2 | City | SP4 | St. Pitersburg
So here we can add additional condition that all attributes in row must have same Linked Sku
May be someone knows ready solutions for this or have any additional ideas? Maybe wanna to discuss this?
Every ideas / solutions / opinions are welcome :)
Looks like it works in such way I discribed
Just developed extention that doing this.. Now we testing it, but we will test only on grouped products, because we not using other types. Really it looks like it must work not only with grouped...

Jasper report: two detail sections?

I've got a jasper report to do, with data like this:
Item | Quantity | Color
------+-----------+--------
A001 | 1 | Red
A001 | 1 | Green
B002 | 3 | Red
B002 | 3 | Purple
The report is grouped by Item/Quantity, e.g.
Item: A001, Qty: 1, Colors: Red,Green
Item: B002, Qty: 3, Colors: Red,Purple
Now I've got this Jasper report that already groups as such - i.e. shows a heading with the item and quantity, with a list of colors underneath.
The question now is, underneath this group I need to display a number of horizontal lines (for someone to write something in), equal to the qty of the item. e.g. underneath the A001 group I need to display one line, and under the B002 group I need to display three lines, like so:
Item A001, Qty 1, Colors Red, Green
_________________________
Item B002, Qty 3, Colors Red, Purple
_________________________
_________________________
_________________________
I've tried looking at jasper scripts, but it seems they can only manipulate report parameters/variables.
Does anyone have an idea of how I could do this?
Hmm, interesting.
Here is what you could do:
Using this source data (MySQL):
create table items (
item varchar(4),
quantity number,
color varchar(10),
);
(insert data...)
create table numbers (i integer)
(insert data 0, 1, 2 .... MySQL 5.1 has stored procedures that could do it, earlier versions would need an external script to populate it. Go from 0 to the largest quantity you'd have).
Then, the trick is to craft the right sort of query. I came up with this:
select i.*, n.i from
(
select concat(i.item, ' ', i.quantity) as grouping, i.item, i.quantity,group_concat(distinct color) as colors
from items i
GROUP BY item, quantity
) i
cross join numbers n
where quantity > n.i;
E.g. If I populate my numbers table, and the populate the items table with your example data, and then run the query I get:
+----------+------+----------+------------+------+
| grouping | item | quantity | colors | i |
+----------+------+----------+------------+------+
| A001 1 | A001 | 1 | Red,Greem | 0 |
| B002 3 | B002 | 3 | Red,Purple | 0 |
| A001 1 | A001 | 1 | Red,Greem | 1 |
| B002 3 | B002 | 3 | Red,Purple | 1 |
| A001 1 | A001 | 1 | Red,Greem | 2 |
| B002 3 | B002 | 3 | Red,Purple | 2 |
| A001 1 | A001 | 1 | Red,Greem | 3 |
| B002 3 | B002 | 3 | Red,Purple | 3 |
+----------+------+----------+------------+------+
Then in your Jasper Report, the trick is to create a group/band that works off the 'grouping' column, and put your heading in that:
Item A001, Qty 1, Colors Red, Green
And then, in the detail section just have a line as the only thing in the detail.
Doing this generates the report you want for me.
Note that the numbers table is a little silly, but is a standard data warehousing technique, though I suspect some database (e.g. Oracle) would have clever recursive procedures or other functions that would exclude the need for it.
OK, in the end, this was done using a subdataset and a crosstab in the detail footer section. Works nicely - thanks for everyone who contributed :)

Resources