WooCommerce - excelling eCommerce
[resolved] Products in loop are randomly placed (2 posts)

  1. KeithAdv
    Posted 2 years ago #

    I'm building a site in WooCommerce 2.0.14 with Ayoshop 1.3, over Genesis 2.0.1.

    I have a problem that's driving me mad. Here's the executive summary: Under some conditions, the shortcode...

    [product_category category="somecategory"]

    ...returns a perfectly laid-out page, 12 items in four rows of three. At other times, it returns a page with fewer items--mostly three-item rows but also one- or two-item rows, leaving empty holes where products should be.

    I cannot for the life of me figure out what the trigger is. It doesn't seem to be the products, since the same products appear in the pages that lay out well and the ones that do not.

    It is not random, it simply depends on the category I choose. The results are always the same.

    Here is more information on the categories:

    My client is selling three types of jewelry. I've set up the parent and subcategories this way:


    At the same time, she is creating "Collections" of those products. Each collection contains a few items from each subcategory. So I also have these categories:

    Collection 1
    Collection 2

    Therefore, each item is flagged in three categories--Jewelry, type of jewelry, and type of collection.

    If I ask Ayoshop to list all Jewelry products or each of its subcategories, the pages always lay out perfectly.

    If I ask it to list a Collection, then that's when I always get random layouts.

    Can anyone point me in the right direction?

    By the way, my knowledge of PHP is extremely deficient--if I need to do some tinkering there, so please be patient! :-)

    Thank you.


  2. KeithAdv
    Posted 2 years ago #

    Solved it! I finally realized that while the product pages were automagically creating columns of three, when I was trying to use the category shortcode it was trying to create rows of four, which is the default.

    There wasn't enough room so it was just creating weird layouts and holes and such. Oddly enough, the products were in reverse alphabetical order, which is not the default. Anyways, I all had to do was pass the right parameters and everything was fine:

    [product_category category='somecategory' columns='3' order='asc']

    Rookie mistake. :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic