Commit a405d313 by halweg

fix : reviews next click fix

parent f53a392a
......@@ -142,7 +142,7 @@ class ReviewInfo extends \Magento\Framework\App\Action\Action {
public function getRatingPercent($reviewId)
{
$ratingCollection = $this->_objectManager->get('Magento\Review\Model\ResourceModel\Rating\Option\Vote\Collection')
$ratingCollection = $this->_objectManager->create('Magento\Review\Model\ResourceModel\Rating\Option\Vote\Collection')
->addFieldToFilter('review_id',$reviewId);
$data = $ratingCollection->getData();
return $data[0]['percent'] ?? 100;
......
......@@ -622,7 +622,7 @@ $imagesBlock = $helper->getReviewImagesBlock(15, $block->getProductId());
return res;
}
$(".joshine-review-pic-item").on('click', function () {
$(".joshine-review-container .joshine-review-pic-item").on('click', function () {
var reviewId = $(this).data('reviews-id');
var productId = $(this).data('product-id');
var image_id = $(this).data('image-id');
......@@ -708,9 +708,19 @@ $imagesBlock = $helper->getReviewImagesBlock(15, $block->getProductId());
}
$(".swiper-button-next").on('click', function () {
let img_idx_pre = img_idx + 1;
let has_pre = false;
$('.image-thumbs-list-item').each(function (index, element) {
if ($(element).data('img-index') == img_idx_pre) {
has_pre = true;
return;
}
});
if (!has_pre) {
return;
}
if (!lock) return;
lock = false;
swiper_wrapper.css({"transition" : 'transform .5s ease 0s'});
img_idx++;
swiper_wrapper.css({"transform" : 'translateX(' + -536 * img_idx + 'px)'});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment