EMDI can download orders, customers, items, update availability, etc. in multiple e-shops.
The process is:
- We install the corresponding bridges in each e-shop and check if everything is OK
- We define one of the e-shops as the main one and there we raise the bridge of multiple e-shops.
- We configure the bridge of multiple e-shops.
- We adjust the EMDI as we do with a normal bridge.
Pay attention to the following:
- The customer code must have a different prefix in each eshop
- If the items are the same among the eshops, their codes must be the same.
- The order number must have a different prefix in each e-shop.
In the bridge variables we want to differentiate, we define a variable that we will use for the prefix of the order number
1 2 |
$order_id_prefix='EM'; $orderid=str_ireplace($order_id_prefix,'', $orderid); |
and in action = orders in the echo that produces the order line, before $ id we add
1 |
echo $order_id_prefix.$id.';'... |
The bridge is available in open source:
https://github.com/sbzsystems/emdi_bridges/blob/gh-pages/emdi_multishop_bridge.php
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
<?php /*------------------------------------------------------------------------ # EMDI - multishop bridge by SBZ systems - Solon Zenetzis - version 1 # ------------------------------------------------------------------------ # author SBZ systems - Solon Zenetzis # copyright Copyright (C) 2020 sbzsystems.com. All Rights Reserved. # @license - https://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: https://www.sbzsystems.com # Technical Support: Forum - https://www.sbzsystems.com -------------------------------------------------------------------------*/ header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header('Content-Type: text/html; charset=UTF-8'); error_reporting(0); $productid=$_REQUEST['productid']; $productid=iconv("ISO-8859-7", "UTF-8", $productid); $stock=$_REQUEST['stock']; $action=$_REQUEST['action']; $orderid=$_REQUEST['orderid']; $key=$_REQUEST['key']; $shipcomp=$_REQUEST['shipcomp']; $voucherno=$_REQUEST['voucherno']; $docid=$_REQUEST['docid']; $randomvar='&rndval='.rand(10000000,90000000); //reduce cache issues $eshopurl_1='http://eshop1.gr/emdi_wp_woo_bridge.php?company=ike&key=12245325'.$randomvar; $eshopurl_2='https://eshop2.com/emdi_open2_bridge.php?key=235232354235'.$randomvar; $order_id_prefix_eshop2='EM'; if (!($key==$passkey)) { exit; } if ($action == 'deletetmp') { echo file_get_contents("$eshopurl_1&action=deletetmp"); echo file_get_contents("$eshopurl_2&action=deletetmp"); } if ($action == 'customersok') { echo file_get_contents("$eshopurl_1&action=customersok"); echo file_get_contents("$eshopurl_2&action=customersok"); } if ($action == 'productsok') { echo file_get_contents("$eshopurl_1&action=productsok"); echo file_get_contents("$eshopurl_2&action=productsok"); } if ($action == 'customers') { echo file_get_contents("$eshopurl_1&action=customers"); //Delete 1st row echo preg_replace('/^.+\n/', '', file_get_contents("$eshopurl_2&action=customers")); } if ($action == 'products') { echo file_get_contents("$eshopurl_1&action=products"); //Delete 1st row echo preg_replace('/^.+\n/', '', file_get_contents("$eshopurl_2&action=products")); } if ($action == 'orders') { echo file_get_contents("$eshopurl_1&action=orders"); //Delete 1st row echo preg_replace('/^.+\n/', '', file_get_contents("$eshopurl_2&action=orders")); } if ($action == 'order') { if (mb_stripos($orderid, $order_id_prefix_eshop2) !== false) { echo file_get_contents("$eshopurl_2&action=order&orderid=$orderid"); } else { echo file_get_contents("$eshopurl_1&action=order&orderid=$orderid"); } } if ($action == 'confirmorder') { if (mb_stripos($orderid, $order_id_prefix_eshop2) !== false) { echo file_get_contents("$eshopurl_2&action=confirmorder&docid=$docid&shipcomp=$shipcomp&voucherno=$voucherno&orderid=$orderid"); } else { echo file_get_contents("$eshopurl_1&action=confirmorder&docid=$docid&shipcomp=$shipcomp&voucherno=$voucherno&orderid=$orderid"); } } if ($action == 'updatestock') { echo file_get_contents("$eshopurl_1&action=updatestock&productid=$productid&stock=$stock"); echo file_get_contents("$eshopurl_2&action=updatestock&productid=$productid&stock=$stock"); } if ($action == 'cancelorder') { if (mb_stripos($orderid, $order_id_prefix_eshop2) !== false) { echo file_get_contents("$eshopurl_2&action=cancelorder&orderid=$orderid"); } else { echo file_get_contents("$eshopurl_1&action=cancelorder&orderid=$orderid"); } } ?> |