Show list items on page - orchardcms

I have a menu item called: Offer that has sub items that link to pages:
Offer Category A
Offer Category B
Offer Category C
I also have a content type called Offer Item. Content items of this type have tags:
offer-a
offer-b
offer-c
So far, in order to display a list of Offer Items X on Offer Category X page I did:
create a query for each category (query-offer-a, query-offer-b, query-offer-c) based on tags
create a layer for each category page with match condition, for instance:
url '~/category-a'
create a widget for each category, where widget-x is visible only on layer-x. I've also set For Query parameter to query-offer-x
These are preety many steps to do a simple thing. To display list items on the page I have to:
Create a layer with match url confition
Create a query
Add a widget to a layer and link it to the query
Is there a easier way?

Related

Need to display list of product categories

I'm exploring Nwazet.Commerce module and I've managed to replicate most of what http://nwazet.com/ does ... However I'm struggling with projection widget that displays product categorization (on nwazet.com page one to the right that has Automation, Cables & Connections, ...).
I assume these are terms for a taxonomy? How should I set projection query to get this list of terms from a single taxonomy? When I tried "Content with type CategoryTerm" it lists not just terms but also products that have them.
Thanks for any pointers.
You got it exactly right: the categories are taxonomy terms. The problem is very likely that you are displaying the terms in the projection query layout with the full detail view, where the term will display the list of items under itself. Instead, you could use a summary or a custom display type in your layout, and customize the template alternate for that display type. Alternatively, and this is how the site is set-up, you can switch to property mode for the layout and just keep it to a simple display text property with "link to the item" checked.
Some additional info: for perf, I add an eager fetch filter on Autoroute and Title part records.

Including categories within expression engine

I have created a list view of news articles within Expression Engine. A user can click through on each news article to read the detail. For each entry within the list view I would like to show its associated categories - ie the categories that it has been assigned to.
I am not quite sure how to combine this category information into my channel entries loop.
So within each returned entry in the loop, you want to display the category assignments? If that's the case, just use the categories variable pair within your loop.

Orchard cms,create a list of selected content on admin menu

I am trying to make a list of a specific content type by making a query and show the list on the admin menu. I created a projection to associate the query and added to the admin menu. But when I click on the menu created, it navigates to the edit mode of the projection definition but I was expecting a list. Can anybody help how to create a list of selected content type which can access from admin menu?
Regards
George
There are examples of code adding custom lists of content items in Vandelay.Industries. The repo for Vandelay can be found here.
The way it works is that it actually just creates admin menu items that point to the existing Admin controller in the Content feature that displays lists of content items. That controller is already equipped for filtering items by content type.
item.Action("List", "Admin",
new RouteValueDictionary {
{"area", "Contents"},
{"model.Id", definition.Name}
})
You can find the controller in question in the Orchard repo, if you want to write your own version for your own specific purposes (but again, you don't need to if you just want to display items filtered by type in the admin in a way consistent with the rest of the dashboard).
The relevant code is this:
_contentManager.Query(versionOptions, model.TypeName);

Checkbox list in Orchard CMS

Is there any module in Orchard CMS that I can install to get a checkbox list? I checked in the gallery but could not find one. If there is none, is there is a workaround this?
I want to associate a product item with multiple categories (fixed set of categories).
Thanks!
EDIT :
I checked the Taxonomy module as per the suggestion. Now, I want to access the terms in the view. I have seen some posts where they can access it using
(IEnumerable<Contrib.Taxonomies.Models.TermPart>)Model.Terms
Using shape tracing, I am trying to figure out how to access the terms. My model doesn't have any terms field! I can access my custom type (Project) which has 'ProjectCategory' as Taxonomy Field. But there is no mean to view/select terms from there.
See attached screenshots.
Any idea?
I don't think there is a module specifically for checkbox lists, but it sounds like the Taxonomies module might be what you're looking for. You can add a Taxonomy field to your product content type, and define a Taxonomy for that field that contains all your categories.
Once you do that the editor page for your products will have a checkbox list (or radio select if you allow only one in the taxonomy field's settings) for the "Categories" taxonomy.
I managed to access the terms the following way :
IEnumerable<TermPart> assignedTerms = _taxonomyService.GetTermsForContentItem(contentItemId, "NameOfTaxonomy");

Is it possible to extend Categories in ExpressionEngine 2

we are currently weighing up what cms to use with Expression Engine 2 being a strong candidate.
We would like to create a bilingual site where the categories would need to be in both languages.
I see that a category has the following fields
Category Name,
Url Title,
Description,
Image url,
We would also like to add "Category Name French" and "Description French" to each category and have them editable via the control panel form.
Does any one know if this is possible?
Any pointers much appreciated
Beyond the standard ExpressionEngine Category Fields — Category Name, Category URL Title, Category Description, Category Image URL — you can add as many additional Custom Category Fields as you see necessary.
You can add/edit custom category fields in the ExpressionEngine Control Panel at:
Admin > Channel Administration > Categories > Manage Category Fields
This would allow you to add your "Category Name French" and "Description French" fields to each category and have them editable in the Control Panel.
.
I use category parents to group the individual categories, you can then easily output the required categories based on language, either via the parameter "category_group". You can then use all the default category fields and custom ones.
Basically:
English
-- category 1 (in English)
-- category 2 (in English)
-- category 3 (in English)
French
-- category 1 (in French)
-- category 2 (in French)
-- category 3 (in French)
I believe the accepted best practice for multi-lingual sites in EE2 is to use the commercial add-on Transcribe. http://eeharbor.com/transcribe
The easiest solution around bilingual categories is writing the name of the second language category in the category description input field and then use {category_description} as the name tag for that language. That is not useful if you need a description for both languages though.
this might work for you:
I haven't used EE2.0, but in EE 1.X you could create custom category fields.
Create a "{fr_category_description}" for instance
then have a read at this tutorial - http://expressionengine.com/wiki/Multi_language_site_alternative/
I implemented this on an english/welsh website and it worked very nicely
URLs look like site.com/COUNTRY_CODE/template_group/template and serve content based on this.
works by assigning a variable based on the country, then within your templates you can do:
<h1>{{country_code}_my_field}</h1>
which will translate to:
<h1>{en_my_field}</h1> for site.com/en/ or <h1>{fr_my_field}</h1> for site.com/fr
you just need to create fields with the country code as a prepended and you're good to go.
let me know if you need any clarification, can provide code from my live site.

Resources