Hello,
I'm using OC Version 1.5.1.3.
Can someone guide me to completely hide "List" view from all pages like Category, Search Result, etc. etc.
Thanks,
Ashish Verma
For category page(the others are similar):
Edit the file catalog/view/theme/yourtheme/template/product/category.tpl
Find and delete the line:
And then , from the same file you should also delete the javascript for the grid/list view as its not needed anymore.
So delete:
Edit the file catalog/view/theme/yourtheme/template/product/category.tpl
Find and delete the line:
Then find the line:<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>
and change it into:<div class="product-list">
Code: Select all
<div class="product-grid">
So delete:
Code: Select all
<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 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 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>
Came across this issue with Campion theme using 1.5.6.4.
Some of the relevant code was missing or changed compared to the default.
In this case, I used a different method, as described here:
http://www.templatemonster.com/help/ope ... -view.html
Looking for this came up empty:
if (view) {
display(view);
} else {
display('list');
}
In our theme, the 'else' was missing. By simply adding it as follows, it forced the default behavior back to grid.
else {
display('grid');
}
Removing the option from the top bar was basically the same as above, though I did need to sort out the div sections to make sure I commented out the correct portion.
So +1 for this working for that part.
Some of the relevant code was missing or changed compared to the default.
In this case, I used a different method, as described here:
http://www.templatemonster.com/help/ope ... -view.html
Looking for this came up empty:
if (view) {
display(view);
} else {
display('list');
}
In our theme, the 'else' was missing. By simply adding it as follows, it forced the default behavior back to grid.
else {
display('grid');
}
Removing the option from the top bar was basically the same as above, though I did need to sort out the div sections to make sure I commented out the correct portion.
So +1 for this working for that part.
Who is online
Users browsing this forum: No registered users and 12 guests