We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24414
    • 45 Posts
    I’m having issues with a 3-level MIGXdb in a CMP. I’ve had good results with 2 levels, but moving on to 3 has me confused.

    I can’t seem to get the second level to save, and I’m rather stuck. At one point I could get them to save but they didn’t get assigned IDs by their parent, I reverted slightly and now they simply won’t save.

    My starting point was reading through this thread: https://forums.modx.com/thread/82679/practical-limits-to-migx

    My schema (abbreviated):

    <?xml version="1.0" encoding="UTF-8"?>
    <model package="x_products" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
    
        <object class="x_product_area" table="x_product_areas" extends="xPDOSimpleObject">
            
    		<field key="product_area_name" dbtype="text" phptype="string" null="false" default=""/>
    		
    		<composite alias="groups" class="x_product_group" local="id" foreign="product_group_id" cardinality="many" owner="local"/>
    
        </object>
        
        <object class="x_product_group" table="x_product_groups" extends="xPDOSimpleObject">
    
    		<field key="product_group_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index"/>		
    
    		<field key="product_group_name" dbtype="text" phptype="string" null="false" default=""/>
    
    		<aggregate alias="area" class="x_product_area" local="product_group_id" foreign="id" cardinality="one" owner="foreign"/>
    		<composite alias="products" class="x_product" local="id" foreign="product_id" cardinality="many" owner="local"/>
    
        </object>
        
        <object class="x_product" table="x_products" extends="xPDOSimpleObject">
            
    		<field key="product_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index"/>
            
    		<field key="product_name" dbtype="text" phptype="string" null="false" default=""/>
    		
    		<aggregate alias="group" class="x_product_group" local="product_id" foreign="id" cardinality="one" owner="foreign"/>
    
        </object>
    
    </model>


    And configs:

    x_product_areas
    {
      "formtabs":[
        {
          "MIGX_id":5,
          "caption":"Area Setup",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":20,
              "field":"product_area_name",
              "caption":"Name",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":1
            },
            {
              "MIGX_id":25,
              "field":"col",
              "caption":"Column",
              "description":"Should this item site in column 1 or 2?",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"option",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"1||2",
              "default":1,
              "useDefaultIfEmpty":"0",
              "pos":2
            },
            {
              "MIGX_id":21,
              "field":"pos",
              "caption":"Position",
              "description":"Choose the order of items by editing the number. 1 positions an item at the top, higher numbers are lower down,",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"number",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":3
            },
            {
              "MIGX_id":22,
              "field":"published",
              "caption":"Publish?",
              "description":"This item will be hidden until you publish it",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"checkbox",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"Yes==1",
              "default":"0",
              "useDefaultIfEmpty":"0",
              "pos":4
            },
            {
              "MIGX_id":24,
              "field":"product_area_img",
              "caption":"Image",
              "description":"Add an (optional) image",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"image",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":[
                {
                  "MIGX_id":1,
                  "context":"web",
                  "sourceid":2
                }
              ],
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":5
            }
          ],
          "pos":1
        },
        {
          "MIGX_id":6,
          "caption":"Treatment Groups",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":23,
              "field":"x_product_groups",
              "caption":"Treatment Groups",
              "description":"Add, edit or delete treatment groups. Note: The parent treatment group must have been saved to add items.",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"migxdb",
              "validation":"",
              "configs":"x_product_groups",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":1
            }
          ],
          "pos":2
        }
      ],
      "contextmenus":"update||duplicate||publish||unpublish||remove",
      "actionbuttons":"addItem",
      "columnbuttons":"update||duplicate||publish||unpublish||remove",
      "filters":"",
      "extended":{
        "migx_add":"Add a Treatment Area",
        "disable_add_item":"",
        "add_items_directly":"",
        "formcaption":"Add or Edit Area",
        "update_win_title":"Edit Treatment Areas",
        "win_id":"x_product_areas",
        "maxRecords":"",
        "addNewItemAt":"bottom",
        "multiple_formtabs":"",
        "multiple_formtabs_label":"",
        "multiple_formtabs_field":"",
        "multiple_formtabs_optionstext":"",
        "multiple_formtabs_optionsvalue":"",
        "actionbuttonsperrow":4,
        "winbuttonslist":"cancel||done",
        "extrahandlers":"",
        "filtersperrow":4,
        "packageName":"x_products",
        "classname":"x_product_area",
        "task":"",
        "getlistsort":"",
        "getlistsortdir":"",
        "sortconfig":"",
        "gridpagesize":"",
        "use_custom_prefix":"0",
        "prefix":"",
        "grid":"",
        "gridload_mode":2,
        "check_resid":"0",
        "check_resid_TV":"",
        "join_alias":"",
        "has_jointable":"no",
        "getlistwhere":"",
        "joins":"",
        "cmpmaincaption":"Edit Treatment Areas",
        "cmptabcaption":"Treatment Areas",
        "cmptabdescription":"Add, edit or remove treatment areas",
        "cmptabcontroller":"",
        "winbuttons":"",
        "onsubmitsuccess":"",
        "submitparams":""
      },
      "columns":[
        {
          "MIGX_id":1,
          "header":"ID",
          "dataIndex":"id",
          "width":10,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":2,
          "header":"Treatment Area",
          "dataIndex":"product_area_name",
          "width":30,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":6,
          "header":"Image",
          "dataIndex":"product_area_img",
          "width":30,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":5,
          "header":"Column",
          "dataIndex":"col",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":3,
          "header":"Position",
          "dataIndex":"pos",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":4,
          "header":"Published?",
          "dataIndex":"published",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"this.renderClickCrossTick",
          "clickaction":"switchOption",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        }
      ]
    }


    x_product_groups
    {
      "formtabs":[
        {
          "MIGX_id":1,
          "caption":"Treatment Group",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":1,
              "field":"product_group_name",
              "caption":"Treatment",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":1
            },
            {
              "MIGX_id":2,
              "field":"product_group_desc",
              "caption":"Description",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":2
            },
            {
              "MIGX_id":16,
              "field":"product_group_note",
              "caption":"Note",
              "description":"Add an optional note to this treatment group",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":3
            }
          ],
          "pos":1
        },
        {
          "MIGX_id":2,
          "caption":"Settings",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":17,
              "field":"published",
              "caption":"Publish?",
              "description":"This item will be hidden until you publish it",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"checkbox",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"Yes==1",
              "default":"0",
              "useDefaultIfEmpty":"0",
              "pos":1
            },
            {
              "MIGX_id":18,
              "field":"pos",
              "caption":"Position",
              "description":"Choose the order of items by editing the number. 1 positions item at the top, higher numbers are lower down",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"number",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":1,
              "useDefaultIfEmpty":"0",
              "pos":2
            }
          ],
          "pos":2
        },
        {
          "MIGX_id":3,
          "caption":"Items",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":19,
              "field":"x_products",
              "caption":"Items",
              "description":"Add, edit or delete items. Note: The treatment must have been saved to add items.",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"migxdb",
              "validation":"",
              "configs":"x_products",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":1
            }
          ],
          "pos":3
        }
      ],
      "contextmenus":"update||duplicate||publish||unpublish||remove",
      "actionbuttons":"addItem",
      "columnbuttons":"update||duplicate||publish||unpublish||remove",
      "filters":"",
      "extended":{
        "migx_add":"Add a Treatment Group",
        "disable_add_item":"",
        "add_items_directly":"",
        "formcaption":"Add, edit or remove treatment group",
        "update_win_title":"Edit Treatment Group",
        "win_id":"x_product_groups",
        "maxRecords":"",
        "addNewItemAt":"bottom",
        "multiple_formtabs":"",
        "multiple_formtabs_label":"",
        "multiple_formtabs_field":"",
        "multiple_formtabs_optionstext":"",
        "multiple_formtabs_optionsvalue":"",
        "actionbuttonsperrow":4,
        "winbuttonslist":"cancel||done",
        "extrahandlers":"",
        "filtersperrow":4,
        "packageName":"x_products",
        "classname":"x_product_group",
        "task":"",
        "getlistsort":"",
        "getlistsortdir":"",
        "sortconfig":"",
        "gridpagesize":20,
        "use_custom_prefix":"0",
        "prefix":"",
        "grid":"",
        "gridload_mode":2,
        "check_resid":"0",
        "check_resid_TV":"",
        "join_alias":"area",
        "has_jointable":"no",
        "getlistwhere":"",
        "joins":"",
        "cmpmaincaption":"Manage Treatment Groups",
        "cmptabcaption":"Treatments Groups",
        "cmptabdescription":"Add, edit or remove treatment groups below. Edit items by right-clicking them.",
        "cmptabcontroller":"",
        "winbuttons":"",
        "onsubmitsuccess":"",
        "submitparams":""
      },
      "columns":[
        {
          "MIGX_id":1,
          "header":"ID",
          "dataIndex":"id",
          "width":10,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":2,
          "header":"Treatment Group",
          "dataIndex":"product_group_name",
          "width":35,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":4,
          "header":"Position",
          "dataIndex":"pos",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":5,
          "header":"Published",
          "dataIndex":"published",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"this.renderClickCrossTick",
          "clickaction":"switchOption",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":6,
          "header":"Treatment Group ID",
          "dataIndex":"product_group_id",
          "width":20,
          "sortable":"false",
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        }
      ]
    }


    x_products
    {
      "formtabs":[
        {
          "MIGX_id":4,
          "caption":"Item",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":8,
              "field":"treatment_item_name",
              "caption":"Item",
              "description":"",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":1
            },
            {
              "MIGX_id":9,
              "field":"treatment_item_price",
              "caption":"Price",
              "description":"Do not add \u00a3 symbol, it will be added automatically.",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"",
              "validation":"required",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":2
            },
            {
              "MIGX_id":10,
              "field":"pos",
              "caption":"Position",
              "description":"Choose the order of items by editing the number. 1 positions an item at the top, higher numbers are lower down,",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"number",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"",
              "default":"",
              "useDefaultIfEmpty":"0",
              "pos":3
            },
            {
              "MIGX_id":11,
              "field":"published",
              "caption":"Publish?",
              "description":"This item will be hidden until you publish it",
              "description_is_code":"0",
              "inputTV":"",
              "inputTVtype":"checkbox",
              "validation":"",
              "configs":"",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"",
              "inputOptionValues":"Yes==1",
              "default":"0",
              "useDefaultIfEmpty":"0",
              "pos":4
            }
          ],
          "pos":1
        }
      ],
      "contextmenus":"",
      "actionbuttons":"",
      "columnbuttons":"",
      "filters":"",
      "extended":{
        "migx_add":"",
        "disable_add_item":"",
        "add_items_directly":"",
        "formcaption":"Add or edit item",
        "update_win_title":"Edit Treatment Items",
        "win_id":"x_products",
        "maxRecords":"",
        "addNewItemAt":"bottom",
        "multiple_formtabs":"",
        "multiple_formtabs_label":"",
        "multiple_formtabs_field":"",
        "multiple_formtabs_optionstext":"",
        "multiple_formtabs_optionsvalue":"",
        "actionbuttonsperrow":4,
        "winbuttonslist":"",
        "extrahandlers":"",
        "filtersperrow":4,
        "packageName":"x_products",
        "classname":"x_product",
        "task":"",
        "getlistsort":"",
        "getlistsortdir":"",
        "sortconfig":"",
        "gridpagesize":"",
        "use_custom_prefix":"0",
        "prefix":"",
        "grid":"",
        "gridload_mode":2,
        "check_resid":"0",
        "check_resid_TV":"",
        "join_alias":"group",
        "has_jointable":"no",
        "getlistwhere":"",
        "joins":"",
        "cmpmaincaption":"",
        "cmptabcaption":"",
        "cmptabdescription":"",
        "cmptabcontroller":"",
        "winbuttons":"",
        "onsubmitsuccess":"",
        "submitparams":""
      },
      "columns":[
        {
          "MIGX_id":1,
          "header":"ID",
          "dataIndex":"id",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":2,
          "header":"Item",
          "dataIndex":"product_name",
          "width":15,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":3,
          "header":"Price",
          "dataIndex":"product_price",
          "width":10,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":4,
          "header":"Position",
          "dataIndex":"pos",
          "width":8,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":5,
          "header":"Published?",
          "dataIndex":"published",
          "width":12,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"this.renderClickCrossTick",
          "clickaction":"switchOption",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        },
        {
          "MIGX_id":6,
          "header":"Treatment ID",
          "dataIndex":"product_id",
          "width":"",
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"",
          "editor":""
        }
      ]
    }


    I’m afraid I seem to have hit a brick wall here, and my understanding of XPDO and MySQL is rather limited.

    Any pointers are greatly appreciated!
      • 4172
      • 5,888 Posts
      it did work for me after changing this parts:

      for x_products:

          "check_resid":1,
          "check_resid_TV":"",
          "join_alias":"Group",
          "has_jointable":"no",
      


      for x_product_groups

          "check_resid":1,
          "check_resid_TV":"",
          "join_alias":"Area",
          "has_jointable":"no",
      


      I don't think this was an issue, but to follow some standards, I did also change the package-name to 'xproducts'
      and the schema on my test-scenario to:

      <?xml version="1.0" encoding="UTF-8"?>
      <model package="xproducts" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
       
          <object class="xProductArea" table="x_product_areas" extends="xPDOSimpleObject">
               
              <field key="product_area_name" dbtype="text" phptype="string" null="false" default=""/>
               
              <composite alias="Groups" class="xProductGroup" local="id" foreign="product_group_id" cardinality="many" owner="local"/>
       
          </object>
           
          <object class="xProductGroup" table="x_product_groups" extends="xPDOSimpleObject">
       
              <field key="product_group_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index"/>     
       
              <field key="product_group_name" dbtype="text" phptype="string" null="false" default=""/>
       
              <aggregate alias="Area" class="xProductArea" local="product_group_id" foreign="id" cardinality="one" owner="foreign"/>
              <composite alias="Products" class="xProduct" local="id" foreign="product_id" cardinality="many" owner="local"/>
       
          </object>
           
          <object class="xProduct" table="x_products" extends="xPDOSimpleObject">
               
              <field key="product_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index"/>
               
              <field key="product_name" dbtype="text" phptype="string" null="false" default=""/>
               
              <aggregate alias="Group" class="xProductGroup" local="product_id" foreign="id" cardinality="one" owner="foreign"/>
       
          </object>
       
      </model>
      

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 24414
        • 45 Posts
        Thanks very much for the prompt reply Bruno.

        I had a brief fiddle but unfortunately my attention has been pulled elsewhere for a couple of days. I still seem to be having an issue with form saving but when I am back on this I will strip it back to the bare bones to see if this can be got to the bottom of.

          • 24414
          • 45 Posts
          Nearly there it seems.

          I can now save items, however when deleting a parent item child items are not removed and I get this error in the logs:

          (ERROR @ /assets/components/migx/connector.php) Error removing dependent object: Array
          (
              [id] => 20
              [product_group_id] => 9
              [product_group_name] => Test Group
              [product_group_desc] => Test description
              [product_group_note] => 
              [pos] => 1
              [deleted] => 0
              [published] => 1
          )



          My current schema:

          <?xml version="1.0" encoding="UTF-8"?>
          <model package="xproducts" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
          
              <object class="xProductArea" table="x_product_areas" extends="xPDOSimpleObject">
                  
          		<field key="product_area_name" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_area_desc" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_area_note" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_area_img" dbtype="text" phptype="string" null="false" default=""/>
          
          		<field key="col" dbtype="tinyint" precision="1" phptype="integer" null="false" default="1"/>
          		<field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="1"/>
          
          		<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
                  <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
                  
                  <composite alias="Groups" class="xProductGroup" local="id" foreign="product_group_id" cardinality="many" owner="local"/>
          
              </object>
              
              <object class="xProductGroup" table="x_product_groups" extends="xPDOSimpleObject">
          
          		<field key="product_group_id" dbtype="int" precision="10" phptype="integer" null="false" default=""/>
          		
          		<field key="product_group_name" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_group_desc" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_group_note" dbtype="text" phptype="string" null="false" default=""/>
          
          		<field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="1"/>
          
          		<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
                  <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
                  
                  <aggregate alias="Area" class="xProductArea" local="product_group_id" foreign="id" cardinality="one" owner="foreign"/>
                  <composite alias="Products" class="xProduct" local="id" foreign="product_id" cardinality="many" owner="local"/>
          
              </object>
              
              <object class="xProduct" table="x_products" extends="xPDOSimpleObject">
                  
                  <field key="product_id" dbtype="int" precision="10" phptype="integer" null="false" default=""/>
                  
          		<field key="product_name" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_note" dbtype="text" phptype="string" null="false" default=""/>
          		<field key="product_price" dbtype="varchar" precision="30" phptype="string" null="false" default=""/>
          
          		<field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="1"/>
          
          		<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
                  <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
                  
                  <aggregate alias="Group" class="xProductGroup" local="product_id" foreign="id" cardinality="one" owner="foreign"/>
          
              </object>
          
          </model>



          Configuration


          x_product_areas:

          {
            "formtabs":[
              {
                "MIGX_id":11,
                "caption":"Settings",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":34,
                    "field":"product_area_name",
                    "caption":"Name",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"required",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":1
                  },
                  {
                    "MIGX_id":37,
                    "field":"published",
                    "caption":"Publish?",
                    "description":"This item will be hidden if this box is not checked",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"checkbox",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"Yes==1",
                    "default":"0",
                    "useDefaultIfEmpty":"0",
                    "pos":2
                  },
                  {
                    "MIGX_id":39,
                    "field":"col",
                    "caption":"Column",
                    "description":"Should this sit in the first or second column?",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"option",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"1||2",
                    "default":1,
                    "useDefaultIfEmpty":"0",
                    "pos":3
                  },
                  {
                    "MIGX_id":40,
                    "field":"pos",
                    "caption":"Position",
                    "description":"Lower numbers position items higher in the list",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"number",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":1,
                    "useDefaultIfEmpty":"0",
                    "pos":4
                  },
                  {
                    "MIGX_id":41,
                    "field":"product_area_img",
                    "caption":"Image",
                    "description":"Add, edit or remove image [optional]",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"image",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":[
                      {
                        "MIGX_id":1,
                        "context":"web",
                        "sourceid":2
                      }
                    ],
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":5
                  },
                  {
                    "MIGX_id":42,
                    "field":"product_area_note",
                    "caption":"Note",
                    "description":"Add a note to this item [optional]",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":6
                  }
                ],
                "pos":1
              },
              {
                "MIGX_id":12,
                "caption":"Treatment Groups",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":35,
                    "field":"product_groups",
                    "caption":"Treatment Groups",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"migxdb",
                    "validation":"",
                    "configs":"x_product_groups",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":1
                  }
                ],
                "pos":2
              }
            ],
            "contextmenus":"update||duplicate||publish||unpublish||remove",
            "actionbuttons":"addItem",
            "columnbuttons":"update||duplicate||publish||unpublish||remove",
            "filters":"",
            "extended":{
              "migx_add":"Add a Treatment Area",
              "disable_add_item":"",
              "add_items_directly":"",
              "formcaption":"Add or edit treatment area ",
              "update_win_title":"Edit Treatment Area",
              "win_id":"x_treatment_areas",
              "maxRecords":"",
              "addNewItemAt":"bottom",
              "multiple_formtabs":"",
              "multiple_formtabs_label":"",
              "multiple_formtabs_field":"",
              "multiple_formtabs_optionstext":"",
              "multiple_formtabs_optionsvalue":"",
              "actionbuttonsperrow":4,
              "winbuttonslist":"",
              "extrahandlers":"",
              "filtersperrow":4,
              "packageName":"xproducts",
              "classname":"xProductArea",
              "task":"",
              "getlistsort":"",
              "getlistsortdir":"",
              "sortconfig":"",
              "gridpagesize":"",
              "use_custom_prefix":"0",
              "prefix":"",
              "grid":"",
              "gridload_mode":1,
              "check_resid":"0",
              "check_resid_TV":"",
              "join_alias":"",
              "has_jointable":"no",
              "getlistwhere":"",
              "joins":"",
              "cmpmaincaption":"Treatment Areas",
              "cmptabcaption":"Edit Treatment Areas",
              "cmptabdescription":"Edit items below by right-clicking them",
              "cmptabcontroller":"",
              "winbuttons":"",
              "onsubmitsuccess":"",
              "submitparams":""
            },
            "columns":[
              {
                "MIGX_id":1,
                "header":"ID",
                "dataIndex":"id",
                "width":10,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":2,
                "header":"Treatment Area Name",
                "dataIndex":"product_area_name",
                "width":80,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":4,
                "header":"Column",
                "dataIndex":"col",
                "width":10,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":5,
                "header":"Position",
                "dataIndex":"pos",
                "width":10,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":3,
                "header":"Published?",
                "dataIndex":"published",
                "width":10,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"this.renderClickCrossTick",
                "clickaction":"switchOption",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              }
            ]
          }



          x_product_groups

          {
            "formtabs":[
              {
                "MIGX_id":9,
                "caption":"Settings",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":32,
                    "field":"product_group_name",
                    "caption":"Name",
                    "description":"Required",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"required",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":1
                  },
                  {
                    "MIGX_id":38,
                    "field":"published",
                    "caption":"Publish?",
                    "description":"This item will be hidden if this box is not checked",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"checkbox",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"Yes==1",
                    "default":"0",
                    "useDefaultIfEmpty":"0",
                    "pos":2
                  },
                  {
                    "MIGX_id":43,
                    "field":"pos",
                    "caption":"Position",
                    "description":"Lower numbers sit higher in the list",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"number",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":1,
                    "useDefaultIfEmpty":"0",
                    "pos":3
                  },
                  {
                    "MIGX_id":44,
                    "field":"product_group_desc",
                    "caption":"Description",
                    "description":"Required",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"textarea",
                    "validation":"required",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":4
                  },
                  {
                    "MIGX_id":45,
                    "field":"product_group_note",
                    "caption":"Note",
                    "description":"Add a note to this group [optional]",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":5
                  }
                ],
                "pos":1
              },
              {
                "MIGX_id":10,
                "caption":"Treatments",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":33,
                    "field":"x_products",
                    "caption":"Treatments",
                    "description":"You must save the parent group before you can add products",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"migxdb",
                    "validation":"",
                    "configs":"x_products",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":1
                  }
                ],
                "pos":2
              }
            ],
            "contextmenus":"update||duplicate||publish||unpublish||remove",
            "actionbuttons":"addItem",
            "columnbuttons":"update||duplicate||publish||unpublish||remove",
            "filters":"",
            "extended":{
              "migx_add":"Add a Treatment Group",
              "disable_add_item":"",
              "add_items_directly":"",
              "formcaption":"Add or edit treatment group",
              "update_win_title":"Edit Treatment Group",
              "win_id":"x_product_groups",
              "maxRecords":"",
              "addNewItemAt":"bottom",
              "multiple_formtabs":"",
              "multiple_formtabs_label":"",
              "multiple_formtabs_field":"",
              "multiple_formtabs_optionstext":"",
              "multiple_formtabs_optionsvalue":"",
              "actionbuttonsperrow":4,
              "winbuttonslist":"",
              "extrahandlers":"",
              "filtersperrow":4,
              "packageName":"xproducts",
              "classname":"xProductGroup",
              "task":"",
              "getlistsort":"",
              "getlistsortdir":"",
              "sortconfig":"",
              "gridpagesize":"",
              "use_custom_prefix":"0",
              "prefix":"",
              "grid":"",
              "gridload_mode":1,
              "check_resid":1,
              "check_resid_TV":"",
              "join_alias":"Area",
              "has_jointable":"no",
              "getlistwhere":"",
              "joins":"",
              "cmpmaincaption":"Treatment Groups",
              "cmptabcaption":"Edit Treatment Groups",
              "cmptabdescription":"Edit items below by right-clicking them",
              "cmptabcontroller":"",
              "winbuttons":"",
              "onsubmitsuccess":"",
              "submitparams":""
            },
            "columns":[
              {
                "MIGX_id":1,
                "header":"ID",
                "dataIndex":"id",
                "width":10,
                "sortable":"false",
                "show_in_grid":"0",
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":2,
                "header":"Name",
                "dataIndex":"product_group_name",
                "width":70,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":5,
                "header":"Position",
                "dataIndex":"pos",
                "width":15,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":3,
                "header":"Group ID",
                "dataIndex":"product_group_id",
                "width":10,
                "sortable":true,
                "show_in_grid":"0",
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":4,
                "header":"Published?",
                "dataIndex":"published",
                "width":15,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"this.renderClickCrossTick",
                "clickaction":"switchOption",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              }
            ]
          }



          x_products

          {
            "formtabs":[
              {
                "MIGX_id":13,
                "caption":"Settings",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":36,
                    "field":"product_name",
                    "caption":"Treatment",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"required",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":1
                  },
                  {
                    "MIGX_id":46,
                    "field":"product_price",
                    "caption":"Price",
                    "description":"Do not add \u00a3 symbol",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"number",
                    "validation":"required",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":2
                  },
                  {
                    "MIGX_id":47,
                    "field":"pos",
                    "caption":"Position",
                    "description":"Lower numbers show higher in the list",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"number",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":1,
                    "useDefaultIfEmpty":"0",
                    "pos":3
                  },
                  {
                    "MIGX_id":48,
                    "field":"published",
                    "caption":"Publish?",
                    "description":"This item will be hidden unless this box is checked",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"checkbox",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"Yes==1",
                    "default":"0",
                    "useDefaultIfEmpty":"0",
                    "pos":4
                  }
                ],
                "pos":1
              }
            ],
            "contextmenus":"update||duplicate||publish||unpublish||remove",
            "actionbuttons":"addItem",
            "columnbuttons":"update||duplicate||publish||unpublish||remove",
            "filters":"",
            "extended":{
              "migx_add":"Add a Treatment",
              "disable_add_item":"",
              "add_items_directly":"",
              "formcaption":"Add or edit treatment",
              "update_win_title":"Edit Treatment",
              "win_id":"x_products",
              "maxRecords":"",
              "addNewItemAt":"bottom",
              "multiple_formtabs":"",
              "multiple_formtabs_label":"",
              "multiple_formtabs_field":"",
              "multiple_formtabs_optionstext":"",
              "multiple_formtabs_optionsvalue":"",
              "actionbuttonsperrow":4,
              "winbuttonslist":"",
              "extrahandlers":"",
              "filtersperrow":4,
              "packageName":"xproducts",
              "classname":"xProduct",
              "task":"",
              "getlistsort":"",
              "getlistsortdir":"",
              "sortconfig":"",
              "gridpagesize":"",
              "use_custom_prefix":"0",
              "prefix":"",
              "grid":"",
              "gridload_mode":1,
              "check_resid":1,
              "check_resid_TV":"",
              "join_alias":"Group",
              "has_jointable":"no",
              "getlistwhere":"",
              "joins":"",
              "cmpmaincaption":"Treatments",
              "cmptabcaption":"Edit Treatments",
              "cmptabdescription":"Edit items below by right-clicking them",
              "cmptabcontroller":"",
              "winbuttons":"",
              "onsubmitsuccess":"",
              "submitparams":""
            },
            "columns":[
              {
                "MIGX_id":1,
                "header":"ID",
                "dataIndex":"id",
                "width":10,
                "sortable":true,
                "show_in_grid":"0",
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":2,
                "header":"Treatment",
                "dataIndex":"product_name",
                "width":45,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":4,
                "header":"Price",
                "dataIndex":"product_price",
                "width":15,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":6,
                "header":"Position",
                "dataIndex":"pos",
                "width":15,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":5,
                "header":"Published?",
                "dataIndex":"published",
                "width":15,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"this.renderClickCrossTick",
                "clickaction":"switchOption",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":7,
                "header":"Product ID",
                "dataIndex":"product ID",
                "width":10,
                "sortable":true,
                "show_in_grid":"0",
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              }
            ]
          }