Здравствуйте.
Помогите пожалуйста.
В стандартном шаблоне опенкарт 1.5 в файле category.tpl есть скрипт, который выводит товары по одному и по несколько блоков. Вот код:
<?php echo $header; ?>
<div class="container">
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
</div>
<div class="row">
<?php echo $column_left; ?>
<?php if ($column_left && $column_right) { ?>
<?php $class = 'col-sm-6'; ?>
<?php } elseif ($column_left || $column_right) { ?>
<?php $class = 'col-sm-9'; ?>
<?php } else { ?>
<?php $class = 'col-sm-12'; ?>
<?php } ?>
<div id="content" class="<?php echo $class; ?>">
<h1><?php echo $heading_title; ?></h1>
<?php echo $content_top; ?>
<?php if ($thumb || $description) { ?>
<div class="category-info">
<?php if ($thumb) { ?>
<!-- <div class="image"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" /></div> -->
<?php } ?>
</div>
<?php } ?>
<?php if ($categories) { ?>
<div class="box">
<!--<div class="box-heading"><?php echo $text_refine; ?></div>-->
<!--<div class="box-content">-->
<div class="box-product box-subcat row">
<?php foreach ($categories as $category) { ?>
<div class="col-md-3 col-sm-3 col-xs-12">
<?php if ($category['thumb']) { ?>
<div class="image-category"><a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a></div>
<?php } ?>
<div class="name subcatname"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
<?php if ($products) { ?>
<div class="product-filters row"></div>
<div class="show-filter hidden-sm hidden-md hidden-lg"><a href="#" onclick="toggleFilter();return false;">Показать фильтр</a></div>
<div class="product-filter row">
<div class="product-compare col-md-3"><a href="<?php echo $compare; ?>" id="compare_total"><?php echo $text_compare; ?></a></div>
<div class="limit col-md-3 text-right"><b><?php echo $text_limit; ?></b>
<select onchange="location = this.value;">
<?php foreach ($limits as $limits) { ?>
<?php if ($limits['value'] == $limit) { ?>
<option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
<?php } else { ?>
<option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="sort col-md-5 text-right"><b><?php echo $text_sort; ?></b>
<select onchange="location = this.value;">
<?php foreach ($sorts as $sorts) { ?>
<?php if ($sorts['value'] == $sort . '-' . $order) { ?>
<option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
<?php } else { ?>
<option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="display col-md-1"><?php echo $text_list; ?><a onclick="display('grid');"><?php echo $text_grid; ?></a></div>
</div>
<div class="row products">
<?php $i = 1; ?>
<?php foreach ($products as $product) { ?>
<?php if ($i == 7 ) { ?>
<div class="rozetka col-lg-4 col-md-4 col-sm-4 col-xs-12"><?php echo $content_category_rozetka; ?></div>
<?php } ?>
<div class="product-list col-xs-12 <?php if($product['quantity'] == 0) { ?>grey<?php } ?>" <?php if($product['quantity'] == 0) { ?>data-grey="grey"<?php } ?>>
<div class="name"><a href="<?php echo $product['href']; ?>"><? if(isset($product_prefics)) { echo $product_prefics;} ?> <?php echo $product['name']; ?></a></div>
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<?php } ?>
<?php if ($product['price'] && (int)$product['price'] > 0) { ?>
<div class="detail">
<div class="price">
<?php if (!$product['special']) { ?>
<span class="price-normal"><?php echo $product['price']; ?></span>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<br />
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
<div class="pull-right">
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
</div>
</div>
<?php } ?>
<div class="button-group">
<? if($product['quantity'] > 0) { ?>
<button type="button" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button cart"><span><i class="fa fa-shopping-bag" aria-hidden="true"></i> <?php echo $button_cart; ?></span></button>
<? } else { ?>
<button type="button" onclick="addToWaitList('<?php echo $product['product_id']; ?>');" class="button cart"><span>Сообщить о наличии</span></button>
<?php } ?>
<button type="button" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" onclick="addToWishList('<?php echo $product['product_id']; ?>');" class="wishlist" data-original-title="<?php echo $button_wishlist; ?>"><i class="fa fa-heart"></i></button>
<button type="button" data-toggle="tooltip" title="<?php echo $button_compare; ?>" onclick="addToCompare('<?php echo $product['product_id']; ?>');" class="compare" data-original-title="<?php echo $button_compare; ?>"><i class="fa fa-exchange"></i></button>
</div>
</div>
<div class="description"><?php echo $product['description']; ?></div>
</div>
<?php $i++; ?>
<?php } ?>
</div>
<div class="pagination"><?php echo $pagination; ?></div>
<?php } ?>
<?php echo $content_bottom; ?>
<?php if ($description) { ?>
<?php echo $description; ?>
<?php } ?>
</div>
<script type="text/javascript"><!--
function display(view) {
if (view == 'list') {
$('.product-grid').attr('class', 'product-list col-sm-12');
$('.product-list').each(function(index, element) {
if (typeof($(element).attr('data-grey')) !== 'undefined') {
$(element).addClass('grey');
}
html = '<div class="col-xs-12 col-sm-3 col-md-3">';
var image = $(element).find('.image').html();
if (image != null) {
html += '<div class="image">' + image + '</div>';
}
html += '</div>';
html += '<div class="col-xs-12 col-sm-5 col-md-5 text-left">';
html += ' <div class="name">' + $(element).find('.name').html() + '</div>';
html += ' <div class="description">' + $(element).find('.description').html() + '</div>';
html += '</div>';
html += '<div class="col-xs-12 col-sm-4 col-md-4">';
var price = $(element).find('.price').html();
if (price != null) {
html += '<div class="price">' + price + '</div>';
}
var rating = $(element).find('.price').html();
html += ' <div class="button-group">' + $(element).find('.button-group').html() + '</div>';
html += '</div>';
$(element).html(html);
});
$('.display').html('<?php echo $text_list; ?><a onclick="display(\'grid\');"><?php echo $text_grid; ?></a>');
$.cookie('display', 'list');
} else {
$('.product-list').attr('class', 'product-grid col-lg-4 col-md-4 col-sm-4 col-xs-12');
$('.product-grid').each(function(index, element) {
if (typeof($(element).attr('data-grey')) !== 'undefined') {
$(element).addClass('grey');
}
html = '';
var image = $(element).find('.image').html();
if (image != null) {
html += '<div class="image">' + image + '</div>';
}
html += ' <div class="name">' + $(element).find('.name').html() + '</div>';
var price = $(element).find('.price').html();
if (price != null) {
html += '<div class="price">' + price + '</div>';
}
var rating = $(element).find('.price').html();
html += ' <div class="button-group">' + $(element).find('.button-group').html() + '</div>';
html += ' <div class="description">' + $(element).find('.description').html() + '</div>';
$(element).html(html);
});
$('.display').html('<a onclick="display(\'list\');"><?php echo $text_list; ?></a><?php echo $text_grid; ?>');
$.cookie('display', 'grid');
}
}
view = $.cookie('display');
if (view) {
display(view);
} else {
display('grid');
}
//--></script>
</div>
<?php echo $column_right; ?></div>
</div>
<?php echo $footer; ?>
Вопрос в том, что не знаю как поменять звездочки с кнопкой местами, там где три блока, так как там все в js.
это класс product-grid.
product-list написан на html, его поменять не сложно, но он должен оставаться по одному товару в ряд.
Вот скриншоты:
http://prntscr.com/he9jb1 ,
http://prntscr.com/he9kk3