⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Table Relation



hkgeeks
  • profile picture
  • Member

Posted 27 August 2013 - 09:19 AM

Hi there,

 

I got a problem using grocerycrud, the saturation as below:

 

Tables:

product (p_id, p_name, p_desc)

color   (c_id, c_name)

size    (s_id, s_name)

product_color  (pc_id, product_id, color_id)

product_size   (ps_id, product_id, size_id)

stock          (stock_id, pc_id, ps_id, in_stock)

 

Rule:

- A product can multi-color (relate product_color to store p_id and c_id)

- A product can multi-size  (relate product_size to store p_id and s_id)

- "Stock" table store a particular "size" and "color" in a product inventory

 

Master List

the function of add/update/delete on "product","color","size" is work perfectly.

the set_relation_n_n for "product_color" and "product_size" is work perfect too.

 

Example:

Product "PoloTee001" have two size, "M" and "L", also, the yellow color of "M" size "PoloTee001" inventory had 5 pcs and the yellow color of "L" size "PoloTee001" inventory had 8 pcs

 

The Ideal Result:

Table "Stock" 

stock_id, pc_id, ps_id, in_stock

  5,             2   ,   1     ,  5

  5,             2   ,   2     ,  8

 

assumption:

stock_id 5 is "PoloTee001" ID

pc_id     2 is "Yellow" color in product "PoloTee001"

ps_id     1 is "M" size and 2 is "L" size in  product "PoloTee001"

 

Problem!!!

how can i set the stock table for user to input the product inventory?

 

Thanks.


davidoster
  • profile picture
  • Member

Posted 27 August 2013 - 12:24 PM

Hello and welcome to the forums [member=hkgeeks].

For this layout you need to use of the two dependent dropdown libraries.

Check here and here.


hkgeeks
  • profile picture
  • Member

Posted 28 August 2013 - 18:19 PM

Hi David,

 

thanks you for your reply, I had tried the solutions, it can help me to fix master and detail relation problem, it remain one problem, the dependent select can't change to input type="text" for the inventory quantity input... I don't know how to fix. 


davidoster
  • profile picture
  • Member

Posted 28 August 2013 - 23:09 PM

Hi David,

 

thanks you for your reply, I had tried the solutions, it can help me to fix master and detail relation problem, it remain one problem, the dependent select can't change to input type="text" for the inventory quantity input... I don't know how to fix. 

 

You shouldn't apply dependent dropdown to the quantity input. Just leave it as text without mapping it via the library (or extension - whatever you use). There is no need for this!


hkgeeks
  • profile picture
  • Member

Posted 04 September 2013 - 04:46 AM

The problem was fixed, Thank you for the help.  :D