A A A
Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
How to change category order on grid view
July 11, 2011
12:27 pm
Avatar
laurie390
Member
Members
Forum Posts: 169
Member Since:
August 11, 2010
sp_UserOfflineSmall Offline

Is there any way to order the categories on the grid view template so you can place them where you want?

July 11, 2011
9:18 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

This post actually belongs in the "support" forum.  (The "How to" forum is for finished instructions on how to do things -- not questions)

 

Anyway, the "grid-view" template doesn't actually show categories, but products themselves.

If you want to change the order of the product images on the grid-view page, then you just need to modify on or around line #34 of the "gridview.php" file where it says:

 

$wp_query->query('orderby=title&order=asc&cat='.$grid_cat_id.'&showposts='.$mkt_options['mkt_grid_thumbs_per_page'].'&paged='.$paged);

The "orderby" value can be changed to different values as described here:

http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

July 12, 2011
12:29 am
Avatar
laurie390
Member
Members
Forum Posts: 169
Member Since:
August 11, 2010
sp_UserOfflineSmall Offline

Thanks for answering.  I think I'm using the wrong term for the template.  What I want is to change the order of the categories images on the storefront homepage (that are in groups of 3).  Please advise.  Also feel free to move the post if necessary.

July 12, 2011
6:03 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

Yes, the storefront homepage template makes more sense.  It's the "frontdoor.php" file.

In this case, the line to change is on #14 where it says:

 

<?php     $my_query = new WP_Query('cat='.$mkt_options['product_cat'].'&showposts='.$mkt_options['mkt_newprods_storefront']); 

You can reference the page:

http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

for the parameters you can use to modify the "orderby" process.  This parameter is currently not shown in the link, so you'd need to add it in yourself.

 

I hope this helps.

July 13, 2011
3:09 pm
Avatar
laurie390
Member
Members
Forum Posts: 169
Member Since:
August 11, 2010
sp_UserOfflineSmall Offline

Not sure exactly how to add the "orderby" code, but even if I did this seems to be for posts as it uses parameters such as date which I can't change for a category.  Is there any way I can have control over the order and not be dependant on alphabetical order or other parameters I can't change?  I need to be able to group 3 categories of a certain type in the rows I choose.

July 13, 2011
6:52 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

If you're  asking if there is a built-in way that you can define the order of categories manually, I don't think there is.  Categories in Wordpress don't have a "sort order" like posts do.

A possible work around, is to rename the category name to begin with a number.

Sort of like this:

 

1)  Category name

2)  Category Name

3)  Category Name

 

Other than that, I don't know.  A coder could go in and hard code so that certain category IDs showed up in a certain order, but nothing I can offer in the way of that code.  Sorry.

July 14, 2011
1:31 pm
Avatar
laurie390
Member
Members
Forum Posts: 169
Member Since:
August 11, 2010
sp_UserOfflineSmall Offline

I found a way to do this that will not be visible to visitors.  The categories are alphabetically ordered by slug and not category name.  If you alphabetically preface the category slug names with:

 

a-category-name

b-category-name

c-category-name

 

you can make whatever order you want.

July 15, 2011
4:24 am
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

Great idea! Thanks for posting.

November 12, 2011
12:04 am
Avatar
Mo_Stro
Member
Members
Forum Posts: 33
Member Since:
October 22, 2011
sp_UserOfflineSmall Offline

I was so hopeful that prefacing the category slug with a/b/c... would change the order of display on the front page grid, but it didn't work for me. Any other ideas? Thank you!

November 15, 2011
10:20 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

Did you change the code, so that it sorted by category slug?

 

The idea you mentioned would have 2 elements.

 

1.  naming the category slugs appropriately with letters (a-category, b-category, c-category, etc.)

2. Editing the code, so that it sorted by category slug, instead of the default method.

November 18, 2011
10:06 pm
Avatar
sophistakidz
Member
Members
Forum Posts: 9
Member Since:
November 2, 2011
sp_UserOfflineSmall Offline

So, is the necessary code change still In frontdoor.php on line 14?
Not sure how to change code for sorted by slug as I didn't see that option spelled out in the codex link.
Help greatly appreciated.

November 21, 2011
10:45 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

Sorry, I may have provided bad information initiall on this one.

 

You may need to alter lines on or around #1681 through #1685 in the "functions.php" file where it says:

            // show all category children and grandchildren
            $productCats = get_categories('hide_empty=0&child_of='.$cat);
        } else {
            // show only direct category children
            $productCats = get_categories('hide_empty=0&parent='.$cat); 

Just add in the "orderby" parameter like this:

            // show all category children and grandchildren
            $productCats = get_categories('orderby=slug&hide_empty=0&child_of='.$cat);
        } else {
            // show only direct category children
            $productCats = get_categories('orderby=slug&hide_empty=0&parent='.$cat); 

 

Make sure to save the file.

 

This is the Wordpress Codex page for the "orderby" info.

http://codex.wordpress.org/Fun.....categories

 

I think that's better.

November 28, 2011
6:19 pm
Avatar
sophistakidz
Member
Members
Forum Posts: 9
Member Since:
November 2, 2011
sp_UserOfflineSmall Offline

Thanks Admin!

Works like a charm.

Left menu didn't change order, of coursre. Would order by parameters for it also be in functions.php?  I searched through much of the code but wasn't positve on exactly which lines pertained to left menu.

November 28, 2011
11:27 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

For the left menu area, just look in the "sidebar.php" file.

 

Just change the "orderby=" parameter to "slug" I expect.

April 29, 2013
10:18 pm
Avatar
Member
Members
Forum Posts: 40
Member Since:
December 13, 2008
sp_UserOfflineSmall Offline

Ah, on the sale page, drop down menu selected "GRID VIEW". Now is there a way to sort via price, or recently added? 

Using version 4.01. 

It's currently alphabetical, want to make it most recently added: http://www.rosewoodhouse.com/sale/

April 30, 2013
4:43 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

In the Grid View template, you'll need to change the "orderby" value.

Open up the file "gridview.php" for editing.

On line #34 where it says "orderby=title" you'll need to change that to order things by something other than title.

Here's a page that lists all methods of ordering:
http://codex.wordpress.org/Cla.....Parameters

for your case, maybe either "orderby=date" or even "orderby=modified".

Just make that small change, save, upload the file, and that should be all.

Forum Timezone: UTC 0

Most Users Ever Online: 213

Currently Online:
6 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

icy1: 2636

wreed06: 175

laurie390: 169

boutiqueelliette: 156

StitchTek Services, LLC: 144

yiorgos: 127

Member Stats:

Guest Posters: 457

Members: 2471

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 4078

Posts: 18978

Newest Members: teddy1, raycrean, tseibt55, aceman, peteryoung320@gmail.com, JdsCentral

Moderators: Market Admin: 5862

Administrators: Market Admin: 5862

Market takes ecommerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.