1283 Posts
Bucklash
9 years ago
24
Topic

This post is highlighting the GOOD WAY on how to store data using field X.

(tutorialforum post)

I have been incorrectly storing the data

The BAD WAY:

STORAGE: Custom | Artcle | field_name

The GOOD WAY:

STORAGE: Custom | Artcle | column_name[field_name]

Using the Article content type
Create a text field named 'funky_text', set storage to none.
Create a Field X field named 'funky_fieldx'.
Store the duplicated data in to a db column called 'funky_column':


The BAD WAY:

In <strong>Field X</strong> -> STORAGE: Custom | Artcle | funky_column

It works, but it does not take advantage of all that SEBLOD has to offer.

The GOOD WAY:

STORAGE: Custom | Artcle | funky_column[funky_text]

This allows multiple fields to be stored in the column.

The resulting code that is entered in to my database, SEBLOD has altered it so that it can do its stuff

<br />::my_text_field_3::3::/my_text_field_3::<br /><br />::my_text_field_3|0|my_fieldx_3::une::/my_text_field_3|0|my_fieldx_3::<br />::my_text_field_3|1|my_fieldx_3::deux::/my_text_field_3|1|my_fieldx_3::<br />::my_text_field_3|2|my_fieldx_3::trois::/my_text_field_3|2|my_fieldx_3::<br />

For the image below:

Text Field name my_text_field_3
FieldX Field name my_fieldx_3
FieldX storage location my_fieldx_3_data

Custom | Article | my_fieldx_3_data[my_text_field_3]

Get a VIP membership
67 Posts
Bonitto
7 years ago
23
Level 1

Hi Bucklash,

I gotta say thanks so much for providing detailed documentation man. You've literally been my saving grace to continue learning SEBLOD and sifting through documentation that doesn't go very much in detail with understanding what's going on.

Is the custom storage format db_column_name[field_name] the best way for Group X too? I understand the db_column_name but I am trying to understand what field would be going into the field name spot if this works with Group X as well. I am assuming the field_name of the group would go in that [field_name] spot for a Group X use case? Or would [field_name] be disregarded for group?

1283 Posts
Bucklash
7 years ago
22
Level 2

Hi

My docs are a little verbose and maybe not altogether accurate :)

If it helps, cool!

Anyway, if I remember rightly (I have only used it once, but deleted it the other day):

Create a content type.

Save it with NO fields included.

This prevents a Db table from being created.

Then create your fields 

a) with padlock unlocked so that they are available globally for object i.e. article. 

b) with storage none so that no db column is added.

In your content type that will use groupx add the groupx field with storage link this:

db_column[content-type]

There is a tutorial by Klas which answers all of this but I can never find it

Jon

ps groupx uses the intro view 

4229 Posts
Kadministrator
7 years ago
19
Level 3

 I found out that only way to make FieldX/Group X work in all cases including various searches (eg. search generic) is to use:

  • Custom | Article | parent_field_name for parent (either fieldX or groupX) 
  • and Custom | Article | parent_field_name[child_field_name] for child field(s)  (fields inside group called by groupX or for field called by fieldX). Also for groupX you need to create all fields with storage unlocked.

It theory it should work with child fields having storage None as all data is indeed stored in the parent field (reason my tutorials were unpublished), but unfortunately this does not work as intended at the moment and since you must do as described above.

67 Posts
Bonitto
7 years ago
18
Level 4

Klas,

when you stated:

  • Also for groupX you need to create all fields with storage unlocked.

Does this include the parent Group X field? Meaning should the Group X field itself also be unlocked or does this apply to only the children of Group X?

4229 Posts
Kadministrator
7 years ago
17
Level 5

It has been some time since I researched this, but I believe it needs to be unlocked on all

67 Posts
Bonitto
7 years ago
16
Level 6

Thanks for the prompt reply. Please confirm if my understanding of your statements about creating the fields and structure are correct because I am having a problem outputting Group X now in my template overrides now.

  • Field Name: dept_hrs_grp 
    • Field Type: Group
  • Field Name: dept_hrs_gx
    • Field Type: Group X
    • Storage: Custom | Article | dept_hrs_gx
    • Lock State: Unlocked
    • Notes: This is the parent_field and will repeat the group the fields in dept_hrs_grp
  • Field Name: dept_day
    • Field Type: Radio
    • Storage: Custom | Article | dept_hrs_gx[dept_day]
    • Lock State: Unlocked
    • Notes: This field is in the dept_hrs_grp and a child field of dept_hrs_gx
  • Field Name: dept_opening_hr
    • Field Type: Simple
    • Storage: Custom | Article | dept_hrs_gx[dept_opening_hr]
    • Lock State: Unlocked
    • Notes: This field is in the dept_hrs_grp and a child field of dept_hrs_gx
  • Field Name: dept_opening_min
    • Field Type: Simple
    • Storage: Custom | Article | dept_hrs_gx[dept_opening_min]
    • Lock State: Unlocked
    • Notes: This field is in the dept_hrs_grp and a child field of dept_hrs_gx

