Skip to content

Commit

Permalink
Merge pull request #43 from feedaty/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
altravista committed Sep 20, 2021
2 parents b92b322 + df0f09d commit bf50821
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
32 changes: 16 additions & 16 deletions Observer/InterceptOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class InterceptOrder implements ObserverInterface

/**
* @var \Magento\Framework\ObjectManagerInterface
*/
*/
protected $_objectManager;

/**
* @var \Magento\Framework\App\State
*/
*/
protected $_state;

/**
Expand All @@ -67,7 +67,7 @@ class InterceptOrder implements ObserverInterface


/**
* @var
* @var
*/
protected $_orderInterface;

Expand All @@ -86,7 +86,7 @@ public function __construct(
State $state,
OrderInterface $orderInterface,
FeedatyHelper $feedatyHelper
)
)
{
$this->_scopeConfig = $scopeConfig;
$this->_storeManager = $storeManager;
Expand All @@ -105,7 +105,7 @@ public function __construct(
* @param $observer
*/
public function execute( \Magento\Framework\Event\Observer $observer ) {

$increment_id = $observer->getEvent()->getOrder()->getIncrementId();

try {
Expand All @@ -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 ) {
Expand All @@ -138,17 +140,17 @@ 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"
);

}

foreach ( ($order->getAllStatusHistory() ) as $orderComment ) {

if ( $orderComment->getStatus() === $orderopt )
if ( $orderComment->getStatus() === $orderopt )

$verify++;

Expand Down Expand Up @@ -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" ) {

Expand Down Expand Up @@ -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") {

Expand All @@ -246,7 +248,7 @@ public function execute( \Magento\Framework\Event\Observer $observer ) {

$this->_feedatyHelper->feedatyDebug(

json_encode($tmp),
json_encode($tmp),
"FEEDATY configurable Product: "

);
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
"AFL-3.0"
],

"version": "2.6.6-stable",
"version": "2.6.7-stable",


"type": "magento2-module",

"autoload": {
Expand Down
9 changes: 3 additions & 6 deletions view/frontend/templates/product-snippet.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -170,6 +166,7 @@ if ($product !== null) {
"ratingValue" => $ratingValue,
"ratingCount" => $ratingsCount
],
"reviewCount" => $toview['data_review']['TotalFeedbacks'],
"review" => $reviewsJson
);

Expand Down

0 comments on commit bf50821

Please sign in to comment.