News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Migrate from 1.1.9 to 2.0.10, product_id changed

Started by Thong Tran, September 09, 2012, 14:07:25 PM

Previous topic - Next topic

Thong Tran

Hi guys,

I've migrated from VM 1.1.9 to 2.0.10, everything went fine. But I got married with a problem with product_id.
The "virtuemart_product_id" in "virtuemart_products" table changed, it is different with the old product_id from "vm_product". I don't know if anyone got the same issue with that, and how to fix it?
I've tried some search on the forum but can't find the answer.

Please advise if I didn't something wrong or it is an unknown issue.

Best Regards,
Thong Tran
http://foobla.com/joomla/obsocialsubmit - auto publishing VirtueMart products to Twitter, Facebook, LinkedIn, ...
http://foobla.com/joomla/obrss - create ultimate RSS Feed for VirtueMart
http://foob.la/vmskrill - Skrill payment option for VirtueMart

Thong Tran

I see Milbo is fixing it on SVN. Is that right, Milbo?

Just want to know if I'm not alone with that issue.
http://foobla.com/joomla/obsocialsubmit - auto publishing VirtueMart products to Twitter, Facebook, LinkedIn, ...
http://foobla.com/joomla/obrss - create ultimate RSS Feed for VirtueMart
http://foob.la/vmskrill - Skrill payment option for VirtueMart

Milbo

You can use in the new version a variable, which you must set in the configuration.ini and then you use in the tools the config restore thing. Then you should have that in the config and the migrator should use old ids, but I recommend new ids, hmm I should add the option
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Thong Tran

Quote from: Milbo on September 12, 2012, 00:39:33 AM
You can use in the new version a variable, which you must set in the configuration.ini and then you use in the tools the config restore thing. Then you should have that in the config and the migrator should use old ids, but I recommend new ids, hmm I should add the option

Thanks for your reply, Milbo. I can't find anywhere the file configuration.ini, can you please provide more details instruction?
http://foobla.com/joomla/obsocialsubmit - auto publishing VirtueMart products to Twitter, Facebook, LinkedIn, ...
http://foobla.com/joomla/obrss - create ultimate RSS Feed for VirtueMart
http://foob.la/vmskrill - Skrill payment option for VirtueMart

manburg6

Any news about this info???

I need to mantain old product_id for seo purpose.

Thanks,
M.

manburg6

Hello,

this is my script to change, after migration, product_id.
I have both tables (old 1.1.9 and new 2.0.20) in same db with diferent prefix: jos and j25.


UPDATE j25_virtuemart_order_items SET j25_virtuemart_order_items.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = (SELECT product_sku FROM j25_virtuemart_products Where j25_virtuemart_products.virtuemart_product_id = j25_virtuemart_order_items.virtuemart_product_id));

UPDATE j25_virtuemart_product_medias SET
j25_virtuemart_product_medias.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = (SELECT product_sku FROM j25_virtuemart_products Where j25_virtuemart_products.virtuemart_product_id =
j25_virtuemart_product_medias.virtuemart_product_id));

UPDATE j25_virtuemart_product_prices SET
j25_virtuemart_product_prices.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = (SELECT product_sku FROM j25_virtuemart_products Where j25_virtuemart_products.virtuemart_product_id =
j25_virtuemart_product_prices.virtuemart_product_id));


CREATE TABLE j25_virtuemart_product_categories_new AS
SELECT * FROM j25_virtuemart_product_categories;

UPDATE j25_virtuemart_product_categories_new SET j25_virtuemart_product_categories_new.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = (SELECT product_sku FROM j25_virtuemart_products Where j25_virtuemart_products.virtuemart_product_id = j25_virtuemart_product_categories_new.virtuemart_product_id));

Delete from j25_virtuemart_product_categories;

Insert into j25_virtuemart_product_categories select * from j25_virtuemart_product_categories_new;

DROP TABLE j25_virtuemart_product_categories_new;


CREATE TABLE j25_virtuemart_product_manufacturers_new AS
SELECT * FROM j25_virtuemart_product_manufacturers;

UPDATE j25_virtuemart_product_manufacturers_new SET j25_virtuemart_product_manufacturers_new.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = (SELECT product_sku FROM j25_virtuemart_products Where j25_virtuemart_products.virtuemart_product_id = j25_virtuemart_product_manufacturers_new.virtuemart_product_id));

Delete from j25_virtuemart_product_manufacturers;

Insert into j25_virtuemart_product_manufacturers select * from j25_virtuemart_product_manufacturers_new;

DROP TABLE j25_virtuemart_product_manufacturers_new;


CREATE TABLE j25_virtuemart_products_it_it_new AS
SELECT * FROM j25_virtuemart_products_it_it;

UPDATE j25_virtuemart_products_it_it_new SET j25_virtuemart_products_it_it_new.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = (SELECT product_sku FROM j25_virtuemart_products Where j25_virtuemart_products.virtuemart_product_id = j25_virtuemart_products_it_it_new.virtuemart_product_id));

Delete from j25_virtuemart_products_it_it;

Insert into j25_virtuemart_products_it_it select * from j25_virtuemart_products_it_it_new;

DROP TABLE j25_virtuemart_products_it_it_new;



CREATE TABLE j25_virtuemart_products_new AS
SELECT * FROM j25_virtuemart_products;

UPDATE j25_virtuemart_products_new SET j25_virtuemart_products_new.virtuemart_product_id = (
SELECT jos_vm_product.product_id FROM jos_vm_product WHERE jos_vm_product.product_sku = j25_virtuemart_products_new.product_sku);

Delete from j25_virtuemart_products;

Insert into j25_virtuemart_products select * from j25_virtuemart_products_new;

DROP TABLE j25_virtuemart_products_new;



I've tested it and weems to works.

I'm working on conversion script for product relations and reviews...

Bye,
M.

AH

#6
Nice post, thanks for taking the time to let others know!

I would use TRUNCATE to remove all entries as this resets the AUTO_increment values

rather than DELETE FROM #_table_name


However the migrator.php should allow this - why was it necessary to "force" the id change?

Some shops will utilise this id for internal purposes
Regards
A

Joomla 4.4.5
php 8.1

Kintaro Oe

#7
same problem here

I'm testing the migration from 1.1.9 to 2.6 but product_ids change, I need that remain the same.

I'm going to try manburg6's way... I have to change it for VirtueMart 2.6?

Regards


p.s. in the meantime i SOLVED with this: http://forum.virtuemart.net/index.php?topic=121624.msg415847#msg415847