<p>If you reverse the relationship then you should be able to order the entries (i.e. add products to an entries field within the category, instead of adding categories to a categories field within the product).</p>

<p>So instead of grabbing the products using <code>relatedTo(category)</code>,</p>

<pre><code>{% set products = craft.entries.section('products').relatedTo(category) %}
{% for product in products %}...{% endfor %}
</code></pre>

<p>you would be able to grab the products directly from the products entries field in the category using <code>category.productsFieldHandle</code>, which should be returned in the order defined in the CP.</p>

<pre><code>{% set products = category.productsEntriesFieldHandle %}
{% for product in products %}...{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-02-18T19:47:29.517Z
Ahhh, this may actually work. Can't believe we didn't think about this. We'd have to do some work, but not nearly as bad as moving the whole thing to a structure. Thanks so much!
Vince
CC BY-SA 3.0
2015-02-18T19:07:37.660Z
2015-02-18T19:07:37.660Z
Douglas McDonald
<p>We have a client that has a good deal of products in one channel. We're categorizing each product entry with a pretty extensive category tree. The reason we didn't go with a structure is because many products needed to exist in multiple categories and a structure tree would get messy. </p>

<p>Everything is working great, but they now want to be able to re-order entries by category in the CP and we're sort of stuck. The new Category Sources plugin sort of gets us half way there but it doesn't allow you to reorder and save the order in any way.</p>

<p>Anyone run into this sort of issue? Thanks.</p>

CC BY-SA 3.0
2015-02-18T16:35:29.870Z
Where are you trying to reorder, in the CP or somewhere on the frontend in a list?
Aaron Berkowitz
CC BY-SA 3.0
2015-02-18T16:39:43.900Z
Ideally in the CP, but open to other ideas.
Vince
CC BY-SA 3.0
2015-02-18T17:07:50.937Z
What do you mean with "by category" for each category an entry is assigned to or is there one (main) category responsible for the listing?
carlcs
CC BY-SA 3.0
2015-02-18T17:22:59.497Z
Multiple categories responsible for the listings. We have a nav on the front end that is built from the category taxonomy, and then each sub category link pulls up a page that lists products attached to that category.
Vince
CC BY-SA 3.0
2015-02-18T17:32:55.693Z
So this means you have to sort an entry multiple times, within each category it is listed in.
carlcs
CC BY-SA 3.0
2015-02-18T17:38:52.657Z
Yes that's correct. It would be per category. Like I said, Brandons Category Sources plugin lists entries out per category but we would need something to go the extra step of allowing us to reorder those entry results and save that order somehow.
Vince
<control-panel><structure><category>
Reordering entries tied to categories?
# Reordering entries tied to categories?

(Asked by: username_0 on 2015-02-18)

We have a client that has a good deal of products in one channel. We're categorizing each product entry with a pretty extensive category tree. The reason we didn't go with a structure is because many products needed to exist in multiple categories and a structure tree would get messy.

Everything is working great, but they now want to be able to re-order entries by category in the CP and we're sort of stuck. The new Category Sources plugin sort of gets us half way there but it doesn't allow you to reorder and save the order in any way.

Anyone run into this sort of issue? Thanks.

**Tags:** control-panel, structure, category
> **Comments:**
> **username_1**: Where are you trying to reorder, in the CP or somewhere on the frontend in a list?  
> **username_0**: Ideally in the CP, but open to other ideas.  
> **username_2**: What do you mean with "by category" for each category an entry is assigned to or is there one (main) category responsible for the listing?  
> **username_0**: Multiple categories responsible for the listings. We have a nav on the front end that is built from the category taxonomy, and then each sub category link pulls up a page that lists products attached to that category.  
> **username_2**: So this means you have to sort an entry multiple times, within each category it is listed in.  
> **username_0**: Yes that's correct. It would be per category. Like I said, Brandons Category Sources plugin lists entries out per category but we would need something to go the extra step of allowing us to reorder those entry results and save that order somehow.  

---

## 1 answers

### Answer by username_3 on 2015-02-18. Score: 3 | Accepted answer

If you reverse the relationship then you should be able to order the entries (i.e. add products to an entries field within the category, instead of adding categories to a categories field within the product).
So instead of grabbing the products using relatedTo(category),
{% set products = craft.entries.section('products').relatedTo(category) %}
{% for product in products %}...{% endfor %}

you would be able to grab the products directly from the products entries field in the category using category.productsFieldHandle, which should be returned in the order defined in the CP.
{% set products = category.productsEntriesFieldHandle %}
{% for product in products %}...{% endfor %}

> **Comments:**
> **username_0**: Ahhh, this may actually work. Can't believe we didn't think about this. We'd have to do some work, but not nearly as bad as moving the whole thing to a structure. Thanks so much!  

---

