From 9e79444cbe609114c7f2bac8beaeef3381c1bcae Mon Sep 17 00:00:00 2001 From: Marco Boatti Date: Sun, 5 Sep 2021 15:44:05 +0200 Subject: [PATCH 1/3] Fix Culture Code - Reviews are now requested in the correct store view language --- Observer/InterceptOrder.php | 32 ++++++++++++++++---------------- composer.json | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Observer/InterceptOrder.php b/Observer/InterceptOrder.php index 25071ba..cf378bc 100644 --- a/Observer/InterceptOrder.php +++ b/Observer/InterceptOrder.php @@ -52,12 +52,12 @@ class InterceptOrder implements ObserverInterface /** * @var \Magento\Framework\ObjectManagerInterface - */ + */ protected $_objectManager; /** * @var \Magento\Framework\App\State - */ + */ protected $_state; /** @@ -67,7 +67,7 @@ class InterceptOrder implements ObserverInterface /** - * @var + * @var */ protected $_orderInterface; @@ -86,7 +86,7 @@ public function __construct( State $state, OrderInterface $orderInterface, FeedatyHelper $feedatyHelper - ) + ) { $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; @@ -105,7 +105,7 @@ public function __construct( * @param $observer */ public function execute( \Magento\Framework\Event\Observer $observer ) { - + $increment_id = $observer->getEvent()->getOrder()->getIncrementId(); try { @@ -116,9 +116,11 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { $store = $store_id == null ? $this->_storeManager->getStore() : $this->_storeManager->getStore($store_id); - + $culture_code = $store->getConfig('general/locale/code'); + + $orderopt = $store->getConfig('feedaty_global/feedaty_sendorder/sendorder'); if( $order !== null && $order->getStatus() == $orderopt ) { @@ -138,9 +140,9 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { if($fdDebugEnabled != 0) { $message = "MerchantCode: ".$merchant." MerchantSecret: ".$secret. "OrderID: " . $order_id; - + $this->_feedatyHelper->feedatyDebug( - $message, + $message, "FEEDATY OBSERVER DATA" ); @@ -148,7 +150,7 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { foreach ( ($order->getAllStatusHistory() ) as $orderComment ) { - if ( $orderComment->getStatus() === $orderopt ) + if ( $orderComment->getStatus() === $orderopt ) $verify++; @@ -183,7 +185,7 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { $tmp['URL'] = $orderProduct->getUrlModel()->getUrl($orderProduct); //$tmp['EAN'] = $item->getCustomAttribute('ean'); - + //get the image url if ( $orderProduct->getImage() != "no_selection" ) { @@ -225,7 +227,7 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { $tmp['URL'] = $parentProduct->getUrlModel()->getUrl($parentProduct); //$tmp['EAN'] = $childProduct->getCustomAttribute('ean'); - + //get the image url if ($childProduct->getImage() != "no_selection") { @@ -246,7 +248,7 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { $this->_feedatyHelper->feedatyDebug( - json_encode($tmp), + json_encode($tmp), "FEEDATY configurable Product: " ); @@ -261,13 +263,11 @@ public function execute( \Magento\Framework\Event\Observer $observer ) { $culture = $cultures[0]; - if( $culture != 'it' || $culture != 'en'|| $culture != 'es'|| $culture != 'fr'|| $culture != 'de' ) { - + $allowedLanguages = array("it", "en", "es", "fr","de"); + if (!in_array($culture, $allowedLanguages)) { $culture = 'en'; - } - $mageMetadata = $this->_objectManager->get('Magento\Framework\App\ProductMetadataInterface'); // Formatting the array to be sent diff --git a/composer.json b/composer.json index b2d95cb..9feb6ea 100755 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "AFL-3.0" ], - "version": "2.6.6-stable", + "version": "2.6.7-stable", "type": "magento2-module", From 3ba85a93627116d07d11bfa84be9f530f67ea9ac Mon Sep 17 00:00:00 2001 From: Marco Boatti Date: Mon, 20 Sep 2021 12:28:56 +0200 Subject: [PATCH 2/3] Fix Snippets Review Count --- view/frontend/templates/product-snippet.phtml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/view/frontend/templates/product-snippet.phtml b/view/frontend/templates/product-snippet.phtml index 196f766..3feb9ef 100644 --- a/view/frontend/templates/product-snippet.phtml +++ b/view/frontend/templates/product-snippet.phtml @@ -136,17 +136,13 @@ if ($product !== null) { /** * Rating Value */ - $ratingValue = $toview['data_review']['AvgRating']; + $ratingValue = $toview['data_review']['Product']['AvgRating']; - /** - * Product rating - */ - $avgProductsRating = $toview['data_review']['AvgProductsRating']; /** * Total product feedback */ - $ratingsCount = $toview['data_review']['TotalFeedbacks']; + $ratingsCount = $toview['data_review']['Product']['RatingsCount']; /** * Get Aggregate Rating and Product info @@ -170,6 +166,7 @@ if ($product !== null) { "ratingValue" => $ratingValue, "ratingCount" => $ratingsCount ], + "reviewCount" => $toview['data_review']['TotalFeedbacks'], "review" => $reviewsJson ); From df0f09d1814a39441d854ad178c7c255534bf8db Mon Sep 17 00:00:00 2001 From: Marco Boatti Date: Mon, 20 Sep 2021 12:32:47 +0200 Subject: [PATCH 3/3] v2.6.7-stable --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 9feb6ea..002be7f 100755 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ "version": "2.6.7-stable", + "type": "magento2-module", "autoload": {