Insert DB rows to (almost SQL/CSV ) get PRODUCT CHILDS working (2.5+2.0.2)

Started by JaumeQuerS, March 16, 2012, 13:44:22 PM

Previous topic - Next topic


I know that there are other posts related with that issue. But I think we should sepparate discussions, working threads, solutions, etc... If someone consider this should goes into another thread, could delete it or move it.

After many battles (obviously our fault) we found the way (step by step) to get Stockable Products to work. Sometimes didn't worked as we expect and sometimes directly doesn't work. Next question (step) was the need to understant how this is stored to get complete knowlegde and control of that. The last stage (well... never is the last) has been "how can we inject rows into DB to link Bussiness's ERP with VM2.0.2".

BEWARE: if you're not Accostumed to SQL sentences/CSV imports to MySQL maybe this article is not for you.

So we get a list of "things" you'll have to attend to import products with CHILDS":

I recommend this first steps to be done through administrator (not DB), it's easiest:

  • First at all we need to create the PARENT custom field (nothing special to know)
  • Then you have to create a Generic Child custom field (see attached file).
(from virtuemart_customs table, write down the id's assigned for the both custom fields. You'll needed in *NOW*... for example 8 and 6)

NOW Refering to PRODUCT'S table (DB!!):

  • In the childs, put in virtuemart_product_parent_id  the product_id of the parent
For example, if you have inserted product LADDER which has product_id 10 his childs : WOOD LADDER, METAL LADDER, etc... must have product_parent_id = 10

For each PARENT's product_id of a product of virtuemart_products:

  • In virtuemart_product_customfields table you'll have to insert 2 rows to link that product_id (remember PARENT only) with to the id's *NOW* of the product_custom_id
For example, if you have inserted product LADDER which has product_id 10, so you'll have to insert a row with 10 and 6 and another row with 10 and 8.

IMPORTANT: Things that made that all things will not work

Even if you follow this confusing guide and in administrator perfectly see all the childs and parents linked ... perhaps in frontend you can't see the INPUT SELECT to choose a Child. This could happen because:

  • You're not using >=VM2.0.2 version.
  • Parent should be associated almost to ONE category.
  • Childs MUST NOT be associated to ANY category.
  • ...
  • review all... it must be exactly as I explained. If you misses some step it will not work

Our objectives are accomplished so we can't investigate more on this procedure (or in other similars)... I'm sorry we can't help anymore on that at the moment.

Thanks to my colleague David Luna who has made almost all the job

[attachment cleanup by admin]


Thank you for the post! I have yet to find another solution for getting Stockable Products to work and these instructions seem too difficult for my understanding. Step by step instructions would be greatly appreciated!