Welcome, Guest
Username: Password: Remember me

TOPIC: All element list count

All element list count 16 Apr 2013 08:16 #7049

  • Czyżak
  • Czyżak's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Thank you received: 1
  • Karma: 0
Hello,
in the begining i would like to say that j-cook is absolutly fantastic tool! And the person who crate it is genius.
I have created few components, and modify them for my purpose.
The problem that i have encountered is ridicul:
I have no idea how to show count of all items in the frontend collection view.

For exemple: I have 7 elements to show. I set paggination to show on every page 5 elements. So i get the view with 5 elements and paginnation to next page with 2 elements.
I need to show count of all found items (including filters, and search boxes).

I was thinking that model will contains all elements, but view get only elements that are going to be shown (in ex. 5 - not 7).

My main problem is that i do not understand where is the pleace that the selected items are cuted by the pagination.
Where can i get access to query and execute it (i mean the query created in prepareQuery)?
Or is there a posibility to get all items in view.html.php?

Is there an easy way of geting count of all elements matching query?

I do not care if I get access to this "magic" value by $this-> or $items-> or set this value to all items->itemsCount

Please help, or at least give me a clue where should i look in code.
B)
The administrator has disabled public write access.

Re: All element list count - Resolved 08 May 2013 10:19 #7153

  • Czyżak
  • Czyżak's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Thank you received: 1
  • Karma: 0
I have been trying to do smth for few hours.
Then I decide to get back to other projects (more like .net). And today i found it easly!
So the answer is: $this->pagination->total
The administrator has disabled public write access.
The following user(s) said Thank You: VeCrea

Re: All element list count - Resolved 08 Jul 2013 09:56 #7909

In which file did you change to "total" ? I have the same problem.
The administrator has disabled public write access.

Re: All element list count - Resolved 09 Jul 2013 09:52 #7926

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
You can create a special SQL in prepareQuery() of the model.
You can sum in PHP in you view.html.php
You can sum dynamic is JS in the template file.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.072 seconds

Get Started