1. keep
  2. RO CSVI
  3. Wednesday, 05 October 2016
  4.  Subscribe via email
Hi,
My goal is to send a product from a webshop to another which has less products but keep the virtuemart_product_id the same.
On the target site I created a CSVI template which loads a remote XML and inserts the product to the local webshop, downloads the images, etc.
On the source site I create the XML data of the selected product, put it to a specific location and call the import url of the target site, which loads this xml.
It works very well if the value of "Import based on" field is product_sku. But in this case the virtuemart_product_id on the target site will be an autoincremented value. And for some reasons I want to keep the same ids.
For example my ids on the soruce site are 1,2,3,4,5,6,7 and on the target site are 1,2
If I send the id=6 product based on sku, the id on the target site will be 3
I tried to change the value of "Import based on" field to virtuemart_product_id and according the log file it doesn't insert to the #__virtuemart_products table but tries to udpate the record which doesn't exists.
I miss a log entry like [DEBUG] Insert the dummy entry for the product
I attached the log file (removed sensitive data)
Could you help me to solve this topic?
Thanks
Accepted Answer Pending Moderation
Hello,
It works very well if the value of "Import based on" field is product_sku. But in this case the virtuemart_product_id on the target site will be an autoincremented value. And for some reasons I want to keep the same ids.
For example my ids on the soruce site are 1,2,3,4,5,6,7 and on the target site are 1,2

First thing i would like to say is virtuemart_product_id is a primary key field of the table and we have no control over this field. This is reason why CSVI uses product_sku field as reference for importing products.

I tried to change the value of "Import based on" field to virtuemart_product_id and according the log file it doesn't insert to the #__virtuemart_products table but tries to udpate the record which doesn't exists.

That is correct, if you are importing virtuemart_product_id, it means that the record already exist and it has to be updated and that is logic of being having a primary key field in tables.

I attached the log file (removed sensitive data)

Your log file is missing but still i dont think we need it as we know that virtuemart_product_id will only update the records.

Could you help me to solve this topic?

The only way i could think of is keeping both tables synchronized with order of product imported. This way the auto increment id is same whenever you do a import on both sites.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hi,
Thanks but it isn't an option with this situation.
But I added an extra part to my code. Just after exporting the XML and right before calling the CSVI import url I process the xml and insert a dummy row to #__virtuemart_products table so CSVI is able to update this dummy row.
Thanks for the information
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello,
But I added an extra part to my code. Just after exporting the XML and right before calling the CSVI import url I process the xml and insert a dummy row to #__virtuemart_products table so CSVI is able to update this dummy row.

are you saying you are inserting these dummy rows and creating new rows and so virtuemart_product_id are same in both tables by the time import is started?
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
exactly
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Ok, Good thinking. Any how there is no direct way to handle virtuemart_product_id other than doing some tricks like these.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 5
Accepted Answer Pending Moderation
One downside: You have to enable product override which is dangerous in my case. But I can handle it somehow.
  1. more than a month ago
  2. RO CSVI
  3. # 6
Accepted Answer Pending Moderation
Thank you for posting your solution :)
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 7
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!