Is this correct? If so then when I var_dump( $cck ) to look for the Group X field, I am not seeing it anywhere. I have also made sure that the Content View of my dept_hrs_grp field has all of the fields I would like to be displayed in my template override.

1283 Posts
Bucklash
7 years ago
15
Level 7

Hi

I think your groupx field should be pulling in a content type, not another field....

67 Posts
Bonitto
7 years ago
14
Level 8

Disregard, I have since found that my issue was that despite me making sure that the Group field had the child fields in the correct content view, I forgot to add my groupx field in the Content View of my Content Type.

Now that I have figured that out. How would I output Group X in a Search & List Type module via template override in the Item View since I am not using the introfield? 

Please note, I have referred to: https://www.seblod.com/community/forums/lists-search-types/groupx-and-search and https://www.seblod.com/community/forums/fields-plug-ins/search-in-groupx-fields but I don't see what solution as applicable to my use case.

1283 Posts
Bucklash
7 years ago
12
Level 9

Hi

So have you used the group field AND groupx?

Really, group is not necessary as far as I know...

Create the content type as described above (but fields having storage set as normal - not none).

If you don't want people to see content type you can turn it off. 

It might be worth starting a new thread for other questions....

PS i corrected some typos in previous post....

67 Posts
Bonitto
7 years ago
11
Level 10

Hi Bucklash.

Yes, I was able to use Group in Group X and I also tested trying to output a list and search type via both methods (i.e. using a Group in Group X and Content Type in Group X) and both led to the same result of my Group X field's not displaying. I can see the parent field when I var_dump but not the children fields. 

The weird thing is that I am able to output the Group X fields on my content type's Content View via template override but I cannot figure out how do I output Group X via a List and Search Type by way of a module.

All of my fields follow the Custom | Article | parent_field[child_field] format with all fields unlocked as I was instructed above. I also have made sure that all of the grouped children fields were in the Intro View and Content View in my Group field.

1283 Posts
Bucklash
7 years ago
10
Level 11

Hi

So you have a list & search type...

Using the Item view... (not list as this does not facilitate position overrides/variations)

Does your Item view position override work then? or is it just the groups within that that is not working?

67 Posts
Bonitto
7 years ago
9
Level 12

I am able to confirm that my Item View template override works because I have placed my SEBLOD List module in the footer of my template and when I var_dump( $cck ), I am able to see properties, however my Group X field does not display any of the child fields of my Group X field.

If you go here: https://dev.cloudaccess.host/, you'll see what I mean. If you try to find dept_hrs_gx, you'll see that it's visible on the page, but none of the child fields output.

1283 Posts
Bucklash
7 years ago
8
Level 13

Hi Bonitto

So I just tested....

GROUP X CONTENT TYPE

The content type that will be repeated via Group X

1 Content Type created
2 Name: group_x_test<br>2 Created fields with padlock open
3 Add fields to Admin Form View, and Intro View 
(Fields in Intro View not necessary as this example is using List & Search Type Item View)<br>

GROUP X FIELD

This field is in my content type that requires repeatable fields

1 Created Group X field in main Content Type i.e. Article
2 Name: groupx_field_test
3 Content Type: group_x_test

LIST & SEARCH TYPE

The list of articles. Item view is required as want to do position override

1 Create List & Search type
2 Template: seb_blog
3 Use Item View (this pulls in seb_one)

POSITION OVERRIDE

The position override needs to be located in the correct template. The item view uses seb_one

Position Override Name: overridegx
Folder structure: seb_one/variations/overridegx/overridegx.php

RENDER DATA

I just rendered a heading plus some data. Notice that I use value instead of values as values does not work for me

<h3>Group X Stuff</h3>
<?php foreach($cck->get( 'group_x_field' )->value as $gx){ ?>
  <p><?php echo $gx['test_field-1']->label; ?></p>
  <p><?php echo $gx['test_field_1']->value; ?></p>
  <p><?php echo $gx['test_field_2']->label; ?></p>
  <p><?php echo $gx['test_field_2']->value; ?></p>
  <p><?php echo $gx['test_field_3']->label; ?></p>
  <p><?php echo $gx['test_field_3']->value; ?></p>
<?php } ?>
1283 Posts
Bucklash
7 years ago
0
Level 14

So do you have data stored?

Have you checked your db to see if the data is there?

It seems like the storage is not right.

67 Posts
Bonitto
7 years ago
4
Level 14

