From 7ef48d625690aab63f8dbc921c43e68646e00daa Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Fri, 17 Feb 2017 10:23:07 +0100 Subject: [PATCH] implementation of trsutedshop ES --- .../trustedshopsbbb/lib/ReviewCollectorReview.php | 4 +++- .../trustedshopsbbb/scripts/trustedshopscron.php | 5 ++--- modules/trustedshopsbbb/trustedshopsbbb.php | 15 ++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/trustedshopsbbb/lib/ReviewCollectorReview.php b/modules/trustedshopsbbb/lib/ReviewCollectorReview.php index af88a4c4..7e4094cb 100755 --- a/modules/trustedshopsbbb/lib/ReviewCollectorReview.php +++ b/modules/trustedshopsbbb/lib/ReviewCollectorReview.php @@ -93,12 +93,14 @@ class ReviewCollectorReviewOrder public function __construct(Order $order, $id_lang) { + $days = Configuration::get('TRUSTED_SHOP_DAYS'); + $order_date = new DateTime($order->date_add); $this->orderDate = $order_date->format('Y-m-d');; $this->orderReference = "".$order->id; $this->currency = self::CURRENCY_NAME; $estimated_delivery_date = new DateTime(); - $estimated_delivery_date->add(new DateInterval('P8D')); //we add 8 days + $estimated_delivery_date->add(new DateInterval('P'.$days.'D')); //we add 5 days $this->estimatedDeliveryDate = $estimated_delivery_date->format('Y-m-d'); $this->products = array(); foreach ($order->getProducts() as $row) { diff --git a/modules/trustedshopsbbb/scripts/trustedshopscron.php b/modules/trustedshopsbbb/scripts/trustedshopscron.php index 3086e840..09f9058e 100755 --- a/modules/trustedshopsbbb/scripts/trustedshopscron.php +++ b/modules/trustedshopsbbb/scripts/trustedshopscron.php @@ -20,11 +20,10 @@ if ($module_instance->active) { $orders = array(); //We create 2 arrays containing the orders id related to each language $orders["fr"] = array(); - //$orders["es"] = array(); + $orders["es"] = array(); foreach (TrustedShopBbbAsync::getOrderToProcess() as $orderToProcess){ - /* @Todo add ES when api key for ES */ - if ($orderToProcess['id_order'] != 0 && in_array($orderToProcess['iso_code'], array('fr'), TRUE)) { + if ($orderToProcess['id_order'] != 0 && in_array($orderToProcess['iso_code'], array('fr','es'), TRUE)) { $orders[$orderToProcess['iso_code']][] = (int)$orderToProcess['id_order']; } } diff --git a/modules/trustedshopsbbb/trustedshopsbbb.php b/modules/trustedshopsbbb/trustedshopsbbb.php index 2ae7b29c..389d39ac 100644 --- a/modules/trustedshopsbbb/trustedshopsbbb.php +++ b/modules/trustedshopsbbb/trustedshopsbbb.php @@ -85,7 +85,7 @@ class TrustedShopsBbb extends Module $output = '

Trusted Shop Configuration

'; if (Tools::isSubmit('submitTrustedShop') AND ($tsfrid = Tools::getValue('trusted_shop_fr_id')) AND ($tsdays = Tools::getValue('trusted_shop_days')) AND ($tssw = Tools::getValue('status_watched_id')) AND ($tspassword = Tools::getValue('trusted_shop_password')) AND ($tsuser = Tools::getValue('trusted_shop_user'))) { Configuration::updateValue('TRUSTED_SHOP_FR_ID', trim($tsfrid)); - //Configuration::updateValue('TRUSTED_SHOP_ES_ID', trim($tsesid)); + Configuration::updateValue('TRUSTED_SHOP_ES_ID', trim($tsesid)); Configuration::updateValue('TRUSTED_SHOP_STATUS_WATCHED', $tssw); Configuration::updateValue('TRUSTED_SHOP_PASSWORD', trim($tspassword)); Configuration::updateValue('TRUSTED_SHOP_USER', trim($tsuser)); @@ -109,10 +109,10 @@ class TrustedShopsBbb extends Module
- +
@@ -146,8 +146,7 @@ class TrustedShopsBbb extends Module && (int)Configuration::get('TRUSTED_SHOP_STATUS_WATCHED') == (int)$params['newOrderStatus']->id ){ $order = new Order((int)$params['id_order']); - /* @Todo add ES when api key for ES */ - if (in_array(strtoupper(Language::getIsoById($order->id_lang)), array("FR"), true)) { + if (in_array(strtoupper(Language::getIsoById($order->id_lang)), array("FR","ES"), true)) { TrustedShopBbbAsync::saveOrUpdate((int)$order->id); } } @@ -155,8 +154,7 @@ class TrustedShopsBbb extends Module public function hookFooter($params){ global $smarty, $cookie; $resultArray = array(); - /* @Todo add ES when api key for ES */ - if (in_array(strtoupper(Language::getIsoById($cookie->id_lang)), array("FR"), true)) { + if (in_array(strtoupper(Language::getIsoById($cookie->id_lang)), array("FR","ES"), true)) { $reviewIndicatorCollector = new ReviewIndicatorCollector((int)($cookie->id_lang)); $resultArray = $reviewIndicatorCollector->getResults(); } @@ -175,8 +173,7 @@ class TrustedShopsBbb extends Module public function hookOrderConfirmation($params) { global $smarty, $cookie; - /* @Todo add ES when api key for ES */ - if (false && in_array(strtoupper(Language::getIsoById($cookie->id_lang)), array("FR"), true)) { + if (false && in_array(strtoupper(Language::getIsoById($cookie->id_lang)), array("FR","ES"), true)) { $tsId = Configuration::get('TRUSTED_SHOP_' . strtoupper(Language::getIsoById((int)$cookie->id_lang)) . '_ID'); $smarty->assign(array('tsId' => $tsId,)); return $this->display(__FILE__, 'views/trust_badge_order_confirmation.tpl');