Post by opencart-templates » Sat Dec 15, 2012 11:08 pm

Assuming you have created a new store and want to assign everything to your new store quickly run the following SQL queries via PHPMYADMIN.

WARNING backup your database before running this.

1. Update the "1" to match your new store ID.
2. Optional - update the "0" to match the store ID you are copying from.

Code: Select all

INSERT INTO category_to_store (category_id, store_id)
SELECT category_id, 1 FROM category_to_store WHERE store_id = 0;

INSERT INTO information_to_store (information_id, store_id)
SELECT information_id, 1 FROM information_to_store WHERE store_id = 0;

INSERT INTO layout_route (layout_id , store_id, route)
SELECT layout_id , 1, route FROM layout_route WHERE store_id = 0;

INSERT INTO manufacturer_to_store (manufacturer_id, store_id)
SELECT manufacturer_id, 1 FROM manufacturer_to_store WHERE store_id = 0;

INSERT INTO product_to_store (product_id, store_id)
SELECT product_id, 1 FROM product_to_store WHERE store_id = 0;

Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce


User avatar
Active Member

Posts

Joined
Mon May 16, 2011 7:24 pm
Location - UK

Post by Shopson.se » Fri May 24, 2013 11:20 pm

Thanks a lot!

Senaste butik på OpenCart: htm.se som bl.a säljer kvittorullar, kassarullar och cigarettändare


Active Member

Posts

Joined
Sun Apr 22, 2012 2:33 pm

Post by crispylettuce » Mon Sep 02, 2013 12:37 am

Thanks also for this. Saved me a lot of messing around and time! :)

Active Member

Posts

Joined
Fri Aug 03, 2012 8:54 pm

Post by jane.stix » Sat Jan 25, 2014 7:22 pm

There are SQL if you need to add recently added categories, products etc to ather store (please note that additional store id is not necessary 1 if you have more then one and create/remove then few times. You can found store_id in table store)
INSERT INTO category_to_store (category_id, store_id)
SELECT category_id, 1 FROM category_to_store S1 WHERE S1.store_id = 0 and
not exists(select * from category_to_store S2 where S2.category_id=S1.category_id and S2.store_id=1);

INSERT INTO information_to_store (information_id, store_id)
SELECT information_id, 1 FROM information_to_store S1 WHERE S1.store_id = 0 and
not exists(select * from information_to_store S2 where S2.information_id=S1.information_id and S2.store_id=1);

INSERT INTO layout_route (layout_id , store_id, route)
SELECT layout_id , 1, route FROM layout_route S1 WHERE S1.store_id = 0 and
not exists(select * from layout_route S2 where S2.layout_id=S1.layout_id and S2.route=S1.route and S2.store_id=1);

INSERT INTO manufacturer_to_store (manufacturer_id, store_id)
SELECT manufacturer_id,1 FROM manufacturer_to_store S1 WHERE S1.store_id = 0 and
not exists(select * from manufacturer_to_store S2 where S2.manufacturer_id=S1.manufacturer_id and S2.store_id=1);

INSERT INTO product_to_store (product_id, store_id)
SELECT product_id, 1 FROM product_to_store S1 WHERE S1.store_id = 0 and
not exists(select * from product_to_store S2 where S2.product_id=S1.product_id and S2.store_id=1);

Newbie

Posts

Joined
Sat Jan 25, 2014 7:20 pm

Post by tjsystems » Thu Jul 31, 2014 6:44 pm

Thanks saved me al lot of time.
Wish OpenCart would build-in something like this.

Live with 2.2.0.0 fully SSL.


Active Member

Posts

Joined
Sun Aug 26, 2012 5:39 pm
Location - NL, Amsterdam
Who is online

Users browsing this forum: No registered users and 16 guests