Orchard - show an Image from Media Library Picker Field - orchardcms

I created a new content definition, added a field "Media Library Picker Field" MYIMAGE.
There I can configure some things like "A content item is required" ... "Content Types and Parts" but I left them blank.
Then I can successfully select a image from my media library and see it from Admin/Contents/List.
Then I made a new query: I selected new layout, Html List, selected properties, add new property: "Title Part Title" with no configuration and MYIMAGE:Ids with no configuration.
Then I created a projection so I can see for every match of the query the titles BUT NO Ids.
I searched in shape tracing, i suppose I can find it in Zone[Content]->Content->List->PropertyWrapper (this is the first query result) and then under the Model Tab I suppose Model->Items->[0] should be the title so #Model.Items[1] should be the Ids.
How can I get the image's Id from #Model.Items[1]? And the URL?

This issue has been resolved. See https://orchard.codeplex.com/workitem/19956.
There is also a module called Vitus.Utils that adds some very useful tokens for Media Library items. See http://gallery.orchardproject.net/List/Modules/Orchard.Module.Vitus.Utils/1.0

Related

Access content field from views in Orchard CMS 1.10.1

I would like to display certain first level menuitem in bold.
This setting should be done by a checkbox when the user create / edit a menu item. (I have a workaround using the Model.Href, but it is not nice).
So I created a boolean field in Content definition / Menuitem URL (I don't know the name of the corresponding content definition in English Orchard).
How to access a custom field (Content Field) from a view?
(There already is a view which is used to customize the menu)
The examples I found use custom shapes, where the fields are accessed as built in fields (e.g. Model.ContentItem.FieldName ). But this is a different case.
With the help of "Piedone", the solution:
Model.Content.ContentItem.MenuItem.FieldTechnicalName.Value
Explanation
Examining the Model object in Visual Studio, the Model is a dynamic shape that have eg. Href property and a Content.
Content is a MenuPart, that is a content part that have a ContentItem property with the content item itself. Technically only content parts have Fields. When you (seemingly) add a field to a type it will be a part corresponding the type's name, that is MenuItem in this case (It's confusing that the display name of 'MenuItem' content type is Custom Link...)
The field's technical name is as you name it. When you add to a type, the Value will be a property of the BooleanField class. (By the way, it is nullable, so if you dont't save after adding the field, it will be null else the value you set).

How to find specific url of newly created category in Hybris PCM

Hi whenever i try to create the new product category in hybris product cockpit
i create the identifier, name and the correct catalog version which is Online
but when i try to edit the navigation of the website im currently lost where do i find the url of that specific category so when the user click on that navigation it will filter on which category of the product is tagged
If your navigation menu is composed of CMSLinkComponents you are lucky, because CMSLinkComponent was already made to handle this, you have just to :
create a new CMSLinkComponent.
Attach the new create Category to the CMSLinkComponent.
Then add this CMSLinkComponent to your navigation menu. (that's all what you need to do).
However if you don't use CMSLinkComponent, you can use the defaultCategoryModelUrlResolver.resolve(newCategory) to generate the URL of the category and then send it back to the Front to be printed.
Or just print it like this in your jsp file :
<c:url var="categoryUrl" value="/c/${newCategory.code}" />
${newCategory.name}

view content items on screen from front end with orchard

Using orchard 1.6. I've created a content type 'ImageUpload' which has 2 fields 'Image' and 'Date'. So the user can select todays date and upload an image. The uploads can be viewed from the 'Content Items' section of the dashboard but...
I would separately like to access/view the uploads from a different section(as the user wont have access to view the content items page) Iv set up a navigation menu but how can I view the records?
The content items are stored in the 'ContentItemVersionRecord' table...?
I don't fully understand your question. View the content items on the front end? Try using the projections module. You create a query that gets content of ImageUpload type and then you create a projection page that will use this query. Enable Projections feature, it comes with 1.6

displaying a list on screen with orchard

Using orchard cms 1.6 I have a table in my db 'cars'. I want to display the column 'CarName' from the table, as a list on screen with all the records from the table.
carname1
carname2
carname3
When the user clicks on their link it will bring them to that page.
I know how to do this from the view e.g.
#T("Cars")
but I would like to try and create a content type which shows this list.
Content type seems to be all UI related. Im not sure how to take a table and display a column as a list on screen through the content type...any idea on how to do this?
then I can choose to show the content type as a form and the user can view it from the main menu.
thanks
It looks like you want to create a content type called Car, possibly with a CarPart and a record class CarPartRecord (perhaps refactor your Car class to CarPartRecord to follow Orchard's naming conventions). Make sure CarPartRecord derives from ContentPartRecord.
To render a list of Cars, you could use a Projection that renders a list of cars. A Projection renders content based on a Query, which you configure using the dashboard.
Alternatively, you could create a controller that leverages IContentManager to query all Car content items, and returns a view to render them in a table.
For each Car content item, use Html.ItemDisplayLink to render a link to its details page.

How to show list of custom objects in a page in Drupal

I want to create a page in Drupal 6 where I can show list of restaurants.When a user clicks on any restaurant page, I should be redirected to Restaurant details page.
For this :
1.) I created a new content type called "Restaurant" with some fields.
2.) Created 3-4 content items for Restaurant( Restaurant1, Restaurant2, Restaurant3)
3.) Created view called: RestaurantList, Added Fields for it. Then added Page Display and gave the path for it http://website/Restaurants
Now, when I browse to Restaurants page, I only get labels of my fields but no values. How can I get the values but not the labels? Also, I want to go to the RestaurantDetails page. How can that be achieved?
Thanks,
Rashmi
Well if I were to set up a page view this is how I would set it up:
Filters:
Node type - Restaurants
Node published - Yes
Fields
Node title
check the option Link this field to it's node
leave the Label: field empty
check option Hide if empty
And if your view style is a HTML list, for extra you can go to Row style options and check the option: Hide empty fields
Make sure you click Preview to see if you get any values. If you don't then there's something wrong with the view settings, most probably the filters which are to restrictive. Start with something loose, like Node type - Restaurants.

Resources