Example #1
0
 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;
 }
 public static function executeCronTask()
 {
     global $cookie;
     if (!Configuration::get('TS_SEND_SEPERATE_MAIL')) {
         return true;
     }
     $to_remove = array();
     $alerts_infos = RatingAlert::_getAlertsInformations((int) Configuration::get('TS_SEND_SEPERATE_MAIL_DELAY'));
     $ts_module = new TrustedShops();
     foreach ($alerts_infos as $infos) {
         $cookie->id_lang = $infos['id_lang'];
         $subject = $ts_module->getL('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->getL('title_part_2');
         $template_vars = array('{ts_id}' => Configuration::get('TS_ID_' . (int) $infos['id_lang']), '{button_url}' => TrustedShops::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/img', '{rating_url}' => $ts_module->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 (sizeof($to_remove) > 0) {
         self::removeAlerts($to_remove);
     }
     return sizeof($to_remove) == sizeof($alerts_infos);
 }
 public function hookNewOrder($params)
 {
     if (!Configuration::get('TS_TAB0_SEND_SEPERATE_MAIL') or !$this->_isTsIdActive((int) $params['order']->id_lang)) {
         return false;
     }
     RatingAlert::save((int) $params['order']->id);
 }
Example #4
0
<?php

/**
 * 2014 silbersaiten The module is based on the trustedshops module originally developed by PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to support@silbersaiten.de so we can send you a copy immediately.
 *
 * @author    silbersaiten www.silbersaiten.de <*****@*****.**>
 * @copyright 2014 silbersaiten
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 */
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/trustedshops.php';
if (Tools::getIsset('secure_key') && Configuration::get('TSSECURE_KEY') == Tools::getValue('secure_key')) {
    RatingAlert::executeCronTask();
}
Example #5
0
 public function hookActionOrderStatusPostUpdate($params)
 {
     //'newOrderStatus' => $new_os,'id_order' => (int)$order->id
     $order = new Order((int) $params['id_order']);
     $iso = Language::getIsoById((int) $order->id_lang);
     $iso_upper = Tools::strtoupper($iso);
     if (!isset(TSCommon::$certificates[$iso_upper]['send_separate_mail']) || TSCommon::$certificates[$iso_upper]['send_separate_mail'] != 1 || TSCommon::$certificates[$iso_upper]['send_seperate_mail_order_state'] != (int) $params['newOrderStatus']->id) {
         return false;
     }
     RatingAlert::save((int) $order->id, $iso_upper);
 }