This question is related to Orchard Project 1.7.1(http://orchardproject.net/).
Here is my setup. I have my custom content type, Event. I created a custom field for the Event call EventDate (which is of Datetime type). I am able to add taxonomy part to the Event type, after install the Taxonomy module.
Everything works as expected, when I clicked on the taxonomy links, it showed a list of events.
However the event is not sorted based on EventDate. I could not find any documentation to tell me where to define the custom sort order for the custom field I defined for the Event type.
Please note that I am not referring the sort order of the taxonomy (which is defined when I created the projection for the taxonomy). I am referring to the Event list sort order after clicked on the taxonomy link.
Thank you very much in advance!
derek
I read the code, and found out that it is sort descending on creation date/time. So I enabled the allow modify creation date/time in the content definition page. It is not idea, but it works.
Related
How do I point a Joomla menu item to a specific task in my custom component? I have had no trouble creating menu items that point to my views, and each view is available in the list when I select my component in the menu. But I have not found a way to route the menu to one of my component's tasks.
In some cases, I am using a controller method (i.e. a task) to decide which models and views to present to the user. Usually this is when I need to display data from multiple models, or I need to use information in the session state to determine which view is appropriate for the user. It is in these cases that I need a menu item that points to the task.
So, how do I get a menu item to bring a user to "index.php?option=com_mycomponent&task=do.something"?
What have I tried already, you ask? I've looked at just about every Google reference I could find, and none seem to address this issue. I'm either looking for the wrong thing, or it's so dead easy that nobody has ever had to ask for help. I have also looked through the Joomla components & menu items, finding no examples of a menu item pointing to a controller task.
You can add a field to the request fieldset. Name it task. The value would be "do.something". Make the field type="hidden".
I'm suggesting the hidden because you really don't want the users to be able to change it.
The request fieldset is for fields that go into the url directly with the format &name=value.
I found the above answer not flexible enough and finally found this to work perfectly, you can override the menu item form xml ( administrator/components/com_menus/models/forms/item.xml ) and make the link field editable so you can add any request parameters you want, including tasks.
Make sure you leave/add the view name of the request as otherwise the link type cannot be determined, so add it even if it is not relevant eg. &view=yourview.
See system plugin onContentPrepareForm below
function onContentPrepareForm(&$form, $data) {
$option = JFactory::getApplication()->input->get('option');
// allow us to edit the link field of the menu item for this component to include some custom request values
if($option == 'com_menus' && $data->type=='component' && $data->request['option']=='com_your_component_name'){
$form->setFieldAttribute('link','readonly','false');
}
}
I have a category "Year" in Tridion and it has keyword values listed 1900s-2012. I am trying to access the category in a component via a dropdownlist. The problem is, I am seeing values in dropdownlist in ascending order 1900s-2012. And user has to scroll all the way down to select the current year - 2012. Is there a way I can reorder keyword values in the category so users see the current year first. I have searched quite a bit, but found no answer on the web or in documentation.
Is it possible to specify the ordering in any dropdownlist created from a category used in a component or at the schema level?
There is no way to specify the order for a dropdown list without creating an eXtension (should be easy using jQuery).
What you could do is set the default value of the field to "2012" and that way the user has the current year selected and if they need to change to a previous year, they'll scroll up.
I've recently added custom fields to the article component using the documentation in the following url:
http://docs.joomla.org/Adding_custom_fields_to_the_article_component
Now this adds the custom fields defined to every new and existing article. Is there a way to define custom fields for specific article layout overrides.
Example:
If I have custom layouts for the category blog, (news, portfolio, events) can I define different custom fields for each category when creating a new article?
Kind of the way custom post types work in wordpress, or the way k2 component works, can this be done in joomla alone?
This is considerably easier to manage in K2 since the functionality is built in to do specifically what you want. It is trivial to assign extra fields to each category without having to go through the much more complex process described in your link.
However, if you want to stick with com_content, then you will need to create alternative layouts for displaying each category. You will still have all of the custom fields show up in the admin, but you can control the display on the front end with the alternative layouts. Here is the documentation (it's the same for 2.5) - http://docs.joomla.org/Layout_Overrides_in_Joomla_1.6#Introduction_to_Alternative_Layout_Feature_in_Version_1.6
I'm begginer in the Orchard CMS.
I would like to create Content Type composed from different parts and fields which I know before. I want this content type to be enumerable ie I use content part List, I want to list it using telerik components.
For example my content type is Product and I specify its fields: Price, SKU apart from default: user(who created it) and creation time fields. Moreover the product contains also image gallery, ie image gallery content part.. I want the list of products to be shown using Telerik component Grid, including creation time and user name.
Is it better to create the whole module specifying all its fields(price,SKU) and its templates or is there any way to just take what has been already created in orchard as a content type and display it different way(using telerik)..
thanks for any advice ;)
Tomas
It appears this topic was moved and answered here:
http://orchard.codeplex.com/discussions/371276
By default, I have sorting set to by Name, and when particular categories are selected, it's usually by Price. However, I am not sure how to assign a default sort-by setting when shopping by an option other than category. I have an attribute in my layered nav called "Size" and when that is used as the filter, I would like to sort by Price.
I guess the question then is if there is a way to do this in XML -- first how to call out the proper scope for a shopping option other than category, and second how to change the sort-by setting. I'm guessing though that it's not possible through XML and that I'll have to go deeper, but any advice is appreciated!
I think you are going to have to override a core file in order to accomplish what you want (don't modify a core file -- override the class by copying it the local code pool or rewriting the class). By default the order is the sort order set in the admin panel. In order to change that you are going to have to modify that logic.
I started by looking in the Mage_Catalog_Block_Layer_Category class. This has a reference to the Mage_Catalog_Model_Layer_Filter_Category class. This class handles getting the categories for the layered navigation.
The function I think you need to look at is _getItemsData(). I think you'll either want to modify the logic for $categories to set the order you want (this is probably the more preferable option) or you may be able to do some custom sorting on the items that get placed into the $data array.
go to app\code\core\Mage\Catalog\Model\Resource\Eav\Mysql4\Product and open collection.php file and look into the function named as a addAttributeToSort() this function is responsible for sorting attribute, here you can put your logic for sorting and override your file after testing