My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.
I'm looking at the file includes/classes/split_page_results.php.
I see the lines:
Code://-bof-product pagination // if (strpos($query_lower, 'distinct') || strpos($query_lower, 'group by')) { if ((strpos($query_lower, 'distinct') || strpos($query_lower, 'group by')) && is_numeric($count_key)) { //-eof-product_pagination $count_string = 'distinct ' . zen_db_input($count_key); } else { $count_string = zen_db_input($count_key); }
I turned debugging on in the file (set $debug=true in splitPageResults function), and I printed out $count_key, as well as the queries which already get printed out when $debug is true.
I see:
so it is calling is_numeric(p.products_id) which is returning false, and it is not getting 'DISTINCT' in the query.Code:count_key=p.products_id count_query=select count(p.products_id) as total FROM (products p LEFT JOIN manufacturers m USING(manufacturers_id), products_description pd, categories c, products_to_categories p2c ) LEFT JOIN meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND ((pd.products_name LIKE '%fiber%' OR p.products_model LIKE '%fiber%' OR m.manufacturers_name LIKE '%fiber%' OR (mtpd.metatags_keywords LIKE '%fiber%' AND mtpd.metatags_keywords !='') OR (mtpd.metatags_description LIKE '%fiber%' AND mtpd.metatags_description !='')) ))
I tried replacing the new code with the commented-out code:
I changed
back toCode:if ((strpos($query_lower, 'distinct') || strpos($query_lower, 'group by')) && is_numeric($count_key)) {
and I see the correct results.Code:if (strpos($query_lower, 'distinct') || strpos($query_lower, 'group by')) {
So I'm wondering if I can just change that line back to the original line.
I have just been making these changes in my test site, but I wonder if you could check to see if it makes sense to make this change.
Perhaps the call to is_numeric fixed something else, and this might break it in some other way.
Thanks very much for your help!
Hmm, you appear to have a down-level version of the /includes/classes/split_page_results.php file modification. What I've got in the current Products Pagination distribution shows the following on that line:
Code:if ((strpos($query_lower, 'distinct') || strpos($query_lower, 'group by')) && $count_key != '*') { /*v1.4.7c*/
Thanks so much for the info! I'm really sorry--I had looked at the description of the newer versions of the mod, but it didn't look like they fixed this specific issue, so I didn't upgrade. I made the change you suggested, and it now works fine! I will be upgrading with all the changes very soon. Thanks again for being so responsive, and for creating a great mod! I really appreciate all your help!
Hi. I want to thank you again for this wonderful mod! It really makes my website look nice.
I'm currently adding a new set of templates to my store to make it look nice on a mobile device. I'm wondering if either
- you have used your mod on a mobile site, and you could tell me what I would need to add to the mobile templates to make it work
There are 3 files in the mod, in includes/templates/YOUR TEMPLATE/templates. I could figure out what changes were made to those templates for the mod, and make them to my mobile templates, or
- would I need to disable your mod when someone is on a mobile device, and if so, any suggestions on how to do that?
Thanks in advance for your advice on this!
Good point, earth-friendly; depending on the number of "intermediate" links you've got in the pagination, it can look "really ugly" when you get to a smaller screen size.
I'll look into making a small change to the Previous/Intermediate/Next links' generation, adding a class to the different links' types so that you can style away (i.e. display: none;) those intermediate links on the smaller screen sizes.
I just got this working in the mobile templates on my test site.
If possible, I'd like to make a couple of changes to the display, but just for the mobile templates, not for my regular templates.
The problem is that I think the changes need to be made in includes/functions/extra_functions/products_pagination_functions.php, and that file is not template-specific. There is only one version of the functions.
Right now, on my regular site, I am displaying the pagination as 4 different elements, as follows:
Showing 1-48 (of 232 items) < 1 2 3 ... 5 > Page: 1 Items per Page: 48
So for the second element, < 1 2 3 ... 5 > :
you can click on a number to go to that page, or < or > to go to the previous or next page.
The third element, Page: 1, is a pulldown menu where you can go to a specific page,
And the fourth element is a pulldown menu, where you choose how many items to display per page.
On the regular site, these all fit on one line.
But on my iphone, in portrait mode, they are currently taking up 3 lines.
mobile-pagination-2.JPG
For the mobile site, I'd like to make the following changes:
Display the first element on one line
Don't display the second element at all
Display the third and fourth elements on the next line.
Even if I leave off the 2nd element, there is no way to fit the other 3 elements on 1 line on an iphone in portrait mode.
(I'd prefer to fit it all on one line, so if you have any suggestions on how to do that, that would be great!)
So, is this possible, to modify the functions, so that it generates the display one way for the regular site and a different way for the mobile site?
Perhaps along the lines of what you were saying, I could use styles to display things differently on the 2 different sites?
Or, do you have any better suggestions on how I can display this on a mobile device?
Thanks very much!