Changing Number of Pages in Product Pagination

This topic has 7 replies, 3 voices, and was last updated 2 weeks, 1 days ago ago by Andrew Mitchell

  • Avatar: PanosN
    PanosN
    Participant
    April 30, 2024 at 14:35

    Currently, only a limited number of pages are displayed in the navigation.

    I would like to know if there is a way to adjust the settings to show a higher number of pages in the product pagination. This would allow users to easily navigate through a large product catalog.

    Thank you for your time and assistance.

    Files is visible for topic creator and
    support staff only.
    6 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    May 1, 2024 at 04:24

    Hi @PanosN,

    There is no settings to change the number of pages in the pagination. Please take a look at this file: /wp-content/plugins/et-core-plugin/app/controllers/elementor/general/product-grid.php line 3242

    – Change:

    
    'end_size'  => 2,
    'mid_size'  => 2,
    

    – To:

    
    'end_size'  => 12,
    'mid_size'  => 12,
    

    Hope it helps!

    Avatar: PanosN
    PanosN
    Participant
    May 1, 2024 at 14:16

    I changed the file according to your advice and flushed all caches.
    It doesn’t seem to achieve the desired effect, and I’m not sure if there is any optical or functional change to the pagination.

    Avatar: Justin
    Luca Rossi
    Support staff
    May 1, 2024 at 14:27

    Hi @PanosN,

    Can you please try adding the following code under functions.php file locates in your child theme?

    
    function et_woocommerce_pagination() {
    		
    		$args = array(
    			'total'   => wc_get_loop_prop( 'total_pages' ),
    			'current' => wc_get_loop_prop( 'current_page' ),
    			'base'    => esc_url_raw( add_query_arg( 'product-page', '%#%', false ) ),
    			'format'  => '?product-page=%#%',
    		);
    		
    		// @todo make push ajax loaded styles/scripts in footer and prevent load next times
    		etheme_enqueue_style( 'pagination', isset($_GET['et_ajax']));
    		
    		$format = isset( $format ) ? $format : '';
    		$base   = esc_url_raw( add_query_arg( 'product-page', '%#%', false ) );
    		
    		if ( ! wc_get_loop_prop( 'is_shortcode' ) || wc_get_loop_prop('etheme_elementor_product_widget') ) {
    			$format = '';
    			$base   = esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', wp_specialchars_decode( get_pagenum_link( 999999999 ) ) ) ) );
    		}
    		
    		$total   = isset( $total ) ? $total : wc_get_loop_prop( 'total_pages' );
    		$current = isset( $current ) ? $current : wc_get_loop_prop( 'current_page' );
    
    //		$et_per_page  = ( isset( $_REQUEST['et_per_page'] ) ) ? $_REQUEST['et_per_page'] : etheme_get_option( 'products_per_page', 12 );
    		$selected_val = ( isset( $_GET['et_per_page'] ) ) ? $_GET['et_per_page'] : false;
    
    		$is_rtl = is_rtl();
    		
    		return array(
    			'base'      => $base,
    			'format'    => $format,
    			'add_args'  => ( ( ! wc_get_loop_prop( 'is_shortcode' ) && $selected_val ) ? array( 'et_per_page' => $selected_val ) : false ),
    			'current'   => max( 1, $current ),
    			'total'     => $total,
    			'prev_text' => '<i class="et-icon et-'.($is_rtl ? 'right' : 'left').'-arrow"><span class="screen-reader-text hidden">'.esc_html__('prev', 'xstore').'</span></i>',
    			'next_text' => '<i class="et-icon et-'.($is_rtl ? 'left' : 'right').'-arrow"><span class="screen-reader-text hidden">'.esc_html__('next', 'xstore').'</span></i>',
    			'type'      => 'list',
    			'end_size'  => 12,
    			'mid_size'  => 12,
    		);
    	}
    

    Let us know how it goes!

    Avatar: PanosN
    PanosN
    Participant
    May 2, 2024 at 09:06

    This works perfectly!

    Thank you very much for your kind help!

    Avatar: Justin
    Luca Rossi
    Support staff
    May 2, 2024 at 09:17

    Glad we’re able to help you!

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    May 2, 2024 at 09:28

    Dear PanosN,

    In the spirit of gratitude, we want to express our appreciation for your trust in our products. As a valued customer, your experience matters greatly. Would you consider sharing it by giving our theme a deserving 5-star rating on ThemeForest?

    Click here to share your thoughts: https://themeforest.net/downloads

    Being part of our community means a lot, and your feedback contributes immensely.

    Best Regards,
    The 8Theme Team

  • Viewing 7 results - 1 through 7 (of 7 total)

The issue related to '‘Changing Number of Pages in Product Pagination’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.