First of all we install the 2 php files in the main folder of eshop.Skroutz
https://github.com/sbzsystems/emdi-eshop-bridges-connectors/blob/gh-pages/emdi_skroutz_webhook.php
https://github.com/sbzsystems/emdi-eshop-bridges-connectors/blob/gh-pages/emdi_skroutz_bridge.php
Copy the apikey to configure the above scripts from the skroutz control panel. We also specify the script address in skroutz in the Webhook URL field.
For example:
https://www.mysite.com/emdi_skroutz_webhook.php
information: https://merchants.skroutz.gr/merchants/support/guidelines/skroutz_cart_integration
We create 2 tables in the database:
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 |
CREATE TABLE `sbz_skroutz_docs` ( `code` VARCHAR(20) NOT NULL , `event_type` VARCHAR(20) NOT NULL , `state` VARCHAR(20) NOT NULL , `customer_id` VARCHAR(20) NOT NULL , `customer_first_name` VARCHAR(50) NOT NULL , `customer_last_name` VARCHAR(50) NOT NULL , `customer_address_street_name` VARCHAR(50) NOT NULL , `customer_address_street_number` VARCHAR(20) NOT NULL , `customer_address_street_zip` VARCHAR(20) NOT NULL , `customer_address_street_city` VARCHAR(50) NOT NULL , `customer_address_street_region` VARCHAR(50) NOT NULL , `customer_address_street_pickup_from_collection_point` VARCHAR(200) NOT NULL , `invoice` VARCHAR(50) NOT NULL , `comments` VARCHAR(500) NOT NULL , `courier` VARCHAR(50) NOT NULL , `courier_voucher` VARCHAR(500) NOT NULL , `courier_tracking_codes` VARCHAR(50) NOT NULL , `created_at` TIMESTAMP NOT NULL , `expires_at` TIMESTAMP NOT NULL , `dispatch_until` TIMESTAMP NOT NULL , `invoice_company` VARCHAR(100) NOT NULL , `invoice_profession` VARCHAR(100) NOT NULL , `invoice_vat_number` VARCHAR(20) NOT NULL , `invoice_doy` VARCHAR(50) NOT NULL , `invoice_street_name` VARCHAR(50) NOT NULL , `invoice_street_number` VARCHAR(20) NOT NULL , `invoice_zip` VARCHAR(20) NOT NULL , `invoice_city` VARCHAR(50) NOT NULL , `invoice_region` VARCHAR(50) NOT NULL , `invoice_vat_exclusion` VARCHAR(10) NOT NULL , PRIMARY KEY (`code`) ) ENGINE = MyISAM CHARSET=utf8 COLLATE utf8_unicode_ci; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
CREATE TABLE `sbz_skroutz_lines` ( `code` VARCHAR(20) NOT NULL , `id` VARCHAR(20) NOT NULL , `shop_uid` VARCHAR(20) NOT NULL , `product_name` VARCHAR(200) NOT NULL , `quantity` FLOAT NOT NULL , `size_label` VARCHAR(50) NOT NULL , `size_value` VARCHAR(50) NOT NULL , `shop_value` VARCHAR(50) NOT NULL , `unit_price` FLOAT NOT NULL , `total_price` FLOAT NOT NULL , `price_includes_vat` FLOAT NOT NULL , PRIMARY KEY (`id`), INDEX `shop_uid` (`shop_uid`), INDEX `code` (`code`) ) ENGINE = MyISAM CHARSET=utf8 COLLATE utf8_unicode_ci; |
After we create the database and check that the bridge works, we have to create in the hosting control panel, a cron that runs every hour and calls the script:
1 |
0 * * * * wget -qO /dev/null https://www.mysite.com/emdi_skroutz_webhook.php?orderid=recheck_pending |
We do this to keep orders over 24 hours updated for any cancellations and changes that skroutz may not send via webhook.
Finally we set in the EMDI settings, eshop connection with the corresponding urls, as we do with all bridges.