Keyword

Module display item according field value

  • Com3elles
  • Com3elles's Avatar Topic Author
  • Offline
  • New Member
More
4 years 9 months ago #174910 by Com3elles
hello i search a module to display item according same value in specific field
like a level field
regards

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

More
4 years 9 months ago #174915 by JoomlaWorks
Replied by JoomlaWorks on topic Module display item according field value
Can you re-phrase the question please?

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Com3elles
  • Com3elles's Avatar Topic Author
  • Offline
  • New Member
More
4 years 9 months ago #174919 by Com3elles
Replied by Com3elles on topic Module display item according field value
Sorry i mean
I have à sélect field with value for item
And i want to display à list of item where have the same value

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

More
4 years 9 months ago #174923 by JoomlaWorks
Replied by JoomlaWorks on topic Module display item according field value
Again, search getk2.org/extend for something that matches your needs.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Com3elles
  • Com3elles's Avatar Topic Author
  • Offline
  • New Member
More
4 years 9 months ago #174930 by Com3elles
Replied by Com3elles on topic Module display item according field value
but i didn't found anything all works only via tags ...
maybe i can add a function inside my template ...
but can you help me with sql request ?
SELECT * FROM XXX_k2_items WHERE extra_fields = 'MYVALUE'
i didn't find a good way to search inside extra_fields
regards

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

More
4 years 8 months ago #174946 by JoomlaWorks
Replied by JoomlaWorks on topic Module display item according field value
Can you give me a practical example of what you want to do? As detailed as possible please...

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Com3elles
  • Com3elles's Avatar Topic Author
  • Offline
  • New Member
More
4 years 8 months ago #174955 by Com3elles
Replied by Com3elles on topic Module display item according field value
hello my goal is to display a list of item where have same value in extra field like display 5 item with same value in price field
i try to create a sql request
like this
SELECT * FROM `x6072_k2_items`
where json_contains(extra_fields,'{"id":"7","Transferts inclus"}','$')=1 LIMIT 0, 25

an exemple of my value in k2 extra_fields
[{"id":"1","value":"0000 €"},
{"id":"2","value":" Des requins marteaux en abondance"},
{"id":"3","value":" images/Forfaits/c6bo-voyages-plongee-croisiere-plongee-a*-l-ile-coco-avec-la-flotte-sea-hunter"},
{"id":"4","value":""},
{"id":"5","value":""},
{"id":"6","value":""},
{"id":"7","value":"Transferts inclus"},
{"id":"8","value":""},
{"id":"9","value":""},
{"id":"10","value":"De décembre à*avril "},
{"id":"11","value":"bancs de requins marteaux, raies mantas "},
{"id":"12","value":"Niveau 2 / Advanced Open Water avec 50 plongées minimum, Deep Diver recommandé"},
{"id":"13","value":"7"},
{"id":"14","value":"5"},
{"id":"15","value":"1"}]

=> that reply
#3141 - Invalid JSON text in argument 1 to function json_contains: "Invalid escape character in string." at position 846.

maybe you have a better way ?

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

More
4 years 8 months ago - 4 years 8 months ago #174962 by JoomlaWorks
Replied by JoomlaWorks on topic Module display item according field value
JSON_CONTAINS() is not the proper function to use in such cases because K2 extra fields are an array of JSON objects.

Actually, it's better to use a simpler string search query like:
SELECT * FROM `#__k2_items` WHERE extra_fields LIKE '%{"id":"7","value":"Transferts inclus"}%' LIMIT 0, 25;

If you need to resort to such filtering, I would seriously recommend looking into K2 plugins. With a K2 plugin you can have your own DB table to store additional info and map that content with your K2 items. See my other post on using the example K2 plugin.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 4 years 8 months ago by JoomlaWorks.

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

  • Com3elles
  • Com3elles's Avatar Topic Author
  • Offline
  • New Member
More
4 years 8 months ago #174988 by Com3elles
Replied by Com3elles on topic Module display item according field value
ok coool !
thanks

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

More
4 years 8 months ago #175003 by JoomlaWorks
Replied by JoomlaWorks on topic Module display item according field value
You're welcome.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum