Save the following script in a file on main OpenCart directory and call it. Set the variable $store_id with your preferred store.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header('Content-Type: text/html; charset=UTF-8'); require 'config.php'; $store_id= 0; $host = DB_HOSTNAME; $user = DB_USERNAME; $password = DB_PASSWORD; $db = DB_DATABASE; $dbprefix = DB_PREFIX; $link=mysql_connect("$host", $user, $password) or die(mysql_error()); mysql_select_db("$db") or die(mysql_error()); mysql_set_charset('utf8',$link); $data = mysql_query("SELECT * FROM ".$dbprefix."product") or die(mysql_error()); while($alldata = mysql_fetch_array( $data )) { $data2 = mysql_query("INSERT INTO ".$dbprefix."product_to_store (product_id,store_id ) VALUES (".$alldata['product_id'].",".$store_id.") ON DUPLICATE KEY UPDATE product_id=LAST_INSERT_ID(product_id), store_id=".$store_id."; ") or die(mysql_error()); echo $alldata['product_id']."<br>\n"; } echo "ok"; ?> |