Hi Bucklash,

Thanks so much for your help. I sincerely appreciate it. 

When I check the #__cck_store_item_content table as per the documentation states, I do see that the dept_hrs_gx column/parent field has been added and contains data for one row in that column, as I have only created one Content Type via the Article Manager.

Here's the data that I am able to view in the table: 

<br />::dept_hrs_gx::4::/dept_hrs_gx::<br /><br />::cck_dept_hrs_gx::dept_hrs_grp::/cck_dept_hrs_gx::<br />::div_start_6|0|dept_hrs_gx::::/div_start_6|0|dept_hrs_gx::<br />::dept_name|0|dept_hrs_gx::imaging_suite::/dept_name|0|dept_hrs_gx::<br />::div_end_6|0|dept_hrs_gx::::/div_end_6|0|dept_hrs_gx::<br />::div_start_7|0|dept_hrs_gx::::/div_start_7|0|dept_hrs_gx::<br />::dept_days|0|dept_hrs_gx::Mo::/dept_days|0|dept_hrs_gx::<br />::dept_opening_hr|0|dept_hrs_gx::7::/dept_opening_hr|0|dept_hrs_gx::<br />::dept_opening_min|0|dept_hrs_gx::30::/dept_opening_min|0|dept_hrs_gx::<br />::dept_opening_am_pm|0|dept_hrs_gx::AM::/dept_opening_am_pm|0|dept_hrs_gx::<br />::dept_closing_hr|0|dept_hrs_gx::8::/dept_closing_hr|0|dept_hrs_gx::<br />::dept_closing_min|0|dept_hrs_gx::00::/dept_closing_min|0|dept_hrs_gx::<br />::dept_closing_am_pm|0|dept_hrs_gx::PM::/dept_closing_am_pm|0|dept_hrs_gx::<br />::dept_day_notes|0|dept_hrs_gx::test::/dept_day_notes|0|dept_hrs_gx::<br />::div_end_7|0|dept_hrs_gx::::/div_end_7|0|dept_hrs_gx::<br />::cckend_dept_hrs_gx::::/cckend_dept_hrs_gx::<br />::cck_dept_hrs_gx::dept_hrs_grp::/cck_dept_hrs_gx::<br />::div_start_6|1|dept_hrs_gx::::/div_start_6|1|dept_hrs_gx::<br />::dept_name|1|dept_hrs_gx::imaging_suite::/dept_name|1|dept_hrs_gx::<br />::div_end_6|1|dept_hrs_gx::::/div_end_6|1|dept_hrs_gx::<br />::div_start_7|1|dept_hrs_gx::::/div_start_7|1|dept_hrs_gx::<br />::dept_days|1|dept_hrs_gx::Tu::/dept_days|1|dept_hrs_gx::<br />::dept_opening_hr|1|dept_hrs_gx::7::/dept_opening_hr|1|dept_hrs_gx::<br />::dept_opening_min|1|dept_hrs_gx::30::/dept_opening_min|1|dept_hrs_gx::<br />::dept_opening_am_pm|1|dept_hrs_gx::AM::/dept_opening_am_pm|1|dept_hrs_gx::<br />::dept_closing_hr|1|dept_hrs_gx::8::/dept_closing_hr|1|dept_hrs_gx::<br />::dept_closing_min|1|dept_hrs_gx::00::/dept_closing_min|1|dept_hrs_gx::<br />::dept_closing_am_pm|1|dept_hrs_gx::PM::/dept_closing_am_pm|1|dept_hrs_gx::<br />::dept_day_notes|1|dept_hrs_gx::::/dept_day_notes|1|dept_hrs_gx::<br />::div_end_7|1|dept_hrs_gx::::/div_end_7|1|dept_hrs_gx::<br />::cckend_dept_hrs_gx::::/cckend_dept_hrs_gx::<br />::cck_dept_hrs_gx::dept_hrs_grp::/cck_dept_hrs_gx::<br />::div_start_6|2|dept_hrs_gx::::/div_start_6|2|dept_hrs_gx::<br />::dept_name|2|dept_hrs_gx::imaging_suite::/dept_name|2|dept_hrs_gx::<br />::div_end_6|2|dept_hrs_gx::::/div_end_6|2|dept_hrs_gx::<br />::div_start_7|2|dept_hrs_gx::::/div_start_7|2|dept_hrs_gx::<br />::dept_days|2|dept_hrs_gx::We::/dept_days|2|dept_hrs_gx::<br />::dept_opening_hr|2|dept_hrs_gx::7::/dept_opening_hr|2|dept_hrs_gx::<br />::dept_opening_min|2|dept_hrs_gx::30::/dept_opening_min|2|dept_hrs_gx::<br />::dept_opening_am_pm|2|dept_hrs_gx::AM::/dept_opening_am_pm|2|dept_hrs_gx::<br />::dept_closing_hr|2|dept_hrs_gx::8::/dept_closing_hr|2|dept_hrs_gx::<br />::dept_closing_min|2|dept_hrs_gx::00::/dept_closing_min|2|dept_hrs_gx::<br />::dept_closing_am_pm|2|dept_hrs_gx::PM::/dept_closing_am_pm|2|dept_hrs_gx::<br />::dept_day_notes|2|dept_hrs_gx::::/dept_day_notes|2|dept_hrs_gx::<br />::div_end_7|2|dept_hrs_gx::::/div_end_7|2|dept_hrs_gx::<br />::cckend_dept_hrs_gx::::/cckend_dept_hrs_gx::<br />::cck_dept_hrs_gx::dept_hrs_grp::/cck_dept_hrs_gx::<br />::div_start_6|3|dept_hrs_gx::::/div_start_6|3|dept_hrs_gx::<br />::dept_name|3|dept_hrs_gx::imaging_suite::/dept_name|3|dept_hrs_gx::<br />::div_end_6|3|dept_hrs_gx::::/div_end_6|3|dept_hrs_gx::<br />::div_start_7|3|dept_hrs_gx::::/div_start_7|3|dept_hrs_gx::<br />::dept_days|3|dept_hrs_gx::Th::/dept_days|3|dept_hrs_gx::<br />::dept_opening_hr|3|dept_hrs_gx::7::/dept_opening_hr|3|dept_hrs_gx::<br />::dept_opening_min|3|dept_hrs_gx::30::/dept_opening_min|3|dept_hrs_gx::<br />::dept_opening_am_pm|3|dept_hrs_gx::AM::/dept_opening_am_pm|3|dept_hrs_gx::<br />::dept_closing_hr|3|dept_hrs_gx::8::/dept_closing_hr|3|dept_hrs_gx::<br />::dept_closing_min|3|dept_hrs_gx::00::/dept_closing_min|3|dept_hrs_gx::<br />::dept_closing_am_pm|3|dept_hrs_gx::PM::/dept_closing_am_pm|3|dept_hrs_gx::<br />::dept_day_notes|3|dept_hrs_gx::::/dept_day_notes|3|dept_hrs_gx::<br />::div_end_7|3|dept_hrs_gx::::/div_end_7|3|dept_hrs_gx::<br />::cckend_dept_hrs_gx::::/cckend_dept_hrs_gx::<br />

