Select number of items on Taxonomy term page

Aug 19, 2011 at 5:16 PM

How do I select the number of items that appear on the taxonomy term page? For example, I want to show as many as possible, so I'd like to set this number pretty high. Much higher than the 10 that is the default for the site's other list pages.

Thanks

Coordinator
Aug 19, 2011 at 5:30 PM

Right now this is a site wide setting, in the dashboard.

Aug 19, 2011 at 7:25 PM
sebastienros wrote:

Right now this is a site wide setting, in the dashboard.

I see how it's done in the source code. I'm going to have to compile my own version of the Taxonomies module since I have a number of features needed that aren't supported out of the box. If there's anything reusable, I'll contribute the code for others.

Coordinator
Aug 19, 2011 at 7:42 PM

Just give me a list of whatever you'd like to see, at least I can tell you if it's something I also intended to do, or if it could be done differently.

Are you using the dev branch to look at the source code ? If not, then you should.

Aug 19, 2011 at 10:42 PM
sebastienros wrote:

Just give me a list of whatever you'd like to see, at least I can tell you if it's something I also intended to do, or if it could be done differently.

Are you using the dev branch to look at the source code ? If not, then you should.

Currently I'm trying to have a page show all content tagged with a specific taxonomy term. The built-in behavior is a good start, but I need to customize where the content is shown, based on content type. The main way I could solve this would be a widget that showed a custom number of content items, filterable by taxonomy term/value and content type. An example would be: last five blog posts with the State term of California. I could then place several of these on a page for different content types in different zones.

To work around this, I have a successful proof of concept that uses the default behavior to list items, but to then uses CSS and JavaScript to hide some content and move others to other parts of the page. It's not pretty, but it works. I'm actually overriding the rendering behavior for some types so that it shows an empty div with several data- HTML5 attributes so I can get at the data. The limitation here is that I need to pull back quite a few content items to ensure I have at least some of each type (blog post, video, story, etc) to fill the different regions of the page.

In the same vein, a method of arbitrarily querying content data from a script that returned data in JSON format would be very useful.

Finally, I have compiled the dev branch and looked at it. The new widget is almost exactly what I need, except for the lack of content type filtering. Also, I'm going to have to use the widget alternates module to change tweak the exact rendering.

Thanks for listening. This is a real-world need that I'm trying to solve for a client. I can include a mock-up of the page I'm trying to build if you think it would help.

Coordinator
Aug 19, 2011 at 10:45 PM

I can add the Content Type filtering to the widget if you want. Should be easy to do as I did it for Recent Content module and also for Voting.

Aug 19, 2011 at 11:43 PM
sebastienros wrote:

I can add the Content Type filtering to the widget if you want. Should be easy to do as I did it for Recent Content module and also for Voting.

That would be fantastic. Also, I thought of one other thing. There doesn't seem to be a way to use the Import/Export module to import content items and specify the taxonomy values for the fields.

Coordinator
Aug 19, 2011 at 11:46 PM

You need to use the dev branch version for that

Aug 20, 2011 at 12:40 AM
sebastienros wrote:

You need to use the dev branch version for that

Will do.

Coordinator
Aug 21, 2011 at 10:59 PM

Done. I was not able to try it though because one on my other modules are crashing my dev website. It should work though, as I took most of the code from the Voting module. Tell me if you find a bug.

PS: You will have to reset your app, or to add a ContentType column to TermWidgetRecord table.

Aug 23, 2011 at 3:41 PM

Thanks for the work. I have run into a few problems with the module.

Issue #1

When choosing to add a Term Widget I get the following exception:

Compiler Error Message: CS1928: 'System.Web.Mvc.HtmlHelper<Contrib.Taxonomies.ViewModels.TermWidgetViewModel>' does not contain a definition for 'SelectOption' and the best extension method overload 'Orchard.Mvc.Html.HtmlHelperExtensions.SelectOption<T>(System.Web.Mvc.HtmlHelper, T, T, string)' has some invalid arguments

Line 45: @Html.LabelFor(m => m.Part.ContentType, T("Content Type"))
Line 46: <select id="@Html.FieldIdFor(m => m.Part.ContentType)" name="@Html.FieldNameFor(m => m.Part.ContentType)">
Line 47: @Html.SelectOption(Model.Part.ContentType, String.Empty, T("- Any -"))
Line 48: @foreach(var contentType in Model.ContentTypeNames) {
Line 49: @Html.SelectOption(Model.Part.ContentType, contentType, contentType)

 

Issue #2

The file: /Views/EditorTemplates/Parts/Taxonomies.Taxonomy.Fields.cshtml is missing. The project expects it to be there, so I'm not sure if it wasn't checked in or should be removed from the project.

 

Issues #3

I'm also having some problems getting the module to run in an instance where I'm not using the full Orchard source code. I'm receiving primary key violation errors when trying to add a new taxonomy.

Error: "A duplicate value cannot be inserted into a unique index. [ Table name = Routable_RoutePartRecord,Constraint name = PK__Routable_RoutePartRecord__000000000000012F ]"

Coordinator
Aug 23, 2011 at 4:19 PM

I am also getting a primary key violation exception ... So there must be a real problem here, I 'll check that. Thanks

Aug 24, 2011 at 1:07 AM
Edited Aug 24, 2011 at 1:08 AM

Dumb question, but how do install the dev branch.

  I tried:

  • delete Orchard.Module.Contrib.Taxonomies.0.9 in \Orchard.Source.1.2.41\src\packages
  • add dev branch code, following similar structure
  • reset app
  • under installed modules , it still says 0.9 and nothing seems to have changed
Sep 1, 2011 at 7:56 PM

Sebastien,

Is there any chance you could create a nuget package from the dev branch and post it somewhere? When I try to create it, I get an exception from the packager:

Exception Details: System.ArgumentNullException: Value cannot be null.Parameter name: context

Stack Trace:
[ArgumentNullException: Value cannot be null.Parameter name: context]   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Service service, IEnumerable`1 parameters)   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context,IEnumerable`1 parameters)   at Orchard.Commands.CommandHostAgent.CreateStandaloneEnvironment(String tenant) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Commands\CommandHostAgent.cs:line 196   at Orchard.Commands.CommandHostAgent.RunCommand(TextReader input, TextWriteroutput, String tenant, String[] args, Dictionary`2 switches) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Commands\CommandHostAgent.cs:line 63

Otherwise, is there a way to install a module from the source alone?

Thanks a lot.

Sep 5, 2011 at 6:45 PM
Citezein wrote:

Thanks for the work. I have run into a few problems with the module.

Issues #3

I'm also having some problems getting the module to run in an instance where I'm not using the full Orchard source code. I'm receiving primary key violation errors when trying to add a new taxonomy.

Error: "A duplicate value cannot be inserted into a unique index. [ Table name = Routable_RoutePartRecord,Constraint name = PK__Routable_RoutePartRecord__000000000000012F ]"

The solution to this problem is to delete the extra properties in the TaxonomyPartRecord class. Only TermTypeName should exist.

Coordinator
Oct 13, 2011 at 5:57 PM

I have fixed this on the dev branch