Page 1 of 2 12 LastLast
Results 1 to 10 of 32

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Does anyone know how to modify ZC so that the customer can choose from a list, how many products per page to display? Or at least give them the option to click "show all" ?

    I have my All Products page set to display 32 products per page, but I'd like the customer to have different options.

  2. #2
    Join Date
    Mar 2006
    Location
    Fresno, California
    Posts
    620
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Hi limelites,

    There is a way to view all in a category. I did this about a year ago...

    http://www.zen-cart.com/forum/showth...t=38551&page=3

    see post #24 by modernm

    it involves editing product_listing.php and tpl_modules_product_listing.php

    it will give you a [view all] link in categories

  3. #3
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Thanks BobDog, that's a very useful link! I'm looking more at post 27 though as it seems this is the best working mod for all pages.

    My trouble is that I already have a modified split_page_results.php which is giving me my drop down page numbers.

    I'm having a hard time merging my own file with the file in post 27.

    My file with the drop down mods:
    http://www.limelites.co.uk/includes/...ge_results.rar

    This new file which gives a view all option:
    http://www.limelites.co.uk/includes/...p.view_all.rar

    Can't get them to merge :-(

  4. #4
    Join Date
    Dec 2006
    Location
    Athens - Greece
    Posts
    71
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Quote Originally Posted by limelites View Post
    Thanks BobDog, that's a very useful link! I'm looking more at post 27 though as it seems this is the best working mod for all pages.

    My trouble is that I already have a modified split_page_results.php which is giving me my drop down page numbers.

    I'm having a hard time merging my own file with the file in post 27.

    My file with the drop down mods:
    http://www.limelites.co.uk/includes/...ge_results.rar

    This new file which gives a view all option:
    http://www.limelites.co.uk/includes/...p.view_all.rar

    Can't get them to merge :-(
    Thanks limelites!
    Your drop-down mod works great!

  5. #5
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    You're welcome.

    Oh and by the way, for anyone interested, the merged version which gives both the drop down for page numbers AND the choice to choose how many products per page (in my case 100, 200, 300, 400, View All) here is the split page file for /includes/classes:

    http://www.limelites.co.uk/split_page_results.rar

    You'll also need the define file added to /includes/languages/english/extra_definitions:

    http://www.limelites.co.uk/alternative_page_numbers.rar

    View it in action first at http://www.limelites.co.uk/index.php...e=products_all

  6. #6
    Join Date
    Jun 2008
    Posts
    111
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Quote Originally Posted by limelites View Post
    You're welcome.

    Oh and by the way, for anyone interested, the merged version which gives both the drop down for page numbers AND the choice to choose how many products per page (in my case 100, 200, 300, 400, View All) here is the split page file for /includes/classes:

    http://www.limelites.co.uk/split_page_results.rar

    You'll also need the define file added to /includes/languages/english/extra_definitions:

    http://www.limelites.co.uk/alternative_page_numbers.rar

    View it in action first at http://www.limelites.co.uk/index.php...e=products_all
    hi, i'm still a noob with php files and i've spent hours trying to un-do things i've messed up, so i'm just going to go ahead and ask....

    i have installed these two bits, but am not seeing how to define the increments of the products per page and display it as a drop down box? what are the css styles/ids/etc i need to change to alter their appearance?

    sorry to seem dense. my site is at http://store.inspiritcommon.com/ there's a password to access the site since it's not ready for prime time. un: alphatester pw:Gr8gratitude.

    thanks!
    :) emily
    http://store.inspiritcommon.com/
    ZC 1.3.8a on Godaddy :: EP 1.2.5.4 :: Adv Search 1.1 and a buncha other stuff

  7. #7
    Join Date
    Jun 2008
    Posts
    111
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    hooray! i figured out how to change the per-page choices, but still cannot figure out what needs to change so it displays as a dropdown.

    also figured out that i can add the class perPage to my stylesheet and control text display, but i can't seem to assign it a margin, or background so there must be a governing class that i'm missing.

    also, i'd love some clarification on this:
    Code:
            // perPage contains the number of items to list per page. 0 is used to indicate ALL
    
            if (isset($_GET['perPage'])) {
                $max_rows = (int) $_GET['perPage'];
                if ($max_rows < 0 or $max_rows >= 5000) {
                    $max_rows=MAX_DISPLAY_PRODUCTS_LISTING;
                    //This can be found in admin - config - maximum values.
                } elseif ($max_rows==0) {
                    $max_rows=5000;
                    //0 indicates ALL selected. So we use 5000 as a maximum
                }
    does this mean that by default the user sees all items in the category? if i changed it to
    Code:
                if ($max_rows < 9 or $max_rows >= 5000) {
    would the user initially see 9 items per page? i couldn't get it to work like that but had already set it to remember the count across categories, so i'm not sure if that is affecting it.
    :) emily
    http://store.inspiritcommon.com/
    ZC 1.3.8a on Godaddy :: EP 1.2.5.4 :: Adv Search 1.1 and a buncha other stuff

  8. #8
    Join Date
    Oct 2009
    Posts
    30
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Quote Originally Posted by limelites View Post
    This mod is great but it's giving me problems.
    The drop down select for what page to jump too only works for the bottom "productsListingBottomNumber" page select under the product listing. The "productsListingTopNumber" page select drop down before the product listing does not work.

    The Prev and Next buttons work on top and bottom fine.
    Problem is only the top drop down for which page to jump too.
    When you select a different page it stays on the same page.

    A great mod that would be super for my site because we have very large categories. Sadly I dont know enough php to spot the problem.
    I am using 1.3.9b. w/ no conflicting addons (already checked).
    php 4.4.7

    Thank you for any help!

    Here is Limelites code:
    PHP Code:
    <?php
    /**
     * split_page_results Class.
     *
     * @package classes
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: split_page_results.php 3041 2006-02-15 21:56:45Z wilt $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    /**
     * Split Page Result Class
     * 
     * An sql paging class, that allows for sql reslt to be shown over a number of pages using  simple navigation system
     * Overhaul scheduled for subsequent release
     *
     * @package classes
     */
    class splitPageResults extends base {
      var 
    $sql_query$number_of_rows$current_page_number$number_of_pages$number_of_rows_per_page$page_name;

      
    /* class constructor */
      
    function splitPageResults($query$max_rows$count_key '*'$page_holder 'page'$debug false) {
        global 
    $db;

        
    $this->sql_query $query;
        
    $this->page_name $page_holder;

        if (
    $debug) {
          echo 
    'original_query=' $query '<br /><br />';
        }
        if (isset(
    $_GET[$page_holder])) {
          
    $page $_GET[$page_holder];
        } elseif (isset(
    $_POST[$page_holder])) {
          
    $page $_POST[$page_holder];
        } else {
          
    $page '';
        }

        if (empty(
    $page) || !is_numeric($page)) $page 1;
        
    $this->current_page_number $page;

        
    $this->number_of_rows_per_page $max_rows;

        
    $pos_to strlen($this->sql_query);

        
    $query_lower strtolower($this->sql_query);
        
    $pos_from strpos($query_lower' from'0);

        
    $pos_group_by strpos($query_lower' group by'$pos_from);
        if ((
    $pos_group_by $pos_to) && ($pos_group_by != false)) $pos_to $pos_group_by;

        
    $pos_having strpos($query_lower' having'$pos_from);
        if ((
    $pos_having $pos_to) && ($pos_having != false)) $pos_to $pos_having;

        
    $pos_order_by strpos($query_lower' order by'$pos_from);
        if ((
    $pos_order_by $pos_to) && ($pos_order_by != false)) $pos_to $pos_order_by;

        if (
    strpos($query_lower'distinct') || strpos($query_lower'group by')) {
          
    $count_string 'distinct ' zen_db_input($count_key);
        } else {
          
    $count_string zen_db_input($count_key);
        }
        
    $count_query "select count(" $count_string ") as total " .
        
    substr($this->sql_query$pos_from, ($pos_to $pos_from));
        if (
    $debug) {
          echo 
    'count_query=' $count_query '<br /><br />';
        }
        
    $count $db->Execute($count_query);

        
    $this->number_of_rows $count->fields['total'];

        
    $this->number_of_pages ceil($this->number_of_rows $this->number_of_rows_per_page);

        if (
    $this->current_page_number $this->number_of_pages) {
          
    $this->current_page_number $this->number_of_pages;
        }

        
    $offset = ($this->number_of_rows_per_page * ($this->current_page_number 1));

        
    // fix offset error on some versions
        
    if ($offset 0) { $offset 0; }

        
    $this->sql_query .= " limit " $offset ", " $this->number_of_rows_per_page;
      }

      
    /* class functions */

      
    function display_links($max_page_links,$parameters '') {
          if ( 
    zen_not_null($parameters) && (substr($parameters, -1) != '&') ) $parameters .= '&';
          
    $num_pages ceil($this->number_of_rows $this->number_of_rows_per_page);
          
    $pages_array = array();
          for (
    $i=1$i<=$num_pages$i++) {
            
    $pages_array[] = array('id' => $i'text' => $i);
          }

          if (
    $num_pages 1) {
            
    $display_links zen_draw_form('pages'zen_href_link($_GET['main_page']),'get') . zen_draw_hidden_field('main_page'$_GET['main_page']);

            if (
    $this->current_page_number 1) {
              
    $display_links .= '<a href="' zen_href_link($_GET['main_page'], $parameters $this->page_name '=' . ($this->current_page_number 1), 'NONSSL') . '" class="splitPageLink">' PREVNEXT_BUTTON_PREV '</a>&nbsp;&nbsp;';
            } else {
              
    $display_links .= PREVNEXT_BUTTON_PREV '&nbsp;&nbsp;';
            }

        
    $display_links .= sprintf('Page %s of &nbsp;%d'zen_draw_pull_down_menu($this->page_name$pages_array$this->current_page_number'onChange="this.form.submit();"'), $num_pages);

            if ((
    $this->current_page_number $num_pages) && ($num_pages != 1)) {
              
    $display_links .= '&nbsp;&nbsp;<a href="' zen_href_link($_GET['main_page'], $parameters $this->page_name '=' . ($this->current_page_number 1), 'NONSSL') . '" class="splitPageLink">' PREVNEXT_BUTTON_NEXT '</a>';
            } else {
              
    $display_links .= '&nbsp;&nbsp;' PREVNEXT_BUTTON_NEXT;
            }

            if (
    $parameters != '') {
              if (
    substr($parameters, -1) == '&'$parameters substr($parameters0, -1);
              
    $pairs explode('&'$parameters);
              while (list(, 
    $pair) = each($pairs)) {
                list(
    $key,$value) = explode('='$pair);
                
    $display_links .= zen_draw_hidden_field(rawurldecode($key), rawurldecode($value));
              }
            }

            if (
    SID$display_links .= zen_draw_hidden_field(zen_session_name(), zen_session_id());

            
    $display_links .= '</form>';
          } else {
            
    $display_links sprintf(TEXT_RESULT_PAGE$num_pages$num_pages);
          }
          return 
    $display_links;
        }  
      
    // display number of total products found
      
    function display_count($text_output) {
        
    $to_num = ($this->number_of_rows_per_page $this->current_page_number);
        if (
    $to_num $this->number_of_rows$to_num $this->number_of_rows;

        
    $from_num = ($this->number_of_rows_per_page * ($this->current_page_number 1));

        if (
    $to_num == 0) {
          
    $from_num 0;
        } else {
          
    $from_num++;
        }

        if (
    $to_num <= 1) {
          
    // don't show count when 1
          
    return '';
        } else {
          return 
    sprintf($text_output$from_num$to_num$this->number_of_rows);
        }
      }
    }
    ?>

  9. #9
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    Can you post a link to your site please?

  10. #10
    Join Date
    Oct 2009
    Posts
    30
    Plugin Contributions
    0

    Default Re: Number of Products per page...

    :O Limelites just the person I was hoping to respond! Thanks.

    My test server:
    http://www.bearfreak.com/index.php?m...92_94&sort=20a

    You wouldn't also be able to tell me how you were able to get Filter Results by: price, date added ect. on all product listings?
    Attached Images Attached Images  

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 15 Oct 2013, 02:02 PM
  2. Reduce the number of products per page
    By Jhancy in forum General Questions
    Replies: 1
    Last Post: 1 Apr 2010, 08:56 AM
  3. increase number of products per page in admin
    By wolf99 in forum Customization from the Admin
    Replies: 3
    Last Post: 3 Nov 2009, 03:56 PM
  4. Number Of Products Per Page
    By godspeed128 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 Apr 2009, 04:43 AM
  5. Number of products per page
    By ryanb4614 in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 17 Mar 2008, 05:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg