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..002be7f 100755 --- a/composer.json +++ b/composer.json @@ -35,8 +35,9 @@ "AFL-3.0" ], - "version": "2.6.6-stable", + "version": "2.6.7-stable", + "type": "magento2-module", "autoload": { 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 );