Chabreuil Antoine
diff --git a/Controller/GuaranteedOpinionConfigController.php b/Controller/GuaranteedOpinionConfigController.php
index d64f30a..6416770 100644
--- a/Controller/GuaranteedOpinionConfigController.php
+++ b/Controller/GuaranteedOpinionConfigController.php
@@ -27,7 +27,6 @@ public function saveConfiguration(ParserContext $parserContext) : RedirectRespon
GuaranteedOpinion::setConfigValue(GuaranteedOpinion::SHOW_RATING_URL_CONFIG_KEY, $data["show_rating_url"]);
GuaranteedOpinion::setConfigValue(GuaranteedOpinion::STATUS_TO_EXPORT_CONFIG_KEY, implode(',', $data["status_to_export"]));
- GuaranteedOpinion::setConfigValue(GuaranteedOpinion::EMAIL_DELAY_CONFIG_KEY, $data["email_delay"]);
GuaranteedOpinion::setConfigValue(GuaranteedOpinion::SITE_REVIEW_HOOK_DISPLAY_CONFIG_KEY, $data["site_review_hook_display"]);
GuaranteedOpinion::setConfigValue(GuaranteedOpinion::SITE_REVIEW_DISPLAY_CONFIG_KEY, (bool)$data["site_review_display"]);
diff --git a/Form/ConfigurationForm.php b/Form/ConfigurationForm.php
index d8418dd..de2ae2a 100644
--- a/Form/ConfigurationForm.php
+++ b/Form/ConfigurationForm.php
@@ -65,15 +65,6 @@ protected function buildForm(): void
),
"data" => GuaranteedOpinion::getConfigValue(GuaranteedOpinion::API_ORDER_CONFIG_KEY)
))
- ->add(
- 'email_delay',
- TextType::class,
- [
- "data" => GuaranteedOpinion::getConfigValue(GuaranteedOpinion::EMAIL_DELAY_CONFIG_KEY, 10),
- "label"=>$translator?->trans("Reviews email delay (in days):", array(), GuaranteedOpinion::DOMAIN_NAME),
- "required" => false
- ]
- )
->add(
'show_rating_url',
TextType::class,
diff --git a/GuaranteedOpinion.php b/GuaranteedOpinion.php
index fafbd00..e95088f 100644
--- a/GuaranteedOpinion.php
+++ b/GuaranteedOpinion.php
@@ -18,7 +18,6 @@ class GuaranteedOpinion extends BaseModule
public const API_ORDER_CONFIG_KEY = "guaranteedopinion.api.order";
public const STATUS_TO_EXPORT_CONFIG_KEY = "guaranteedopinion.status_to_export";
- public const EMAIL_DELAY_CONFIG_KEY = "guaranteedopinion.email_delay";
public const SHOW_RATING_URL_CONFIG_KEY = "guaranteedopinion.show_rating_url";
diff --git a/I18n/fr_FR.php b/I18n/fr_FR.php
index e60fc4f..a49ba98 100644
--- a/I18n/fr_FR.php
+++ b/I18n/fr_FR.php
@@ -5,7 +5,6 @@
'Api key review' => 'Clé API publique des avis',
'Order status to export' => 'Statut des commandes à envoyer',
'Product review hook display' => 'Lien du hook des avis des produits',
- 'Reviews email delay (in days):' => 'Delai de l\'envoi du mail (en jours)',
'Show all opinions url' => 'Url des avis vérifiés du sites',
'Show product review' => 'Montrer les avis des produits',
'Show product review tab' => 'Montrer le tableau des avis des produits',
diff --git a/Model/GuaranteedOpinionOrderQueueQuery.php b/Model/GuaranteedOpinionOrderQueueQuery.php
index 8858e57..7ae5500 100644
--- a/Model/GuaranteedOpinionOrderQueueQuery.php
+++ b/Model/GuaranteedOpinionOrderQueueQuery.php
@@ -30,11 +30,13 @@ public static function getCategoryByProductSaleElements(ProductSaleElements $pro
->findOne();
}
- public static function getProductUrl(int $id): RewritingUrl
+ public static function getProductUrl(int $id, string $locale = 'fr_FR'): RewritingUrl
{
return RewritingUrlQuery::create()
->filterByView('product')
->filterByViewId($id)
+ ->filterByViewLocale($locale)
+ ->filterByRedirected()
->findOne();
}
}
diff --git a/Service/OrderService.php b/Service/OrderService.php
index 7b1cefa..d0edafc 100644
--- a/Service/OrderService.php
+++ b/Service/OrderService.php
@@ -25,14 +25,14 @@ public function __construct(
/**
* @throws JsonException|RuntimeException|PropelException
*/
- public function prepareOrderRequest(): string
+ public function prepareOrderRequest(string $locale): string
{
$jsonOrder = [];
$guaranteedOpinionOrders = GuaranteedOpinionOrderQueueQuery::create()->filterByTreatedAt(null)->findByStatus(0);
foreach ($guaranteedOpinionOrders as $guaranteedOpinionOrder) {
- $jsonOrder[] = $this->orderToJsonObject($guaranteedOpinionOrder);
+ $jsonOrder[] = $this->orderToJsonObject($guaranteedOpinionOrder, $locale);
}
if (empty($jsonOrder)) {
@@ -45,14 +45,14 @@ public function prepareOrderRequest(): string
/**
* @throws PropelException
*/
- private function orderToJsonObject(GuaranteedOpinionOrderQueue $guaranteedOpinionOrder): array
+ private function orderToJsonObject(GuaranteedOpinionOrderQueue $guaranteedOpinionOrder, string $locale): array
{
$order = OrderQuery::create()->findOneById($guaranteedOpinionOrder->getOrderId());
$jsonProduct = [];
foreach ($order?->getOrderProducts() as $orderProduct) {
- $jsonProduct[] = $this->productToJsonObject($orderProduct);
+ $jsonProduct[] = $this->productToJsonObject($orderProduct, $locale);
}
return [
@@ -69,29 +69,29 @@ private function orderToJsonObject(GuaranteedOpinionOrderQueue $guaranteedOpinio
/**
* @throws PropelException
*/
- private function productToJsonObject(OrderProduct $orderProduct): array
+ private function productToJsonObject(OrderProduct $orderProduct, string $locale): array
{
if (null === $pse = ProductSaleElementsQuery::create()->findOneById($orderProduct->getProductSaleElementsId())) {
return [];
}
$category = GuaranteedOpinionOrderQueueQuery::getCategoryByProductSaleElements($pse);
- $productReviewEvent = new ProductReviewEvent($pse?->getProduct());
+ $productReviewEvent = new ProductReviewEvent($pse->getProduct());
$this->eventDispatcher->dispatch($productReviewEvent, GuaranteedOpinionEvents::SEND_ORDER_PRODUCT_EVENT);
return [
'id' => $productReviewEvent->getGuaranteedOpinionProductId(),
- 'name' => $pse?->getProduct()->getRef(),
+ 'name' => $pse->getProduct()->getRef(),
'category_id' => $category->getId(),
'category_name' => $category->getTitle(),
'qty' => $orderProduct->getQuantity(),
'unit_price' => $orderProduct->getPrice(),
'mpn' => null,
- 'ean13' => $pse?->getEanCode(),
+ 'ean13' => $pse->getEanCode(),
'sku' => null,
'upc' => null,
'url' => URL::getInstance()->absoluteUrl('') .
- GuaranteedOpinionOrderQueueQuery::getProductUrl($pse?->getProductId())->getUrl(),
+ GuaranteedOpinionOrderQueueQuery::getProductUrl($pse->getProductId(), $locale)->getUrl(),
];
}
diff --git a/templates/backOffice/default/module_configuration.html b/templates/backOffice/default/module_configuration.html
index 420151e..5a08b87 100644
--- a/templates/backOffice/default/module_configuration.html
+++ b/templates/backOffice/default/module_configuration.html
@@ -42,7 +42,6 @@ {intl l="Guaranteed Opinion Order access" d
- {render_form_field form=$form field="email_delay"}
{render_form_field form=$form field="status_to_export"}