{% else-1 %}
BigLion * 1.35
(6 янв 2016, 12:58) (0/0) [0]
Хочу сделать так что бы товары отобжались не списком а сеткой . скажите что в коде надо заменить
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div>
<?php if ($products) { ?>
<div class="product-filter">
<div class="display"><b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display('grid');"><?php echo $text_grid; ?></a></div>
<div class="limit"><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"><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>
<div class="product-list">
<?php foreach ($products as $product) { ?>
<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 } ?>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<div class="description"><?php echo $product['description']; ?></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<?php echo $product['special']; ?>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<div class="cart">
<input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
</div>
<div class="wishlist"><a onclick="addToWishList('<?php echo $product['product_id']; ?>');"><?php echo $button_wishlist; ?></a></div>
<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>
</div>
<?php } ?>
</div>
<div class="pagination"><?php echo $pagination; ?></div>
<?php } ?>
<script type="text/javascript"><!--
function display(view) {
if (view == 'list') {
$('.product-grid').attr('class', 'product-list');

$('.product-list > div').each(function(index, element) {
html = '<div class="right">';
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';
html += ' <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>';
html += '</div>';

html += '<div class="left">';

var sale = $(element).find('.sale').html();

if (sale != null) {
html += '<div class="sale">' + sale + '</div>';
}

var image = $(element).find('.image').html();

if (image != null) {
html += '<div class="image">' + image + '</div>';
}

var price = $(element).find('.price').html();

if (price != null) {
html += '<div class="price">' + price + '</div>';
}

html += ' <div class="name">' + $(element).find('.name').html() + '</div>';
html += ' <div class="description">' + $(element).find('.description').html() + '</div>';

var rating = $(element).find('.rating').html();

if (rating != null) {
html += '<div class="rating">' + rating + '</div>';
}

html += '</div>';


$(element).html(html);
});

$('.display').html('<b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display(\'grid\');"><?php echo $text_grid; ?></a>');

$.cookie('display', 'list');
} else {
$('.product-list').attr('class', 'product-grid');

$('.product-grid > div').each(function(index, element) {
html = '';

var sale = $(element).find('.sale').html();

if (sale != null) {
html += '<div class="sale">' + sale + '</div>';
}

var image = $(element).find('.image').html();

if (image != null) {
html += '<div class="image">' + image + '</div>';
}

html += '<div class="name">' + $(element).find('.name').html() + '</div>';
html += '<div class="description">' + $(element).find('.description').html() + '</div>';

var price = $(element).find('.price').html();

if (price != null) {
html += '<div class="price">' + price + '</div>';
}

var rating = $(element).find('.rating').html();

if (rating != null) {
html += '<div class="rating">' + rating + '</div>';
}

html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
html += '<div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += '<div class="compare">' + $(element).find('.compare').html() + '</div>';

$(element).html(html);
});

$('.display').html('<b><?php echo $text_display; ?></b> <a onclick="display(\'list\');"><?php echo $text_list; ?></a> <b>/</b> <?php echo $text_grid; ?>');

$.cookie('display', 'grid');
}
}

view = $.cookie('display');

if (view) {
display(view);
} else {
display('list');
}
//--></script>
</div>
</div>
</div>
Добавлено 06.01.16 в 13:02:39:
Я знаю что где то надо слово list изменить на grin но не знаю где
  • 1 из 1