[Résolu] ordre avec chiffre et lettre

More
12 years 10 months ago - 12 years 10 months ago #21091 by kim
Bonjour,

Mon soucis est très spécifique, je l'avoue.
J'ai un classement.
J'attribue un chiffre (rang) à chaque item avec un champ texte.
Ensuite dans l'index, j'ordonne mes items grâce au champ (ex: rang) en ordre ascendant et en utilisant l'option "nombre".
Jusqu'ici pas de soucis.
Mon soucis, c'est que certains items sont "hors classessement" donc je leur attribue un HC.
Quand j'ordonne avec mon champs "rang", les items HC, passent en premier dans la liste, alors que je voudrais qu'il soit en dernier.
Le mélange chiffre lettre dans un ordre number, garde la prédominance lettre...

Si je mets aucune valeur dans ce champs (rang), l'item disparait de la liste dans l'index.

Ou est-ce que je peux voir pour faire cette modif dans le code?

Merci d'avance pour l'info.

Kim.
Last edit: 12 years 10 months ago by kim.

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

More
12 years 10 months ago #21093 by ggppdk
When you order by custom text field that you declared (in the sorting options) as containing numbers, all the values are converted to numbers,

if it contains alphanumeric characters it will be converted to zero
e.g
HC is converted to 0
HC45 is converted to 0
45HC is converted to 45

thus because it is converted to zero , it will appear at the top of the list, since you sorted in ascending order.

About the items not appearing when the have no value for the field used for ordering , this i a bug, i will check and fix:
code.google.com/p/flexicontent/i ... ail?id=299

But after i fix, i think they will still appear on top of list ...


-- 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
12 years 10 months ago #21094 by kim
ok i understood.

If i changed, the convert,
e.g: HC converted to 100000, the item must display at the end?

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

More
12 years 10 months ago #21150 by ggppdk
I fixed bug about items not shown in category view when:
-- you order by custom field and some items have no value for the field used to order by.

Please use this file
[attachment=0:z813im3u]<!-- ia0 -->category.zip<!-- ia0 -->[/attachment:z813im3u]

unzip it and replace file:
components\com_flexicontent\models\category.php


-- 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...
Attachments:

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

More
12 years 10 months ago #21154 by kim
thanks georges

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

More
12 years 10 months ago #21333 by kim
Alors j'ai une bidouille qui marche pas mal.
Quand on a un classement avec des chiffres (1, 2, 3, 4...) mélangés avec des HC (par ex: hors classement).
Et qu'on veut que les HC soient en dernier lorsqu'on trie.

Je fais une boucle pour rechercher le HC et je lui colle la valeur max (genre: 1000)
Et je mets le 1000 en display:none.
Donc le 1000 n'apparait pas, mais est pris en compte lors du tri.
C'est stupide mais ca marche (avec flexi ou autre JS de tri).

Exemple, dans une page category_item.php (modèle défaut)
Code:
<?php if ($item->positions['table']->{$name}->display=="HC") {echo '<div style="display:none;">1000</div> HC';} else {echo $item->positions['table']->{$name}->display;} ?>

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.663 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