So I believe it's storing data correctly, I think the only difference between what you have and what I have is that I am using a Group Field instead of a Content Type, which I've tried using twice and receive the same result. I don't know what in the heck I'm doing wrong since I was able to get the Group X field to render in the Content View of my seb_minima template override. 

I also was unable to use the values property as stated in the SEBLOD documentation so I also am outputing the Group X fields via the value property
67 Posts
Bonitto
7 years ago
0
Level 15

and I must be in the correct template override folder for the List and Search Type because I am outputting all of SEBLOD's fields by using var_dump( $cck ) on the home page.

I have also double checked each child field to make sure it is unlocked (i.e. I don't see the padlock at the bottom under the Storage section) when I look at each field.

1283 Posts
Bucklash
7 years ago
2
Level 15

I don't know...

All i can suggest is that you get rid of your group field. 

Reference the content type direct from your groupx field, rather than adding the middle man so to speak.

Maybe the fact it worked in the content view is a happy quirk :)



67 Posts
Bonitto
7 years ago
1
Level 16

lol roger that. I will delete and then create another content type. Did you set the Content Type's Object to None when you created?

1283 Posts
Bucklash
7 years ago
0
Level 17

Hi

No I didn't. I think that needs to be set to specific object ie article... just guessing.

Also, maybe you don't need to create again, just reference from groupx.... or dip in to db and change where necessary ;)

67 Posts
Bonitto
7 years ago
1
Level 14

Hey Bucklash,

I just noticed something different. When you created your test, did you output the Group X field in a SEBLOD List module? Because I don't have a problem outputing a list in an Item View in a direct template override. I am having a problem trying to output the Group X field using the SEBLOD List module.

1283 Posts
Bucklash
7 years ago
0
Level 15

Hi

I used a list module ....

Add some screenshots of your settings....

1283 Posts
Bucklash
7 years ago
0
Level 9
251 Posts
Viktor Iwan
7 years ago
1
Level 3

hey Bucklash.. do you have skype id? Love to do seblod talk with you...

1283 Posts
Bucklash
7 years ago
0
Level 4

Hi Viktor. 

Yes, I'm up for that. ;)

My skype thing is jon.buckner

Get a Book for SEBLOD