VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: AH on January 27, 2014, 15:49:20 PM

Title: Migration - Keep old category_id's ??
Post by: AH on January 27, 2014, 15:49:20 PM
Does anyone have a solution to prevent the migration "tool" changing the category ids?


migrator.php

//$category['virtuemart_category_id'] = $oldcategory['category_id'];

Removing this comment allows the creation of:-

virtuemart_categories_en_gb
virtuemart_category_categories
virtuemart_category_medias


But the

virtuemart_categories


Is empty - confused, I am
Title: Re: Migration - Keep old category_id's ??
Post by: AH on January 28, 2014, 17:15:18 PM
Clearly something in the way the store product model is working

So I created an SQL update to create the missing entries in the virtuemart_category table, you have to run the product conversion separately or it will fail because these entries have not been created.


truncate yourtable_virtuemart_categories;
INSERT INTO yourtable_virtuemart_categories (virtuemart_category_id,virtuemart_vendor_id,ordering,published)
SELECT c.category_id AS virtuemart_category_id, c.vendor_id AS virtuemart_vendor_id, c.list_order AS ordering,
CASE c.category_publish  WHEN 'Y' then 1 ELSE 0
END AS publish

FROM yourtable_vm_category c


I might complete the other fields, but you get the idea!

DONT try and migrate products before you have fixed the missing category entries!!!
You have to run the product migration separately AFTER you have "fixed" the category table using the above SQL
Title: Re: Migration - Keep old category_id's ??
Post by: mbarry on January 31, 2014, 14:39:09 PM
See my post to http://forum.virtuemart.net/index.php?topic=121624.0 on why this occurring and my solution to problem.

Hope this helps.