Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Select Button on Number of Products


mynotes

Recommended Posts

Posted

Is there any adds on , plugins or tutorials that I can use to have a select button on index page which display the number of products display.

This button will control the number of products display like the sort order.

In the select button the options are 10, 20, 30, all.

When a choose the 10 the page will display 10 products or 20 if the 20 selected.

 

Thanks u

mynotes

Posted

None, that I know of. It sounds like a custom code job the products displayed on the products listing page are controlled in the maximum values in the admin panel. You could use a case statement in place of it.

Posted

@NodsDorf and @toyicebear

 

Thanks u very much for your reply

 

 

If some need this feature to be implemented on their store here the simple step I made.

 

Add this code on the top of product_listing.php module

//use the MAX DISPLAY SEARCH RESULTS as default value
$product_display_request = MAX_DISPLAY_SEARCH_RESULTS;

if(isset($_GET['product_display_request']) ){
   if($_GET['product_display_request'] === 'ALL'){
       $product_display_request = tep_db_num_rows(tep_db_query($listing_sql));
   }else{
       $product_display_request = $_GET['product_display_request'];
   }
}

 

Find and replace

 

//find this 
 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

//replace with this
$listing_split = new splitPageResults($listing_sql, $product_display_request, 'p.products_id');

 

Add this line which you want to add the select button options

<?php  
           $display_options = array(array('id' =>'10', 'text' => '10'),
                                     array('id' =>'20', 'text' => '20'),
                                     array('id' =>'30', 'text' => '30'),
                                     array('id' =>'ALL', 'text' => 'ALL')
                                     );
           $number_of_pages = $listing_split->display_total_products($product_display_request);

           if($number_of_pages > 0 ){
           echo  tep_draw_form('display_page', FILENAME_DEFAULT, 'get');
           echo tep_draw_hidden_field('cPath', $cPath);
           echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
           echo tep_draw_pull_down_menu('product_display_request', $display_options, (isset($HTTP_GET_VARS['product_display_request']) ? $HTTP_GET_VARS['product_display_request'] : ''), 'onchange="this.form.submit()" ');
           echo tep_hide_session_id() . '</form>';
           } //eof if number_of_pages
       ?>  

 

Hope this help

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...