Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #525495

    Hello,

    I am trying to add lazy load functionality to my website made with Enfold, and I think I am close to make it work, however for now I keep getting repeated products as I scroll down.

    I believe this is due to the default pagination from woocommerce being replaced by ‘avia_pagination’ ,which only displays numbered page links, and doesn’t have a ‘next page’ link, so I am having to set my ‘Next Selector’ for the lazy load as being nav.pagination a:first, which I think is making the lazy load script keep loading the same products over and over.

    Could you help me replace the ‘avia_pagination’ on shop pages with WooCommerce’s default pagination? Or even just adding a ‘next page’ link/button to avia’s pagination.

    Best regards,
    José

    #525543

    Hey José!

    In the /enfold/config-woocommerce/config.php file try commenting out lines 691.

    add_action( 'woocommerce_after_shop_loop', 'avia_woocommerce_after_shop_loop', 10);
    

    Line 120.

    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); //remove woo pagination
    

    And 99 – 100.

    remove_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );
    remove_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 );
    

    That will remove the avia pagination and use the woocommerce default pagination.

    Cheers!
    Elliott

    • This reply was modified 9 years, 1 month ago by Elliott.
    #525582

    Hi Elliot,

    First of all thank you for the quick reply.

    I had already come across those lines in the code and thought something like that would work, but I am working with a child-theme so I can freely update my Enfold parent theme, and I tried copying that file over to the child-theme and do those changes there, but apparently I’m not able to override those config files like I normally do with child themes.

    Meanwhile I’ve also tried doing those changes straight to Enfold’s parent files, and it does indeed work that way, although it needed some minor changes.
    If I just comment out line 691, the ‘content container around the shop loop’ is no longer properly closed and as such, the sidebar gets moved to the bottom of the page, after the pagination, so I just commented out line 697 instead:
    if(isset($avia_config['overview'] )) echo avia_pagination('', 'nav');
    and I changed line 691 to
    add_action( 'woocommerce_after_shop_loop', 'avia_woocommerce_after_shop_loop', 11);
    so that the content container is closed after the inclusion of woocommerce’s default pagination.

    Now if you could help me find a way to do these changes for the child-theme only, this solution would be perfect for what I’m trying to achieve.

    Best regards,
    José

    #525654

    I have been fiddling around some more and I think I may have found a reasonable solution.

    In my child-theme functions.php I added:

    add_action( ‘woocommerce_pagination’, ‘woocommerce_pagination’, 9 );

    add_action( ‘woocommerce_after_shop_loop’, ‘woocommerce_pagination’, 9 ); //add woo pagination again

    I also tried adding:

    remove_action( ‘woocommerce_after_shop_loop’, ‘avia_woocommerce_after_shop_loop’, 10);
    add_action( ‘woocommerce_after_shop_loop’, ‘dz_woocommerce_after_shop_loop’, 10);

    function dz_woocommerce_after_shop_loop()
    {
    echo “</div></main>”; //end content
    }

    with the intention of removing avia_pagination which became redundant, while still properly closing the content container, but somehow the avia_woocommerce_after_shop_loop function is still being loaded and it was messing up my HTML structure (trying to close the content container twice), so I ended up removing that second block of code for now, and I think I’ll end up just hiding avia_pagination through CSS.

    Any suggestions to improve this solution will be much appreciated.

    EDIT:
    As I have been doing some further testing to this, I came across some weird behaviour: if I’m using woocommerce’s default ordering for my products, the lazy load seems to work properly, however when I’m sorting my products by “Most Recent” (which is what I have to use for the production site), some products are being loaded more than once. I am currently at a complete loss as to how I can troubleshoot this problem so, again, any insight on this will be greatly appreciated.

    EDIT 2:
    So this morning I gave it another go, tried changing my ‘Container Selector’ from .products to main.template-shop and suddenly I no longer have repeating products, so I think that fixed my latest and biggest problem. Now I’d just like to know if there is a way to prevent avia_pagination from being loaded for the shop pages in my child-theme, but I can live with having it hidden through CSS.

    Best regards,
    José

    • This reply was modified 9 years, 1 month ago by dZ_EB. Reason: found solution for issue from first edit
    #526276

    Hi!

    Not sure, but you should be able to hide it with this CSS.

    .woocommerce .pagination { display: none !important; }
    

    Cheers!
    Elliott

    #527072

    Yes, I had already implemented that CSS ‘fix’, I was just wondering if there was a ‘cleaner’ way of preventing avia_pagination from loading on my shop archives, and without ‘hacking’ the theme’s parent files.

    But if there isn’t, this solution should be good enough, thanks for the support anyway!

    EDIT: Ok now all of a sudden I am getting repeated products again with my lazy load. Now I’m even doubting if I ever had it fixed but just wasn’t spotting the duplicates. Once again I’m completely out of ideas on how to troubleshoot this, so any help in getting to the bottom of this would be hugely appreciated.

    Best regards,
    José

    • This reply was modified 9 years, 1 month ago by dZ_EB.
    #528785

    Hey!

    In the loop-index.php file you can try changing line 258 from this.

    	if(empty($avia_config['remove_pagination'] ))
    

    To this.

    	if(empty($avia_config['remove_pagination'] ) && !is_archive())
    

    But I think the CSS is better because it will be saved between updates.

    Regards,
    Elliott

    • This reply was modified 9 years, 1 month ago by Elliott.
    #532594

    Hi again,

    Thanks for your suggestions.
    I will go with your advice and stick to “hiding with CSS” as that seems to be the cleanest and most future-proof solution available.

    However, I am still struggling with the issue of having some products showing up more than once in my ‘shop’ page, although I think I have gathered some more information on the problem.
    It seems to be a problem with WooCommerce itself, as I have tried totally deactivating the infinite scroll functionality, and even switching themes between Enfold and Storefront (WooCommerce default theme) and I still get some products showing duplicates (on different pages).
    It seems to be related to the ‘sorting options’ in WooCommerce because I don’t see any duplicate products if I choose the ‘Default Sorting’ or if I ‘sort by average rating’, but I always get duplicate products if I ‘sort by popularity’ or ‘sort by newness’ / most recent (which is the sorting I want to use).

    I still have the development version available in case you want to do some tests on it, the credentials for access are still the ones provided on my OP.

    I’m going to try and reach Woothemes support as well, since I believe this problem to be with their plugin, but any help you might be able to provide on this will be very much appreciated.

    Best regards,
    José

    #533433

    Hey!

    I’m not sure. Yes, it would be best to contact Woocommerce support.

    Cheers!
    Elliott

    #533625

    Hi Elliot,

    I have opened a thread here , but from what I gathered, WooThemes usually only provides support to their paying costumers (which I am not) so I don’t have high hopes of getting an answer there.

    The weirdest thing is I have previosuly developed another similar site with Enfold, also using the ‘sorting by newness’ option and I’ve never encountered any repeating products.
    I recently even went back to that site and managed to implement the infinite scroll feature I had been discussing in this post and it is working without a problem there ( http://www.creativemary.com.pt ), which leads me to believe something went quite wrong with just this site, but I am not being able to figure out what, or how to fix it.

    The last thing I want is having to rebuild the entire site just because of this weird bug, but I am reaching a point where I’m not seeing any other solution, so if anyone can help me figure out what’s wrong here I’ll be forever grateful.

    Best regards,
    José Almeida

    #534938

    Hi!

    you have posted to general WordPress forum instead of WooCommerce support, which you can find here.

    Regards,
    Andy

    #535058

    Hi Andy,

    Yes I am aware of that, however they only allow paying costumers to submit tickets, and since I haven’t purchased anything from WooThemes until now, I am unable to do so.

    Regards,

    José

    #536751

    Hey!

    It would probably be best to hire a freelancer to help integrate that plugin then as it’s outside the scope of our support.

    Best regards,
    Elliott

    • This reply was modified 9 years ago by Elliott.
Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.