Products per Page

Posts: 12
Joined: 04/23/2008

Greetings,

In the catalog section of the store configuration I have set the "products per page" to 12. However on some pages where I have products listed there is a "1" or "2" and "next" and "last" links that take you to a blank page. It seems that even though there are less then 12 products on the page for some reason ubercard/drupal thinks there are more than 12 and so links are added to the bottom of the page. Any ideas what could be causing this?

Thanks.

Posts: 1608
Joined: 08/07/2007
AdministratoreLiTe!

It sounds like there is some confusion between the query that counts the products and the query that gets the product information. Entirely possible of one of them isn't using that setting.

Posts: 12
Joined: 04/23/2008

Greetings,

What can be done to resolve this issue?

Thank you for your time.

Posts: 12
Joined: 04/23/2008

Bump.

Posts: 1608
Joined: 08/07/2007
AdministratoreLiTe!

Are any of the nodes in those categories not published or not products?

Posts: 12
Joined: 04/23/2008

No. They are all products and all published.

Posts: 542
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Are you using the Catalog grid view? In the grid view, if the number of products per page is not evenly divisible by the number of products per row, funny things can happen.

--

<tr>.

Posts: 12
Joined: 04/23/2008

No. I am not using the grid view. Just the normal view.

Posts: 1608
Joined: 08/07/2007
AdministratoreLiTe!

Maybe something's screwy in the database. Go download and enable the Devel module, and in the settings turn on "Collect query info" and "Display query log". Next, go to the catalog page that shows the pager, and look for "pager_query" in the long list at the bottom.

It should be there twice. Take the SQL next to them and run it directly on your database. I want to see what results they get. One should be a bunch of information about the products in the catalog, and the other should give you the number of rows returned by the first query. Should be. It sounds like they're not for some reason.

By the way, are you using PostgreSQL?

Posts: 12
Joined: 04/23/2008

Yes I am using PostgreSQL.

Posts: 1608
Joined: 08/07/2007
AdministratoreLiTe!

There's two different counting queries to try to resolve differences between MySQL and Postgres. My instinct tells me that this isn't necessary, but I'm sure the Postgres query is broken. The problem is that I don't have a Postgres database handy to try to fix it. Wasn't there somebody who was looking out for this kind of thing?

Posts: 12
Joined: 04/23/2008

Here are the two queries and what they return:

SELECT DISTINCT n.nid, COUNT(*) FROM node n INNER JOIN term_node tn ON n.nid = tn.nid INNER JOIN uc_products AS p ON n.nid = p.nid WHERE tn.tid = 13 AND n.status = 1 AND n.type IN ('product','barebonesam2','barebonesam2plus') GROUP BY n.nid

nid | count
-----+-------
24 | 1
25 | 1
(2 rows)

SELECT DISTINCT(n.nid), n.sticky, n.title, n.created, p.model, p.ordering FROM node n INNER JOIN term_node tn ON n.nid = tn.nid INNER JOIN uc_products AS p ON n.vid = p.vid WHERE tn.tid = 13 AND n.status = 1 AND n.type IN ('product','barebonesam2','barebonesam2plus') ORDER BY p.ordering, n.title, n.nid LIMIT 12 OFFSET 0

nid | sticky | title | created | model | ordering
-----+--------+--------------------------------+------------+---------------+----------
24 | 0 | Gigabyte AMD 690G AM2 MicroATX | 1209232825 | GA-MA69GM-S2H | 0
25 | 0 | Gigabyte AMD 690V AM2 MicroATX | 1209233129 | GA-MA69VM-S2 | 0
(2 rows)

The products per page in the catalog configuration is set to 12. However there are only 2 products in this particular category yet there is "1 2 next › last »" at the bottom of the page.

Posts: 12
Joined: 04/23/2008

Bump.

Posts: 12
Joined: 04/23/2008

Bump.

Anyone know of the status of this issue?

Thanks.

Posts: 3229
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

You'll have to find someone that knows Postgres to debug it... we don't use or develop for it personally. You might try taking "DISTINCT n.nid, " out of the first query and seeing what happens... Puzzled

Posts: 12
Joined: 04/23/2008

I have the same problem with my current shopping cart. It only supports mysql. I prefer postgres which Drupal supports. Shouldn't a module developed for Drupal support the databases that Drupal supports? There are many people who would like to use ubercart with postgresql. Not all of us use mysql or wish to use it. It would not hurt to consider getting ubercart to work with all databases Drupal supports and not just mysql. I realize this might not be as easy as it sounds but I am sure there are community members who would assist. I will do my best to try to figure out how to fix it and get any patches to you guys but I am not an expert in this regard so I am unsure of how successful I will be.

Thank you for all your time and efforts regarding this matter.

Posts: 3229
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Re: whether or not Ubercart should support Postgres... it would be a good idea, but it's just not something either of the core developers have any experience with. Drupal supports Postgres b/c community users were able to provide feedback and make sure it was up to snuff for Postgres... if you or someone else can fix this issue, I think we'll have almost complete Postgres support. Smiling