Product Categories are not showing up correctly

On my site there is a box in the header area that contains a drop down “Select category.” I’d like to have this draw from my global product categories. Also, the list on the left side of the page is supposed to draw from the global product categories as well, and it really doesn't, either. Steampunk is a product category, if that helps.

  • Adam Czajczyk
    • Support Gorilla

    Hello Dawn,

    I hope you're well today and thank you for your question!

    The forum topic that you linked to is from 2011 so it's way outdated for now. Just for future reference: it's always better to check post of the date and if it's too far in the past - ask here :slight_smile: That's because plugins got updated and what worked back in 2011 may (and most likely will not) work today.

    As for the issues.

    I started by reviewing all the sites of your network. I checked each and every store on all the sub-sites and I think that the "Found in the alley:" widget is working fine. It pulls all the categories that have any product assign so if there's a product in the category, the category is listed. The "Steampunk" category may be existing on a site "as a category" but it looks like there's no single product using it. The widget ignores empty categories, just like the default category widget of WordPress does. If you add a product to a "Steampunk" (or any currently "empty" category) and wait until Product Indexer indexes it, the category will show up on the list.

    The header drop-down box however does indeed pull categories from the main site only. I checked the site and it seem that this has been added via a modification of your theme.

    Please go to the "Network Admin -> Themes ->Editor" page and select the "Galaxy Theme" from the "Select theme to edit" drop-down list. Then click on a "header.php" in the right column.

    The source code of site header will load and you'll find this line inside:

    <li><?php the_widget( 'MarketPress_Categories_Widget', 'dropdown=1' ); ?></li>

    This loads the category widget but unfortunately it's the "Product Categories" widget instead of "Global Product Category List" widget. As a result it displays only categories local to your main site.

    To replace it with Global Categories you would want to replace aforementioned line with this one:

  • <?php the_widget( 'MarketPress_Global_Category_List_Widget', 'dropdown=1' ); ?>
  • Unfortunately, this widget doesn't support a "drop-down style" list so it would just list all categories on the page. Would that work for you? I believe we could add some CSS style to make it look a bit better but if I'm about to make any change like that, I'd need a confirmation from you. Basically, that category list would look a bit like a menu in header.

    Let me know about your decision please.

    Best regards,

  • Dawn
    • The Incredible Code Injector

    Adam Czajczyk Thanks for helping out with this! I think, based on the aesthetic I am going for, that I would rather just take the drop down widget out of the header altogether. Could you take the line of code out that adds that drop down, please? Thank you for your help. You can mark this resolved! :slight_smile:

  • Predrag Dubajic
    • Support

    Hi Dawn,

    Making changes to theme or plugin files via WP editor is not quite reliable and can easily cause fatal error because when making changes from browser can mess up formatting of the code.

    I would suggest accessing your WP installation via FTP or cPanel and navigate to /wp-content/themes/galaxy-theme/includes/ folder and edit header.php file with text editor like Sublime Text, Atom, Notepad++ or similar one.

    Remove line 84 from there:

    Save the changes and that should be it.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.