duplicate product listing with pagination

Good Day,

We are using pagination under Product List Settings, so that product_category listings will paginate. It seems to work well, however some products appearing on page one also will appear on page two.

Any suggestions for troubleshooting would be muchly appreciated!

Thank you.

  • Michelle Shull

    Hi there, shelms1!

    1. My first guess would be a theme conflict. Have you tried switching to a default theme and seeing if that fixes it?

    2. My next guess would be a caching plugin making things wonky, do you have one, like W3 Total Cache, or WP Super Cache, installed?

    3. If it's neither of those, I'd like to take a closer look at your settings, If this is ok, just grant me temporary admin access to

    your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings from

    the following path and reply on this thread after granting it?

    Admin -> WPMU DEV -> Support -> Support Access Tab

    If you have not installed WPMU DEV Dashboard plugin yet, kindly do that here :

    https://premium.wpmudev.org/project/wpmu-dev-dashboard/ and then allow access as per the above process.

    Thanks!

  • shelms1

    Hello again.
    It seems the issue is intermittant, as we cannot duplicate the identical issue of a few hours ago on the live site now, in spite of the fact there were no changes made whatsoever. We shall attempt to carefully document any duplicity of product (and of course the attendant possible missing product) in the paginated category listings in the future.

    Thanks again for your quick response to this matter.

  • shelms1

    Hi Folks,

    Thanks for checking in a while back, we've been distracted by other matters.

    We are still pulling our hairs out trying to narrow down the error causing pagination in product lists to behave somewhat erratically.

    On our dev server, we have only marketpress plugin activated, and a child theme.

    In store settings, setting "paginate products" to "No" did not turn off pagination until I switched to the parent theme, where everything seemed alright. Switching back to the child again, pagination was active again, even though still switched off in store settings.

    Does this mean there is a problem with our child theme's functions file?

    Thanks again for your help.

  • shelms1

    Hi Michelle,

    Thanks so much for your suggestions, we have found the error!

    After renaming the functions.php file to elliminate that potential source of problem, we still had the issue in our child theme. That pointed to templates, and sure enough mp_category.php was misconfigured.

    It used mp_list_products(true, true, 0, 20, 'sales', 'DESC'); plus, it contained the theme's navigation. So, of course store-settings --> presentation --> Paginate Products would have no effect and also caused both mp_products_nav and the theme's navigation to be present and conflict, causing unpredicatable behavior.

    mp_category.php (a copy of category.php) is now configured to call content-product-list.php in which entry-content contains:

    mp_product_image( true, 'list' );
    the_excerpt();
    mp_product_meta( true, 'single' );

    Only the theme pagination is involved. It is located in mp_category.php.

    Is it possible to use the mp_products_nav function instead of the parent theme's navigation? That would be the icing on the cake.

    We tried mp_products_nav() and get the error "Missing argument 2"

    Thanks very much, once again!

  • shelms1

    Thank you, Michelle,

    We use category archive pages to display lists of products, especially if there are hundreds of products, and have marketpress setting take care of the pagination "automagically".

    We have some pages set up with mp_list_products so that the URL is more SEO-friendly:

    http://ourdomain.com/our-category/
    is MUCH shorter than
    http://ourdomain.com/store/products/category/our-category/

    It should be noted that pagination for pages utilizing mp_list_products shortcode necessarily requires manually making all the pages for pagination. This is well documented and easily found in a search.

    In order to have NO pagination on such pages --to have the shortcode overide the marketpress settings-- so we need not make more pages manually, it is not sufficient to have, for example:

    [mp_list_products paginate="false" order_by="sales" order="DESC" category="category-name"]

    The above shortcode will still paginate acording to store-settings --> presentation --> Paginate Products, and #page=2 will have the same products as the first page --assuming more products exist in the category than is set to be on one page.

    The ONLY way we can successfully overide the marketpress settings with mp_list_products under these circumstances, is to have something like:

    [mp_list_products paginate="true" per_page="-1" order_by="sales" order="DESC" category="category-name"]

    Hope this information is clear and helpful.

  • Tyler Postle

    Hey Shelms,

    Hope you're doing well today and thanks for your question!

    In order to have NO pagination on such pages --to have the shortcode overide the marketpress settings-- so we need not make more pages manually, it is not sufficient to have, for example:

    [mp_list_products paginate="false" order_by="sales" order="DESC" category="category-name"]

    Instead of 'false' here for "paginate" you will want to put a "0". That should take away the pagination :slight_smile:

    I am seeing that the main products list page seems to always have it's paignation no matter what and still appears to be listening to the limit set in the presentation settings even though pagination is set to no, I'll mark that as a bug so the developer can take a closer look and get that resolved :slight_smile: thanks for bring it up!

    I'm still unable to reproduce your duplicating product issue, is that the only other issue you are experiencing here? Sorry, just trying to catch up on this thread!

    Look forward to hearing back Shelms :slight_smile:

    All the best,
    Tyler

  • shelms1

    Hi Tyler,

    Thanks for following up, and the correction to our shortcode! We must have missed that in the documentation... apologies. Will try that on the live site today.

    On the "live" site, I believe we no longer have problems with dupliction of products across product-category pages since the mp_product.php and content-product-list.php have been corrected as per the above posts. I hope the templates to github https://github.com/skip4mylu/marketpress-catchbox-templates were suitable for your viewing and the code was found to be in good order.

    The problem, I believe, was our using a shortcode inside mp_category.php that contained settings regarding pagination and number of products per page which would then "confuse" marketpress behavior. (I can post that template file to github as well, if you wish to see it.)

    However on the "dev" site, with only twentyten theme and marketpress plugin active, store/products/ paginates according to mp settings, but the mp_product_nav link on page one does not work, so we cannot see the following pages. That may be deserving of a separate topic that is doesn't get lost in here.

    Best,
    shelms1

  • Jonathan

    Hey @shelms1,

    Please try the following fix...

    Open up wp-content/plugins/marketpress/marketpress.php and go to line 1902 - the code you'll be replacing looks like this:

    if ( isset($_POST['per_page']) ) {
    	$args['per_page'] = intval($_POST['per_page']);
    }

    Please replace with the following:

    if ( isset($_POST['per_page']) ) {
    	$args['per_page'] = intval($_POST['per_page']);
    	$args['paginate'] = true;
    }

    and let us know if that fixes things for you :slight_smile:

  • shelms1

    Hi Jonathan,

    Thanks for your reply and code change.
    This change did not have an effect on store/products/ pagination, so I assume this a fix for the shortcode.

    In our local development environment, using both theme twentyten, and our child of catchbox with current marketpress only, it seems to work very well!

    We no longer need per_page="-1" in the shortcode [mp_list_products paginate="false" per_page="-1" order_by="title" order="DESC" category="mycategory"] in order to avoid pagination.

    Category archive pages paginate according to mp_settings, and most surprisingly, pages with shortcode paginate!

    I was always under the impression that pages with the shortcode had to made manually. Such as:

    [mp_list_products paginate="true" page="1" per_page="10" order_by="price" order="DESC" category="downloads"]
    [mp_list_products paginate="true" page="2" per_page="10" order_by="price" order="DESC" category="downloads"]

    It seems this is no longer the case, as [mp_list_products paginate="true" per_page="10" order_by="title" order="DESC" category="mycategory"] gives ten products, no duplication, links that work and marketpress is creating page 2, 3, etc.

    Thank you Jonathan for this elegant solutution. Now we can try it "Live"!

    Best,
    shelms1

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.