public static function executeCronTask() { $ts_module = new TrustedShops(); $ts_common = new TSCommon(); $common_count = 0; if (is_array(TSCommon::$available_languages)) { $to_remove = array(); foreach (array_keys(TSCommon::$available_languages) as $iso) { $alerts_infos = RatingAlert::getAlertsInformations($iso); ///print_r($alerts_infos); if ($alerts_infos != false) { $common_count += count($alerts_infos); foreach ($alerts_infos as $infos) { $cert = Configuration::get(TSCommon::PREFIX_TABLE . 'CERTIFICATE_' . Tools::strtoupper($infos['iso'])); $certificate = (array) Tools::jsonDecode(Tools::htmlentitiesDecodeUTF8($cert)); $subject = $ts_module->l('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->l('title_part_2'); $template_vars = array('{ts_id}' => $certificate['tsID'], '{button_url}' => TSCommon::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/views/img', '{rating_url}' => $ts_common->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email'])); $result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], null, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, dirname(__FILE__) . '/../mails/'); if ($result) { $to_remove[] = (int) $infos['id_alert']; } } } } if (count($to_remove) > 0) { self::removeAlerts($to_remove); } } return count($to_remove) == $common_count; }