Author Topic: One database 2 shops  (Read 174 times)

k2bmedia

  • Beginner
  • *
  • Posts: 5
One database 2 shops
« on: July 18, 2017, 16:09:09 pm »
Hello all,

I have a question.

I want to set up an 2nd virtuemart store with the same products like the first existing shop. I want to use CSVI to daily export the products and import it in the new shop (I think this is the most easy way).

But when a product is ordered on the 2nd shop, the stock must me adjusted to the first primary product database. I was thinking, I can also use CSVI to export the orders back to the first shop.

My questionl; Will the product stock value be updated when I export and import the orders back to the first shop?


I hope my question is clear to all, or maybe an complete other solution fits more my needs?


with kind regards
Dennis

K&K media production

  • VirtueMart Developer Team
  • Global Moderator
  • Full Member
  • *
  • Posts: 825
  • VirtueMart Version: VM3 on J3
Re: One database 2 shops
« Reply #1 on: July 18, 2017, 21:46:25 pm »
I've done a similar thing with mysql replication and a custom php cronjob.

Quote
Will the product stock value be updated when I export and import the orders back to the first shop?

No, the stock is stored inside product table

k2bmedia

  • Beginner
  • *
  • Posts: 5
Re: One database 2 shops
« Reply #2 on: July 19, 2017, 13:46:25 pm »
I've done a similar thing with mysql replication and a custom php cronjob.

Quote
Will the product stock value be updated when I export and import the orders back to the first shop?

No, the stock is stored inside product table

Thank you for your reply, so updating the stock info from the 2nd shop to the 1th shop is not possible?

How did you manage the mysql replication?

K&K media production

  • VirtueMart Developer Team
  • Global Moderator
  • Full Member
  • *
  • Posts: 825
  • VirtueMart Version: VM3 on J3
Re: One database 2 shops
« Reply #3 on: July 19, 2017, 14:23:20 pm »
Quote
Thank you for your reply, so updating the stock info from the 2nd shop to the 1th shop is not possible?

It is possible, but you need a custom script to merge the stock of both shops and write it back to both databases.

Quote
How did you manage the mysql replication?

https://dev.mysql.com/doc/refman/5.7/en/replication.html

I've a replication from the master server with shop 1 to the slave server with shop 2. On the slave server runs a custom script as cronjob which synchronised specific database tables.