VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Tiger78 on November 08, 2015, 13:10:35 PM

Title: How to hide pagination in category view in VM3?
Post by: Tiger78 on November 08, 2015, 13:10:35 PM
Hello,

I want to hide the pagination or parts of the pagination in category view if the "total size of products" (in 1 category, not in 1 page) is lower than the limit (limit box).

For example:



<?php 
  
if ($this->total) > ($this->limit)   { ?>

<div class="orderby-displaynumber">
    <div class="vm-pagination"><?php echo $this->vmPagination->getPagesLinks(); ?></div>
            <div class="vm-page-counter"><?php echo $this->vmPagination->getPagesCounter (); ?></div>
            <div class="display-number"><?php echo $this->vmPagination->getLimitBox ($this->category->limit_list_step); ?></div>
</div>
      <?php
      

      
?>




But the values of $this->total and $this->limit (vmpagination.php) are always 0 in category view.

For $this->total I´ve also tried count($products).

What are the correct terms?

Thanks!
Title: Re: How to hide pagination in category view in VM3?
Post by: GJC Web Design on November 08, 2015, 15:49:34 PM
count($this->products)

and echo out $this->category to see what the limit vars are
Title: Re: How to hide pagination in category view in VM3?
Post by: Tiger78 on November 09, 2015, 16:54:15 PM
1. count($this->products) is the number of products on the respective side,
e.g.
20 products on category page 1
20 products on category page 2
3 products on category page 3

But what is the overall number of products in the category? (in this example: 43)

2. echo $this->category; displays the following: TableCategories

How can I see the limit vars?

Title: Re: How to hide pagination in category view in VM3?
Post by: GJC Web Design on November 09, 2015, 17:58:35 PM
but if you want to show pagi only if > page limit then count will work

Quoteecho $this->category; displays the following: TableCategories

impossible  ..

you have at least  $this->category->limit_list_step

use

print 'Debug Line '.__LINE__.' $this->category <pre>'; print_r ($this->category); print "</pre><br />\n";

same for   $this->vmPagination  ..  might be something there

Title: Re: How to hide pagination in category view in VM3?
Post by: Tiger78 on November 10, 2015, 12:00:27 PM
Ah...thanks....that´s it! The correct code (if) is:

<?php 
  
if ($this->vmPagination->total  >  $this->vmPagination->limit)   { ?>

<div class="orderby-displaynumber">
    <div class="vm-pagination"><?php echo $this->vmPagination->getPagesLinks(); ?></div>
            <div class="vm-page-counter"><?php echo $this->vmPagination->getPagesCounter (); ?></div>
            <div class="display-number"><?php echo $this->vmPagination->getLimitBox ($this->category->limit_list_step); ?></div>
</div>
      <?php
      

      
?>



Now parts of pagination will be displayed only if it is nessesary. This is advantageous in my template design.