Orchard CMS Lists - how to replicate using Taxonomies - orchardcms

I'm new to Orchard but from various blog posts and SO answers it seems that Lists would help me achieve what I want. Unfortunately it seems that Lists have now been deprecated.
The documentation at http://docs.orchardproject.net/Documentation/Creating-lists suggests using Taxonomies instead. Is it possible to achieve the functionality of a List using Taxonomies?

You can use taxonomies to produce a list of content items. Create your taxonomy, add some items to it, attach the taxonomy field to your content type, and select the taxonomy you want to be displayed in the content type settings. Create a content item with a taxonomy selected then go to the url:
/taxonomy-name/*selected-taxonomy-item*
and it should display a list of all items with that taxonomy selected.
However, lists were deprecated and replaced by Projections, I would recommend using these. They are part of core and can be enabled from the backend. You can then create a query with your projection uses. This query determines what items you want displaying. It is pretty nice and simple, just need to play around with it. Let me know if you need more details about it, or probably just googling Orchard Projections will produce some useful links if you need to do some more complex things with it

Related

WebPart cleanly render a list of n items

I am attempting to create a WebPart in Kentico 11 that supports handling an n-length list of items. I found that creating a WebPart with property fields is pretty straightforward in Kentico, but I am having trouble finding documentation on how to best set up a WebPart that can lookup & output multiple model objects.
I've tried the following approach, but it has some drawbacks that I'm not entirely comfortable with:
Set up a Container page type to place instances of data objects inside. I restricted it to ensure that only my custom Page Type data object is available as a child of it.
Place a Pages DataSource in the template zone and direct it to the Container page.
Hook up a Repeater element to it and apply a transformation & content before+after to the Repeater.
While this works, it feels a little cludgey. Content editors have to be wise enough to know how to set up DataSources & Repeaters, plus how to bind them together and apply transforms, and additionally remember to fill in the content before and content after fields with the appropriate wrapping HTML markup.
This is not something that I expect a content editor should need to remember.
Is there a cleaner way to put lists of items inside of a template zone without needing to drag & configure a datasource and container page?
I did not see any way to set up a Page Type field in such a way that it would essentially model a one-to-many relationship with another Page Type. Did I miss something there? If I could do that, then I could write a transformation to handle the wrapping HTML markup, and the looping of children. Haven't been able to find a way to make this work though.
The best way to accomplish what you are asking is with a custom form control. In your case, the form control should be able to let users select multiple items.
You can actually use 'Sortable multiple object selector' marketplace item for this purpose. This form control will enable you to select multiple items based on a certain type (that you need to configure in code) and editors would simply use the select dialog to choose the items.

Retrieving term ids for taxonomy field

I'm running into slow performance related to select N+1 issues when accessing the taxonomy terms associated with content items of a custom content type.
I've worked around issues like this in the past by getting all the related content ids up front and so I can use the ContentManager's GetMany method to get them all in one shot. For example, this has worked well for the MediaLibraryPickerField as I can easily get at the media content ids using the Ids property on the field. Here's an example similar to what I've done: Eager loading a field
I'd like to use a similar approach for getting taxonomy terms but I can't figure out how to get the term ids for a Taxonomy field on my content item. It seems that I can only access the lazy loaded term part which results in a select N+1 as they are retrieved for each content item.
Is there a way to get just the term ids for a taxonomy field without retrieving the whole term? I've spent some time digging around in the Taxonomy module source but I'm not finding any way to do it.
Any suggestions?
Try to inject IRepository<TermContentItem>. You should then be able to query over that, going beyond what the service offers natively.

Extending Orchard Search and Indexing

We need to provide search options for users to find content based on specific field values.
We're developing a Training Course module for a client but the standard search looks for the text in any indexed field. We want to allow users to find courses based on searches against specific fields (i.e. Course Type, Location, Price, Date).
We've extended the search to check against specific fields but can't work out how to get the URL parameters passed by the Search form as a GET.
Where does Orchard put URL parameters?
Also, are we missing something, is there a way that Orchard already supports this that we haven't realized?
I would suggest you to copy part of the Search module, more specifically the Controller and the View and then modify it to suit your specific needs. I see you are actually modifying the original module, but this might be a problem on the long term, for instance if we start updating the module you might either lose you changes or have to reapply them to the code base. In the end you will target a MySiteName.Search module. And you can also add custom routes, custom settings.
On a side note the Search API is really powerful and you can even use it to do faceted search, or search on inherited taxonomy terms, tags, full text, ranges, ... Having your own controller code will let you use all of these features easily.

In Orchard CMS, is there a way to display a list based on tags of a content type?

I created a custom content type "books" and I'm attaching tags to each item (i.e. "Featured", "New", "Children's", "Adults").
I'd like to create lists of books to display based on their tag. For example, I'd like a "Featured" list that displays all the books that have been tagged "Featured", and a "Children's Books" list that displays all the books that have been tagged "Children's".
Is there a simple way to do this (for a visual UI person who's blood pressure rises every time she has to go into the code?) :)
Taxonomies are the best way to do this. Well, tags can do that too but taxonomies are much richer.
So simplest way: yoursite/tags/featured will display all contents tagged with "featured". A little more elaborate way: taxonomies.

Sorting and filtering lists in Orchard

I've followed the topic 'Creating lists' in the Orchard Project docs but I'm struggling to think how best to implement my preferred sort order and direction in the resulting rendering of Summary display of the content items.
For example, if I create a Book Reviews list as in the example, and I then add a Published Date field following the topic 'Creating a custom field type' then how would I alter my theme or the views in the Module to display (and possibly also filter) the content items by that custom field.
The 'Creating lists' topic discusses how widgets can implement sorting and filtering, but not how the main content type can do so.
p.s. if you know the answer to this you're probably well on the way to being able to implement an Event Calendar Module as suggested by the Orchard Module Challenge; why not have a go and stand a chance to win a TV / XBox / KINECT!
Research to date:
I've noticed that ordering in a Container part is implemented using the following property
OrderByProperty
(Orchard.Core.Containers.Models.ContainerPartRecord)
In Orchard 1.4 you can Projection Module to achieve that.
In previous versions, I used LINQ queries to do the sorting on the custom field.

Resources