Keyword

Extra fields problem

  • Orestis Polychronakis
  • Orestis Polychronakis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #102596 by Orestis Polychronakis
Extra fields problem was created by Orestis Polychronakis
Hello guys! This is my first post. So I have to say thank you to the developing team for the excellent product called K2!

My problem is that I have created a layout override for the itemlist view and category layout. The problem is that in the leading array items the extra_fields are in JSON format and not in an object like format. Why is this happening? Have I understood something wrong?

Thanks
Orestis

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

More
12 years 1 month ago #102597 by Lefteris
Replied by Lefteris on topic Re: Extra fields problem
Hi. This should not be happening. Have you modified any core K2 code? All the items are processed by the same function so extra fields should be available. Check that you have set up correctly the extra fields related option. In any case you can convert the extra fields to objects by using PHP's json_decode function:
$item->extra_fields = json_decode($item->extra_fields);

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

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

  • Orestis Polychronakis
  • Orestis Polychronakis's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #102598 by Orestis Polychronakis
Replied by Orestis Polychronakis on topic Re: Extra fields problem
Thanks for the quick answer!

I havent modified any core code.
I will check my code and come back.

(Μπράβο για την καλή δουλειά!)

Orestis P.

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

More
12 years 1 month ago #102599 by Tarasiadis Miltos
Replied by Tarasiadis Miltos on topic Re: Extra fields problem
I have a problem with the json too for the extra_fields constraction.

All my fields decoded as
"extra_fields": [

    {
        "id": "1",
        "name": "Ημερομηνία Event",
        "value": "Τετάρτη, 05 Σεπτεμβρίου 2012",
        "type": "date",
        "group": "1",
        "published": "1",
        "ordering": "1"
    },
    {
        "id": "5",
        "name": "Facebook Event Page",
        "value": "dfgdfgdfgd",
        "type": "textfield",
        "group": "1",
        "published": "1",
        "ordering": "2"
    }

],

but on some items I have problem and the produced json code is
extra_fields": {

    "0": {
        "id": "1",
        "name": "Ημερομηνία Event",
        "value": "Τρίτη, 04 Σεπτεμβρίου 2012",
        "type": "date",
        "group": "1",
        "published": "1",
        "ordering": "1"
    },
    "2": {
        "id": "6",
        "name": "Facebook Event Album URL",
        "value": "dfgdgdfgd",
        "type": "textfield",
        "group": "1",
        "published": "1",
        "ordering": "3"
    }

},

So in some cases the extra_fields produced as array [] and on some items the extra_fields produced as objects {}.

But the items is on the same category and I fill the same style data on extra fields.
What is happened?

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

More
12 years 1 month ago #102600 by Lefteris
Replied by Lefteris on topic Re: Extra fields problem
Ensure that the category is setup to show the extra fields ("Extra Fields" setting must be set to "Show"). Also check that there are no K2 or content plugins that may modify the extra fields variable.

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

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

More
12 years 1 month ago #102601 by Tarasiadis Miltos
Replied by Tarasiadis Miltos on topic Re: Extra fields problem
Thanks for your reply.
I have check the category if the option show extra fields is YES and all my categories has it as YES.
The problem is that some k2 items in this category produce json format as the first code sample (Array) and some as object (the second code sample).

I have no extra k2 or joomla plugins enable exept the defaults. My joonla-k2 installation is at the begining state so I have no extra plugins.

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

More
12 years 1 month ago - 12 years 1 month ago #102602 by Tarasiadis Miltos
Replied by Tarasiadis Miltos on topic Re: Extra fields problem
In addition is there any solution to produce the image gallery photos in json format in 2.5.7?
OR how can I reference to the gallery of an item?
Thanks.

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

More
12 years 1 month ago #102603 by Lefteris
Replied by Lefteris on topic Re: Extra fields problem
Can you be more specific on about where do you get the different forms of extra fields? Have you saved manually any data in the database? Regarding the galleries they are saved under /media/k2/galleries/THE_ITEM_ID directory. So if you know the id of the item you can easily fetch the images.

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

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

More
12 years 1 month ago - 12 years 1 month ago #102604 by Tarasiadis Miltos
Replied by Tarasiadis Miltos on topic Re: Extra fields problem
OK Thanks about the gallery fetch images info. I have understand the method.

About extra fields:
I have a category with extrafields
1. Date Event (Date type)
2. Facebook Event (Textfield type)

So when I add some items from k2 admin, some of them produce the one type of json for extra fields and some items of the same category produce json type of the second example.

I 'm looking now for some error from my side, and I will inform us if something is wrong from my side.

I add the json file that produced from my category items. Look at the last item with id 34 and look at the extrafields and compare with the other items.

Attachment not found




Thanks for the help.
Attachments:

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


Powered by Kunena Forum