* @copyright 2020 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ require_once(dirname(__FILE__) . '/../RetailcrmPrestashopLoader.php'); class RetailcrmSyncEvent implements RetailcrmEventInterface { /** * @inheritDoc */ public function execute() { $apiUrl = Configuration::get(RetailCRM::API_URL); $apiKey = Configuration::get(RetailCRM::API_KEY); RetailcrmHistory::$default_lang = (int) Configuration::get('PS_LANG_DEFAULT'); if (!empty($apiUrl) && !empty($apiKey)) { RetailcrmHistory::$api = new RetailcrmProxy($apiUrl, $apiKey, _PS_ROOT_DIR_ . '/retailcrm.log'); } else { RetailcrmLogger::writeCaller('orderHistory', 'set api key & url first'); exit(); } RetailcrmHistory::customersHistory(); RetailcrmHistory::ordersHistory(); } } if (Configuration::get(RetailCRM::ENABLE_HISTORY_UPLOADS)) { $event = new RetailcrmSyncEvent(); $event->execute(); } else { RetailcrmLogger::writeDebug( 'RetailcrmSyncEvent', 'History uploads is not enabled, skipping...' ); }