M
M
Michael2017-03-16 23:47:43
opencart
Michael, 2017-03-16 23:47:43

How to hide the display limit of products in categories?

Drop-down lists "sort" and "show".
regardless of how many products are displayed in the category, the show button (drop-down list) is displayed, for example, I have a limit of 15 products, and I do not want this button to be displayed when displaying less than 15 products in categories.
also sorting by rating, even if no product has a rating, the item in the sorting will be present.
has anyone messed around with this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maikttt, 2017-03-17
@maikttt

More or less like this:

$limit = 15;
if ($products_count > $limit) {
    echo '<a href="/next">Следующие</a>';
}
$has_rating = false;
foreach($products as $prod) {
    if ($prod->rating) {
        $has_rating = true;
        break;
    }
}
if ($has_rating) {
    echo '<a href="/sort_by_rating">Сортировка</a>';
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question