8 years ago
Topic

Hi,

I have a table to store geo-location data which is related to articles like this:

DROP TABLE IF EXISTS `jos_content_geo`; 

CREATE TABLE IF NOT EXISTS `jos_content_geo` ( 
    `auto_id` int(11) NOT NULL,
   `id` int(11) NOT NULL,
    `type` varchar(7) NOT NULL,
    `zone_id` int(11) NOT NULL 
) ENGINE=InnoDB DEFAULT CHARSET=utf8; 

INSERT INTO `jos_content_geo` (`auto_id`, `id`, `type`, `zone_id`) VALUES (1, 2605, 'Excl', 101);

To manage this from within an article, I have created the following fields:

Geo Rule Type


Geo Zone


#__zone is:

CREATE TABLE IF NOT EXISTS `jos_zone` (
   `zone_id` int(11) NOT NULL,
    `zone_name` varchar(255) DEFAULT NULL,
    `zone_description` text NOT NULL,
    `zone_substitute` int(11) NOT NULL DEFAULT '0' 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=114 ; 

INSERT INTO `jos_zone` (`zone_id`, `zone_name`, `zone_description`, `zone_substitute`) VALUES (101, 'North & Central America', 'Substitude: USA', 223), (102, 'South America', 'Substitude: Brazil', 30), (103, 'Africa', 'Substitude: South Africa', 193), (104, 'Middle East', 'Substitude: United Arab Emirates', 221), (105, 'Europe - British Isles', 'Substitude: Great Britain / UK', 222), (106, 'Europe - French', 'Substitude: France', 73), (107, 'Europe - German', 'Substitude: Germany', 81), (108, 'Europe - Spain', 'Substitude: Spain', 195), (109, 'Europe - Russian', 'Substitude: Russia', 176), (110, 'Europe - Other', 'Substitude: Italy', 105), (111, 'Asia', 'Substitude: Hong Kong', 96), (112, 'Pacific', 'Substitude: Australia', 13), (113, 'New Zealand', 'Substitude: New Zealand', 153);

CREATE TABLE IF NOT EXISTS `jos_zone` ( `zone_id` int(11) NOT NULL, `zone_name` varchar(255) DEFAULT NULL, `zone_description` text NOT NULL, `zone_substitute` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=114 ; -- -- Dumping data for table `jos_zone` -- INSERT INTO `jos_zone` (`zone_id`, `zone_name`, `zone_description`, `zone_substitute`) VALUES (101, 'North & Central America', 'Substitude: USA', 223), (102, 'South America', 'Substitude: Brazil', 30), (103, 'Africa', 'Substitude: South Africa', 193), (104, 'Middle East', 'Substitude: United Arab Emirates', 221), (105, 'Europe - British Isles', 'Substitude: Great Britain / UK', 222), (106, 'Europe - French', 'Substitude: France', 73), (107, 'Europe - German', 'Substitude: Germany', 81), (108, 'Europe - Spain', 'Substitude: Spain', 195), (109, 'Europe - Russian', 'Substitude: Russia', 176), (110, 'Europe - Other', 'Substitude: Italy', 105), (111, 'Asia', 'Substitude: Hong Kong', 96), (112, 'Pacific', 'Substitude: Australia', 13), (113, 'New Zealand', 'Substitude: New Zealand', 153);Then I created a Content type Geo Rule:


And created a Group X field to insert it into Content:



For the storage method I was not sure what to enter, but I found whatever I enter,

  • Format / Object gets changed to Standard / Free / geo_rule
  • Parameters is changed to jos_cck_store_item_content_geo

I'm assuming this is correct, as it happens automatically.

I have then added a tab and the Group X field to the default Article template.

The tab and the field is shown, and it shows the correct already existing data (1 record). When I change the database data, the display changes accordingly.

However, I cannot add another entry, it is simply not saved. I also found when inspecting the HTML of the form that the first entry includes: <input type="hidden" id="geo_rule_0_art_id" name="geo_rule[0][art_id]" value="2605">, whereas the 2nd one does not include this when added.


One other odd thing is that when default number of items for the Group X field is 0, I can'd add an item.


What am I missing/ doing wrong?

Get a VIP membership
4229 Posts
Kadministrator
8 years ago
2
Level 1

GroupX stores all data to parent field in the json format, for correct storage settings please see

http://www.seblod.com/resources/extensions/plug-ins/group-x-field

8 years ago
1
Level 2

Hi,

I've configured the fields now and when I save for example 3 entries I have this in my database:

<br />::geo_rule::3::/geo_rule::<br /><br />::cck_geo_rule::geo_rule::/cck_geo_rule::<br />::art_id|0|geo_rule::::/art_id|0|geo_rule::<br />::geo_rule_type|0|geo_rule::Spec::/geo_rule_type|0|geo_rule::<br />::geo_zone|0|geo_rule::111::/geo_zone|0|geo_rule::<br />::cckend_geo_rule::::/cckend_geo_rule::<br />::cck_geo_rule::geo_rule::/cck_geo_rule::<br />::art_id|1|geo_rule::::/art_id|1|geo_rule::<br />::geo_rule_type|1|geo_rule::Spec::/geo_rule_type|1|geo_rule::<br />::geo_zone|1|geo_rule::112::/geo_zone|1|geo_rule::<br />::cckend_geo_rule::::/cckend_geo_rule::<br />::cck_geo_rule::geo_rule::/cck_geo_rule::<br />::art_id|2|geo_rule::::/art_id|2|geo_rule::<br />::geo_rule_type|2|geo_rule::Spec::/geo_rule_type|2|geo_rule::<br />::geo_zone|2|geo_rule::113::/geo_zone|2|geo_rule::<br />::cckend_geo_rule::::/cckend_geo_rule::<br />

When I reopen the form, I see 3 sets of dropdown boxes, however none of them are selected. Any idea what is missing?

Kind regards,

Jochen

8 years ago
0
Level 3

I have reviewed the documentation again and found this:

"All fields must be created with unlocked storage (before you add new field click on lock icon next to the field list)"

I can't see any sort of lock anywhere, can someone provide a screenshot?


Kind Regards,

Jochen

4229 Posts
Kadministrator
8 years ago
1
Level 1

See orange lock on the screenshot

8 years ago
0
Level 2

Hi there,

thank you for this.

I have resolved the problem, it was something slightly unrelated, but may be helpful for other people.

The content type I was adding my GroupX field to actually uses free storage, not Article as described in your instructions. I somehow forgot about this when looking at this problem.

So, accordingly I had to create the Group X field storage with free storage and add the column to my separate table.

Get a VIP membership