diff --git a/Cron/OrdersSyncJob.php b/Cron/OrdersSyncJob.php
deleted file mode 100644
index 223bd531..00000000
--- a/Cron/OrdersSyncJob.php
+++ /dev/null
@@ -1,24 +0,0 @@
-ordersSyncModel = $ordersSyncModel;
- }
-
- public function execute()
- {
- return $this->ordersSyncModel->execute();
- }
-}
diff --git a/Cron/UpdateMetadata.php b/Cron/UpdateMetadata.php
deleted file mode 100644
index 46f761c3..00000000
--- a/Cron/UpdateMetadata.php
+++ /dev/null
@@ -1,24 +0,0 @@
-updateMetadataModel = $updateMetadataModel;
- }
-
- public function execute()
- {
- return $this->updateMetadataModel->execute();
- }
-}
diff --git a/Model/Config.php b/Model/Config.php
index 836748f3..62c0aa46 100644
--- a/Model/Config.php
+++ b/Model/Config.php
@@ -13,6 +13,7 @@
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
use Psr\Log\LoggerInterface;
+use Yotpo\Yotpo\Model\Logger as YotpoLogger;
class Config
{
@@ -79,6 +80,11 @@ class Config
*/
private $logger;
+ /**
+ * @var YotpoLogger
+ */
+ private $yotpoLogger;
+
/**
* @method __construct
* @param StoreManagerInterface $storeManager
@@ -89,6 +95,7 @@ class Config
* @param ModuleListInterface $moduleList
* @param ProductMetadataInterface $productMetadata
* @param LoggerInterface $logger
+ * @param YotpoLogger $yotpoLogger
*/
public function __construct(
StoreManagerInterface $storeManager,
@@ -98,7 +105,8 @@ public function __construct(
DateTimeFactory $datetimeFactory,
ModuleListInterface $moduleList,
ProductMetadataInterface $productMetadata,
- LoggerInterface $logger
+ LoggerInterface $logger,
+ YotpoLogger $yotpoLogger
) {
$this->storeManager = $storeManager;
$this->scopeConfig = $scopeConfig;
@@ -108,6 +116,7 @@ public function __construct(
$this->moduleList = $moduleList;
$this->productMetadata = $productMetadata;
$this->logger = $logger;
+ $this->yotpoLogger = $yotpoLogger;
}
/**
@@ -398,6 +407,7 @@ public function log($message, $type = "debug", $data = [], $prefix = '[Yotpo Log
$this->logger->debug($prefix . json_encode($message), $data);
break;
}
+ $this->yotpoLogger->info($prefix . json_encode($message), $data);
}
return $this;
}
diff --git a/Model/Logger.php b/Model/Logger.php
new file mode 100644
index 00000000..31797cc2
--- /dev/null
+++ b/Model/Logger.php
@@ -0,0 +1,6 @@
+getId())) {
continue;
}
+ if (
+ $orderItem->getData('amount_refunded') >= $orderItem->getData('row_total_incl_tax') ||
+ $orderItem->getData('qty_ordered') <= ($orderItem->getData('qty_refunded') + $orderItem->getData('qty_canceled'))
+ ) {
+ //Skip if item is fully canceled or refunded
+ continue;
+ }
if ($orderItem->getProductType() === ProductTypeGrouped::TYPE_CODE && isset($productsData[$product->getId()])) {
- $productsData[$product->getId()]['price'] += $orderItem->getData('row_total_incl_tax');
+ $productsData[$product->getId()]['price'] += $orderItem->getData('row_total_incl_tax') - $orderItem->getData('amount_refunded');
} else {
$productsData[$product->getId()] = [
'name' => $product->getName(),
'url' => $product->getProductUrl(),
'image' => $this->getProductMainImageUrl($product),
'description' => $this->escaper->escapeHtml(strip_tags($product->getDescription())),
- 'price' => $orderItem->getData('row_total_incl_tax'),
+ 'price' => $orderItem->getData('row_total_incl_tax') - $orderItem->getData('amount_refunded'),
'specs' => array_filter(
[
'external_sku' => $product->getSku(),
'upc' => $product->getUpc(),
'isbn' => $product->getIsbn(),
'mpn' => $product->getMpn(),
- 'brand' => $product->getBrand(),
+ 'brand' => $product->getBrand() ? $product->getAttributeText('brand') : null,
]
),
];
diff --git a/Plugin/AbstractYotpoReviewsSummary.php b/Plugin/AbstractYotpoReviewsSummary.php
index 0d393483..28416f90 100644
--- a/Plugin/AbstractYotpoReviewsSummary.php
+++ b/Plugin/AbstractYotpoReviewsSummary.php
@@ -3,6 +3,7 @@
namespace Yotpo\Yotpo\Plugin;
use Magento\Catalog\Model\Product;
+use Magento\Framework\Registry;
use Magento\Framework\View\Element\Context;
use Yotpo\Yotpo\Model\Config as YotpoConfig;
@@ -18,12 +19,25 @@ class AbstractYotpoReviewsSummary
*/
protected $_yotpoConfig;
+ /**
+ * @var Registry
+ */
+ protected $_coreRegistry;
+
+ /**
+ * @method __construct
+ * @param Context $context
+ * @param YotpoConfig $yotpoConfig
+ * @param Registry $coreRegistry
+ */
public function __construct(
Context $context,
- YotpoConfig $yotpoConfig
+ YotpoConfig $yotpoConfig,
+ Registry $coreRegistry
) {
$this->_context = $context;
$this->_yotpoConfig = $yotpoConfig;
+ $this->_coreRegistry = $coreRegistry;
}
protected function _getCategoryBottomLineHtml(Product $product)
diff --git a/Plugin/Review/Block/Product/ReviewRenderer.php b/Plugin/Review/Block/Product/ReviewRenderer.php
index 0e3a8b86..6ae3a1c0 100644
--- a/Plugin/Review/Block/Product/ReviewRenderer.php
+++ b/Plugin/Review/Block/Product/ReviewRenderer.php
@@ -32,18 +32,15 @@ public function aroundGetReviewsSummaryHtml(
return $proceed($product, $templateType, $displayIfNoReviews);
}
- $currentPage = $this->_context->getRequest()->getFullActionName();
-
- if ($this->_yotpoConfig->isCategoryBottomlineEnabled()) {
- if (in_array($currentPage, ['cms_index_index', 'catalog_category_view'])) {
+ $currentProduct = $this->_coreRegistry->registry('current_product');
+ if (!$currentProduct || $currentProduct->getId() !== $product->getId()) {
+ if ($this->_yotpoConfig->isCategoryBottomlineEnabled()) {
return $this->_getCategoryBottomLineHtml($product);
- }
- } elseif (!$this->_yotpoConfig->isMdrEnabled()) {
- if (in_array($currentPage, ['cms_index_index', 'catalog_category_view'])) {
+ } elseif (!$this->_yotpoConfig->isMdrEnabled()) {
return $proceed($product, $templateType, $displayIfNoReviews);
}
- } else {
- return '';
}
+
+ return '';
}
}
diff --git a/composer.json b/composer.json
index 15f913f2..dedc7ebb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "yotpo/module-review",
"description": "Yotpo Reviews extension for Magento2",
- "version": "3.1.0",
+ "version": "3.1.1",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/etc/config.xml b/etc/config.xml
index 74729268..357844b8 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -18,5 +18,15 @@
50
+
+
+
+ 1
+
+
+ 1
+
+
+
diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml
new file mode 100644
index 00000000..97af7373
--- /dev/null
+++ b/etc/csp_whitelist.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+ yotpo.com
+ www.yotpo.com
+ p.yotpo.com
+ staticw2.yotpo.com
+ w2.yotpo.com
+
+
+
+
+ yotpo.com
+ www.yotpo.com
+ p.yotpo.com
+ staticw2.yotpo.com
+ w2.yotpo.com
+
+
+
+
+ yotpo.com
+ www.yotpo.com
+ p.yotpo.com
+ staticw2.yotpo.com
+ w2.yotpo.com
+
+
+
+
+ yotpo.com
+ www.yotpo.com
+ p.yotpo.com
+ staticw2.yotpo.com
+ w2.yotpo.com
+
+
+
+
+ yotpo.com
+ www.yotpo.com
+ p.yotpo.com
+ staticw2.yotpo.com
+ w2.yotpo.com
+
+
+
+
+ yotpo.com
+ www.yotpo.com
+ p.yotpo.com
+ staticw2.yotpo.com
+ w2.yotpo.com
+
+
+
+
diff --git a/etc/di.xml b/etc/di.xml
index b2bf067c..86fd7ae9 100644
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -25,4 +25,18 @@
-
\ No newline at end of file
+
+
+
+ Magento\Framework\Filesystem\Driver\File
+
+
+
+
+ yotpoLogger
+
+ - Yotpo\Yotpo\Model\Logger\YotpoHandler
+
+
+
+
diff --git a/etc/module.xml b/etc/module.xml
index fbda0305..111c3f78 100644
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/view/frontend/web/css/source/_module.less b/view/frontend/web/css/source/_module.less
index c98e988b..e6793401 100644
--- a/view/frontend/web/css/source/_module.less
+++ b/view/frontend/web/css/source/_module.less
@@ -27,14 +27,14 @@
margin: 0 10px 1px 0;
}
- &.cms-index-index .product-item-actions {
+ .product-item .product-item-actions {
margin-top: 5px !important;
}
&.catalog-category-view,
&.catalog-product-view {
&.page-products {
- .product-item-actions {
+ .product-item .product-item-actions {
margin-top: 0 !important;
}
}