mod_flexicontent - tri par champ date

More
11 years 11 months ago #31923 by masstox
Bonjour,

Je souhaiterais afficher les articles d'une catégorie avec le module mod_flexicontent trier par un champ date personalisé.

J'arrive à filtrer via les groupes une plage de dates de mon champ date mais elle ne sont pas trier par ordre croissant ou décroissant.
Elles sont triées par l'option de tri défini dans "Méthode d'obtention", et il n' y a pas de tri par champ personalisé dans ces options

Comment faire pour ajouter le tri par champ date?

Merci d'avance pour vos réponses

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31930 by ggppdk
Currently

-- ORDERING by a custom field (single property field: text, date, etc)

or

-- SCOPING (=selecting items) by a custom field


are not included in the module,

will be implemented in near future, cannot say when probably before 10 of January

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31931 by denniskobus
i managed to replace the single category order by a custom field ordering via this hack (meaning it will disapear if you update flexicontent)

mod_flexicontent/helper.php

replace:
Code:
case 'catorder': ...... break;

with:
Code:
case 'catorder': if ($params->get('orderbycustomfieldid', 0) != 0) { if ($params->get('orderbycustomfieldint', 0) != 0) $int = ' + 0'; else $int =''; $filter_order = 'f.value'.$int; $filter_order_dir = $params->get('orderbycustomfielddir', 'ASC'); } $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_dir; $orderby .= $filter_order!='i.title' ? ', i.title' : ''; // Order by title after default ordering $join_customordering = ''; if ($params->get('orderbycustomfieldid', 0) != 0) { $join_customordering = ' LEFT JOIN #__flexicontent_fields_item_relations AS f ON f.item_id = i.id AND f.field_id='.(int)$params->get('orderbycustomfieldid', 0); } break;

and add after:
Code:
. $join_date
Code:
. $join_customordering


in mod_flexicontent.xml at line 61 add
Code:
<field name="" type="separator" default="FLEXI_CUSTOM_ORDER" description="" level="level3" /> <field name="orderbycustomfieldid" type="fields" exclude_field_type="toolbar,file,image" isnotcore="1" default="0" label="FLEXI_PRIMARY_ORDER_CUSTOM_FIELD_ID" description="FLEXI_PRIMARY_ORDER_CUSTOM_FIELD_ID_DESC" /> <field name="orderbycustomfielddir" type="list" default="ASC" label="FLEXI_PRIMARY_ORDER_CUSTOM_FIELD_DIR" description="FLEXI_PRIMARY_ORDER_CUSTOM_FIELD_DIR_DESC" > <option value="ASC">FLEXI_ASC</option> <option value="DESC">FLEXI_DESC</option> </field> <field name="orderbycustomfieldint" type="list" default="0" label="FLEXI_PRIMARY_ORDERING_METHOD" description="FLEXI_PRIMARY_ORDERING_METHOD_DESC" > <option value="0">FLEXI_ALPHANUMERIC</option> <option value="1">FLEXI_NUMERIC</option> </field>


you can now select custom field ordering which is only appied if you select 'single category order'.
i couldn't add extra sorting order because that would mean also hacking in the component code.

hope it helps for now,
dennis

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31937 by ggppdk
Yes i know of this,

it is the code that needs to be added and same code is used in category / tags / favourites view

just did not get around to doing it and testing it, also there was a thought to move this code to shared helper function

i ll try to add this sooner


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31945 by denniskobus
for now i'm good, but i just wanted to help masstox.

indeed the code is copied from the custom field ordering on the component. (i m not able to make it myself)

thanks, dennis

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31953 by masstox
Merci pour vos réponses rapides.
Denniskobus, j'ai fait les modifications que vous avez indiquées mais j'ai une erreur.
Code:
SELECT i.*, ie.*, ty.name AS typename, cr.rating_sum as rating_sum, cr.rating_count as rating_count, CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as categoryslug, GROUP_CONCAT(rel.catid SEPARATOR ",") as itemcats FROM #__content AS i LEFT JOIN #__flexicontent_items_ext AS ie on ie.item_id = i.id LEFT JOIN #__flexicontent_types AS ty on ie.type_id = ty.id LEFT JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id LEFT JOIN #__categories AS c ON c.id = rel.catid LEFT JOIN #__content_rating AS cr ON cr.content_id = i.id WHERE c.published = 1 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2012-12-17 15:14:39' ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2012-12-17 15:14:39' ) AND i.access <= 1 AND i.id <> 0 AND i.state IN ( 1, -5 ) GROUP BY i.id ORDER BY f.value ASC, i.title Unknown column 'f.value' in 'order clause' SQL=SELECT i.*, ie.*, ty.name AS typename, cr.rating_sum as rating_sum, cr.rating_count as rating_count, CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as categoryslug, GROUP_CONCAT(rel.catid SEPARATOR ",") as itemcats FROM hpstl_content AS i LEFT JOIN hpstl_flexicontent_items_ext AS ie on ie.item_id = i.id LEFT JOIN hpstl_flexicontent_types AS ty on ie.type_id = ty.id LEFT JOIN hpstl_flexicontent_cats_item_relations AS rel ON rel.itemid = i.id LEFT JOIN hpstl_categories AS c ON c.id = rel.catid LEFT JOIN hpstl_content_rating AS cr ON cr.content_id = i.id WHERE c.published = 1 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2012-12-17 15:14:39' ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2012-12-17 15:14:39' ) AND i.access <= 1 AND i.id <> 0 AND i.state IN ( 1, -5 ) GROUP BY i.id ORDER BY f.value ASC, i.title LIMIT 0, 10

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.795 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline