Добрый день.
Подскажите, возможно не верно сделал. Мне надо было блок отзывов разместить в разных местах для мобильных и для ПК.
Сделал это следующим образом.
Для ПК код разместил в див в нужном месте:
<div class="col-sm-12 visible-lg visible-md" >
<?php if ($minimum > 1) { ?>
<div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_minimum; ?></div>
<?php } ?>
<?php if ($review_status) { ?>
<div class="rating" style="text-align:center;">
<hr>
<?php } ?>
<?php if ($review_status) { ?>
<div id="review" style="padding-top:10px;">
<?php if ($reviews) { ?>
<?php foreach ($reviews_array as $review) { ?>
<div itemscope itemtype="http://schema.org/Review">
<div itemprop="itemReviewed" style="text-align:left;" content="<?php echo $heading_title; ?>">
<span style="width: 50%;"><strong itemprop="author"><?php echo $review['author']; ?></strong> / </span>
<span class="text-right"><time itemprop="datePublished" datetime="<?php echo $review['date_published']; ?>"><?php echo $review['date_added']; ?> / </time>
<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="ratingValue" content="<?php echo $review['rating']; ?>">
<meta itemprop="bestRating" content="5"><meta itemprop="worstRating" content="1">
</span>
<?php for ($i = 1; $i <= 5; $i++) { ?>
<?php if ($review['rating'] < $i) { ?>
<span class="fa fa-stack">
<i class="fa fa-star-o fa-stack-2x"></i>
</span>
<?php } else { ?>
<span class="fa fa-stack">
<i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i>
</span>
<?php } ?>
<?php } ?></span>
</div>
<div>
<div align="justify">
<p itemprop="reviewBody"><?php echo $review['text']; ?></p>
</div><br>
</div>
</div>
<?php } ?>
<div class="text-right"><?php echo $pagination; ?></div>
<?php } else { ?>
<p><?php echo $text_no_reviews; ?></p>
<?php } ?>
</div>
<div>
<input type="checkbox" id="hd-1" class="hide"/>
<label for="hd-1" ><span class="coments1" >Оставить отзыв о товаре <i class="fa fa-commenting-o" aria-hidden="true" style="vertical-align: top;"></i></span></label>
<div class="tab-pane" id="tab-review">
<form class="form-horizontal" id="form-review">
<?php if ($review_guest) { ?>
<div class="form-group required">
<div class="col-sm-12">
<label class="control-label" for="input-name"><?php echo $entry_name; ?></label>
<input type="text" name="name" value="" id="input-name" class="form-control" />
</div>
</div>
<div class="form-group required">
<div class="col-sm-12">
<label class="control-label" for="input-review"><?php echo $entry_review; ?></label>
<textarea name="text" rows="5" id="input-review" class="form-control"></textarea>
</div>
</div>
<div class="form-group required">
<div class="col-sm-12">
<label class="control-label"><?php echo $entry_rating; ?></label>
<?php echo $entry_bad; ?>
<input type="radio" name="rating" value="1" />
<input type="radio" name="rating" value="2" />
<input type="radio" name="rating" value="3" />
<input type="radio" name="rating" value="4" />
<input type="radio" name="rating" value="5" />
<?php echo $entry_good; ?></div>
</div>
<?php echo $captcha; ?>
<div class="buttons clearfix">
<div class="pull-right">
<button type="button" id="button-review" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary"><?php echo $button_continue; ?></button>
</div>
</div>
<?php } else { ?>
<?php echo $text_login; ?>
<?php } ?>
</form>
</div>
</div>
<?php echo $reviews; ?> Рейтинг: <?php echo $rating; ?>
<p style="color:#fff;font-size:15px;"><?php echo $model; ?></p>
</div>
<?php } ?>
</div>
Потом его же продублировал в другое место, в дивах:
<div class="col-xs-12 col-sm-12 col-md-5 col-lg-4 hidden-lg hidden-md" style="float:right;">
<?php if ($minimum > 1) { ?>
<div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_minimum; ?></div>
<?php } ?>
<?php if ($review_status) { ?>
<div class="rating" style="text-align:center;">
<hr>
<?php } ?>
<?php if ($review_status) { ?>
<div id="review2">
<?php if ($reviews) { ?>
<?php foreach ($reviews_array as $review) { ?>
<div itemscope itemtype="http://schema.org/Review">
<div itemprop="itemReviewed" style="text-align:left;" content="<?php echo $heading_title; ?>">
<span style="width: 50%;"><strong itemprop="author"><?php echo $review['author']; ?></strong> / </span>
<span class="text-right"><time itemprop="datePublished" datetime="<?php echo $review['date_published']; ?>"><?php echo $review['date_added']; ?> / </time>
<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="ratingValue" content="<?php echo $review['rating']; ?>">
<meta itemprop="bestRating" content="5"><meta itemprop="worstRating" content="1">
</span>
<?php for ($i = 1; $i <= 5; $i++) { ?>
<?php if ($review['rating'] < $i) { ?>
<span class="fa fa-stack">
<i class="fa fa-star-o fa-stack-2x"></i>
</span>
<?php } else { ?>
<span class="fa fa-stack">
<i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i>
</span>
<?php } ?>
<?php } ?></span>
</div>
<div>
<div align="justify">
<p itemprop="reviewBody"><?php echo $review['text']; ?></p>
</div><br>
</div>
</div>
<?php } ?>
<div class="text-right"><?php echo $pagination; ?></div>
<?php } else { ?>
<p><?php echo $text_no_reviews; ?></p>
<?php } ?>
</div>
<div>
<input type="checkbox" id="hd-2" class="hide"/>
<label for="hd-2" ><span class="coments1" >Оставить отзыв о товаре <i class="fa fa-commenting-o" aria-hidden="true" style="vertical-align: top;"></i></span></label>
<div class="tab-pane" id="tab-review">
<form class="form-horizontal" id="form-review2">
<?php if ($review_guest) { ?>
<div class="form-group required">
<div class="col-sm-12">
<label class="control-label" for="input-name"><?php echo $entry_name; ?></label>
<input type="text" name="name" value="" id="input-name" class="form-control" />
</div>
</div>
<div class="form-group required">
<div class="col-sm-12">
<label class="control-label" for="input-review"><?php echo $entry_review; ?></label>
<textarea name="text" rows="5" id="input-review" class="form-control"></textarea>
</div>
</div>
<div class="form-group required">
<div class="col-sm-12">
<label class="control-label"><?php echo $entry_rating; ?></label>
<?php echo $entry_bad; ?>
<input type="radio" name="rating" value="1" />
<input type="radio" name="rating" value="2" />
<input type="radio" name="rating" value="3" />
<input type="radio" name="rating" value="4" />
<input type="radio" name="rating" value="5" />
<?php echo $entry_good; ?></div>
</div>
<?php echo $captcha; ?>
<div class="buttons clearfix">
<div class="pull-right">
<button type="button" id="button-review2" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary"><?php echo $button_continue; ?></button>
</div>
</div>
<?php } else { ?>
<?php echo $text_login; ?>
<?php } ?>
</form>
</div>
</div>
<?php echo $reviews; ?> Рейтинг: <?php echo $rating; ?>
<p style="color:#fff;font-size:15px;"><?php echo $model; ?></p>
</div>
<?php } ?>
</div>
При этом продублировал скрипт измени его для мобильных, вот так:
<script type="text/javascript"><!--
$('#review').delegate('.pagination a', 'click', function(e) {
e.preventDefault();
$('#review').fadeOut('slow');
$('#review').load(this.href);
$('#review').fadeIn('slow');
});
$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');
$('#button-review').on('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
type: 'post',
dataType: 'json',
data: $("#form-review").serialize(),
beforeSend: function() {
$('#button-review').button('loading');
},
complete: function() {
$('#button-review').button('reset');
},
success: function(json) {
$('.alert-success, .alert-danger').remove();
if (json['error']) {
$('#review').after('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
}
if (json['success']) {
$('#review').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
$('input[name=\'rating\']:checked').prop('checked', false);
}
}
});
});
$(document).ready(function() {
$('.thumbnails').magnificPopup({
type:'image',
delegate: 'a',
gallery: {
enabled:true
}
});
});
//--></script>
<script type="text/javascript"><!--
$('#review2').delegate('.pagination a', 'click', function(e) {
e.preventDefault();
$('#review2').fadeOut('slow');
$('#review2').load(this.href);
$('#review2').fadeIn('slow');
});
$('#review2').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');
$('#button-review2').on('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
type: 'post',
dataType: 'json',
data: $("#form-review2").serialize(),
beforeSend: function() {
$('#button-review2').button('loading');
},
complete: function() {
$('#button-review2').button('reset');
},
success: function(json) {
$('.alert-success, .alert-danger').remove();
if (json['error']) {
$('#review2').after('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
}
if (json['success']) {
$('#review2').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
$('input[name=\'rating\']:checked').prop('checked', false);
}
}
});
});
$(document).ready(function() {
$('.thumbnails').magnificPopup({
type:'image',
delegate: 'a',
gallery: {
enabled:true
}
});
});
//--></script>
Не бейте только.) Решение конечно соглашусь глупое, но работает.
Но вот сегодня выяснилось что пагинация не работает на ПК, а на мобильном все в порядке.
Подскажите, что не так?