We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46315
    • 30 Posts
    I've created two custom tables for a real estate website with one table holding the property's details and the other holding the property's image urls. All working well, however, I'm trying to include the images formtabs into the Realty formtab which it loads but without the images(table rows).

    This is the schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <model package="realestate" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
      <object class="Realty" table="realestate" extends="xPDOSimpleObject">
        <field key="Ref_no" dbtype="varchar" precision="20" phptype="string" null="false" default=""/>
        <field key="PropertyType" dbtype="varchar" precision="50" phptype="string" null="false" default=""/>
        <field key="Price" dbtype="float" precision="15,2" phptype="string" null="false" default="0.00"/>
    ...
        <field key="Bedrooms" dbtype="int" precision="10" phptype="integer" null="false" default="0"/>
        <field key="Bathrooms" dbtype="int" precision="10" phptype="integer" null="false" default="0"/>
    ...
    ...
        <field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
        <field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
        <field key="editedon" dbtype="datetime" phptype="datetime" null="true"/>
        <field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
        <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="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/>
        <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>
        <composite alias="prop_images" class="prop_images" local="Ref_no" foreign="Ref_no" cardinality="many" owner="local" />
      </object>
    
      <object class="prop_images" table="propimages" extends="xPDOSimpleObject">
        <field key="Ref_no" dbtype="varchar" precision="20" phptype="string" null="false" default=""/>
        <field key="imageurl" dbtype="varchar" precision="50" phptype="string" null="false" default=""/>
        <field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
        <field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
        <field key="editedon" dbtype="datetime" phptype="datetime" null="true"/>
        <field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
        <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="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/>
        <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>
        <aggregate alias="Propertys" class="Realty" local="Ref_no" foreign="Ref_no" cardinality="one" owner="foreign" />
      </object>
    </model>
    


    In the prop_images migx config I've assigned "Propertys" in the "Join Alias" field.

    No error's in the error log.

    Thanks in advance smiley

    System Info:
    MODX Revolution 2.3.3-pl
    MIGX migx-2.9.3-pl

    This question has been answered by Bruno17. See the first response.

      • 46315
      • 30 Posts
      There must be a simple solution to this one. I've either omitted a config setting or the join of Ref_no to Ref_no might not be right, this is just a guess.

      Help would very much be appreciated. smiley
        • 4172
        • 5,888 Posts
        could you also post your exported MIGX-configs, please!
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 46315
          • 30 Posts
          Quote from: Bruno17 at Oct 19, 2015, 06:52 AM
          could you also post your exported MIGX-configs, please!

          The schema has changed:
          <?xml version="1.0" encoding="UTF-8"?>
          <model package="properties" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
            <object class="Property" table="properties" extends="xPDOSimpleObject">
              <field key="Reference" dbtype="varchar" precision="20" phptype="string" null="false" default=""/>
             ....
              <field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
              <field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
              <field key="editedon" dbtype="datetime" phptype="datetime" null="true"/>
              <field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
              <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="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/>
              <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>
              <composite alias="prop_images" class="prop_images" local="Reference" foreign="Reference" cardinality="many" owner="local" />
            </object>
          
            <object class="prop_images" table="propimages" extends="xPDOSimpleObject">
              <field key="Reference" dbtype="varchar" precision="20" phptype="string" null="false" default=""/>
              <field key="imageurl" dbtype="varchar" precision="50" phptype="string" null="false" default=""/>
              <field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
              <field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
              <field key="editedon" dbtype="datetime" phptype="datetime" null="true"/>
              <field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
              <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="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/>
              <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>
              <aggregate alias="Propertys" class="Property" local="Reference" foreign="Reference" cardinality="one" owner="foreign" />
            </object>
          </model>
          


          Config "properties"
          {
            "formtabs":[
              {
                "MIGX_id":1,
                "caption":"Property Specifications",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":1,
                    "field":"Reference",
                    "caption":"Reference",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":1
                  },
                  {
                    "MIGX_id":23,
                    "field":"Sold",
                    "caption":"Sold \/ Available \/ Under Offer \/ Off Market \/ Temporarily Off Market",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"listbox",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"Available==0||Sold==1||Temporarily Off Market==2||Off Market==3||Under Offer==4",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":2
                  },
                  {
                    "MIGX_id":12,
                    "field":"PropGallery",
                    "caption":"Property Images",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"propgallery",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":3
                  },
                  {
                    "MIGX_id":2,
                    "field":"PropertyType",
                    "caption":"Property Type",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":4
                  },
                  {
                    "MIGX_id":3,
                    "field":"SubType",
                    "caption":"Sub Type",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":5
                  },
                  {
                    "MIGX_id":4,
                    "field":"Location",
                    "caption":"Location",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":6
                  },
                  {
                    "MIGX_id":5,
                    "field":"Category",
                    "caption":"Category",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"-- Choose Category --",
                    "pos":7
                  },
                  {
                    "MIGX_id":6,
                    "field":"Price",
                    "caption":"Price",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":8
                  },
                  {
                    "MIGX_id":11,
                    "field":"PricePM",
                    "caption":"Price Override",
                    "description":"The price placed here will be the main overriding price. !!CLEAR CACHE ONCE CHANGED!!",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":9
                  },
                  {
                    "MIGX_id":20,
                    "field":"Price_on_app",
                    "caption":"Price on application",
                    "description":"check to hide price - !!CLEAR CACHE ONCE CHANGED!!",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"checkbox",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"Hide price==1",
                    "default":"0",
                    "useDefaultIfEmpty":"0",
                    "pos":10
                  },
                  {
                    "MIGX_id":21,
                    "field":"Bedrooms",
                    "caption":"Beds",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":11
                  },
                  {
                    "MIGX_id":22,
                    "field":"Bathrooms",
                    "caption":"Baths",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":12
                  },
                  {
                    "MIGX_id":18,
                    "field":"BuiltArea",
                    "caption":"Built Area",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":13
                  },
                  {
                    "MIGX_id":17,
                    "field":"PlotArea",
                    "caption":"Plot Area",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":14
                  },
                  {
                    "MIGX_id":19,
                    "field":"TerraceArea",
                    "caption":"Terrace Area",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":15
                  },
                  {
                    "MIGX_id":7,
                    "field":"Description",
                    "caption":"Description",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"textarea",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":16
                  },
                  {
                    "MIGX_id":8,
                    "field":"Features",
                    "caption":"Features",
                    "description":"For Editing Only!! It is very important to follow this format:",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"textarea",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":17
                  },
                  {
                    "MIGX_id":9,
                    "field":"inBanner",
                    "caption":"Display Property in Carousel Banner",
                    "description":"please limit to about 5 in order to reduce page load.",
                    "description_is_code":"0",
                    "inputTV":"inbanner",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":18
                  },
                  {
                    "MIGX_id":10,
                    "field":"Online",
                    "caption":"Online",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":19
                  }
                ],
                "pos":1
              },
              {
                "MIGX_id":4,
                "caption":"Images",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":24,
                    "field":"propimages_embed",
                    "caption":"Property Images",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"migxdb",
                    "validation":"",
                    "configs":"propimages_embed",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "useDefaultIfEmpty":"0",
                    "pos":1
                  }
                ],
                "pos":2
              }
            ],
            "contextmenus":"update||unpublish||activate||recall_remove_delete",
            "actionbuttons":"addItem||bulk||toggletrash",
            "columnbuttons":"",
            "filters":[
              {
                "MIGX_id":1,
                "name":"search",
                "label":"Search by Ref of Category.",
                "emptytext":"",
                "type":"textbox",
                "getlistwhere":{
                  "Reference:LIKE":"%[[+search]]%",
                  "OR:Category:LIKE":"%[[+search]]%"
                },
                "getcomboprocessor":"",
                "combotextfield":"",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              },
              {
                "MIGX_id":2,
                "name":"typefilter",
                "label":"Type",
                "emptytext":"- filter by type -",
                "type":"combobox",
                "getlistwhere":{
                  "PropertyType":"[[+typefilter]]"
                },
                "getcomboprocessor":"getcombo",
                "combotextfield":"PropertyType",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              },
              {
                "MIGX_id":3,
                "name":"areafilter",
                "label":"Area Filter",
                "emptytext":"- filter by area -",
                "type":"combobox",
                "getlistwhere":{
                  "Location":"[[+areafilter]]"
                },
                "getcomboprocessor":"getcombo",
                "combotextfield":"Location",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              },
              {
                "MIGX_id":7,
                "name":"publishedfilter",
                "label":"Published Filter",
                "emptytext":"- published items -",
                "type":"combobox",
                "getlistwhere":{
                  "published":"[[+publishedfilter]]"
                },
                "getcomboprocessor":"getcombo",
                "combotextfield":"inbanner",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              },
              {
                "MIGX_id":5,
                "name":"highlightedfilter",
                "label":"Highlighted Filter",
                "emptytext":"- highlighted -",
                "type":"combobox",
                "getlistwhere":{
                  "highlighted":"[[+highlightedfilter]]"
                },
                "getcomboprocessor":"getcombo",
                "combotextfield":"highlighted",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              },
              {
                "MIGX_id":6,
                "name":"inbannerfilter",
                "label":"In Banner Filter",
                "emptytext":"- banner items -",
                "type":"combobox",
                "getlistwhere":{
                  "inbanner":"[[+inbannerfilter]]"
                },
                "getcomboprocessor":"getcombo",
                "combotextfield":"inbanner",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              },
              {
                "MIGX_id":8,
                "name":"categoryfilter",
                "label":"Category",
                "emptytext":"- filter by category -",
                "type":"combobox",
                "getlistwhere":{
                  "Category:LIKE":"%[[+categoryfilter]]%"
                },
                "getcomboprocessor":"tvgetcombo",
                "combotextfield":"prop_cat",
                "comboidfield":"",
                "comboparent":"",
                "default":""
              }
            ],
            "extended":{
              "migx_add":"Add Property",
              "disable_add_item":"",
              "add_items_directly":"",
              "formcaption":"Properties",
              "update_win_title":"Properties",
              "win_id":"properties",
              "maxRecords":"",
              "addNewItemAt":"top",
              "multiple_formtabs":"",
              "multiple_formtabs_label":"",
              "multiple_formtabs_field":"",
              "multiple_formtabs_optionstext":"",
              "multiple_formtabs_optionsvalue":"",
              "actionbuttonsperrow":4,
              "winbuttonslist":"",
              "extrahandlers":"gridfilter||this.addItem||this.handleColumnSwitch",
              "filtersperrow":4,
              "packageName":"properties",
              "classname":"Property",
              "task":"",
              "getlistsort":"",
              "getlistsortdir":"",
              "sortconfig":"",
              "gridpagesize":"",
              "use_custom_prefix":"0",
              "prefix":"",
              "grid":"",
              "gridload_mode":1,
              "check_resid":1,
              "check_resid_TV":"",
              "join_alias":"",
              "has_jointable":"no",
              "getlistwhere":"",
              "joins":"",
              "hooksnippets":"",
              "cmpmaincaption":"Properties",
              "cmptabcaption":"Properties",
              "cmptabdescription":"Please add your property here",
              "cmptabcontroller":"",
              "winbuttons":"",
              "onsubmitsuccess":"",
              "submitparams":""
            },
            "columns":[
              {
                "MIGX_id":1,
                "header":"ID",
                "dataIndex":"id",
                "width":40,
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":2,
                "header":"Reference",
                "dataIndex":"Reference",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":5,
                "header":"Location",
                "dataIndex":"Location",
                "width":"",
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":4,
                "header":"Type",
                "dataIndex":"PropertyType",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":14,
                "header":"Sub Type",
                "dataIndex":"SubType",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":6,
                "header":"Category",
                "dataIndex":"Category",
                "width":"",
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":7,
                "header":"Sold",
                "dataIndex":"Sold",
                "width":50,
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              },
              {
                "MIGX_id":9,
                "header":"Price",
                "dataIndex":"Price",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":11,
                "header":"Banner Item",
                "dataIndex":"inbanner",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"this.renderSwitchStatusOptions",
                "clickaction":"switchOption",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":[
                  {
                    "MIGX_id":1,
                    "name":"include",
                    "value":1,
                    "clickaction":"",
                    "handler":"",
                    "image":"assets\/components\/migx\/style\/images\/tick.png"
                  },
                  {
                    "MIGX_id":2,
                    "name":"exclude",
                    "value":"0",
                    "clickaction":"",
                    "handler":"",
                    "image":"assets\/components\/migx\/style\/images\/cross.png"
                  }
                ]
              },
              {
                "MIGX_id":12,
                "header":"Published",
                "dataIndex":"published",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"this.renderSwitchStatusOptions",
                "clickaction":"switchOption",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":[
                  {
                    "MIGX_id":1,
                    "name":"published",
                    "value":1,
                    "clickaction":"",
                    "handler":"",
                    "image":"assets\/components\/migx\/style\/images\/tick.png"
                  },
                  {
                    "MIGX_id":2,
                    "name":"unpublish",
                    "value":"0",
                    "clickaction":"",
                    "handler":"",
                    "image":"assets\/components\/migx\/style\/images\/cross.png"
                  }
                ]
              },
              {
                "MIGX_id":13,
                "header":"Highlighted",
                "dataIndex":"highlighted",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"this.renderSwitchStatusOptions",
                "clickaction":"switchOption",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":[
                  {
                    "MIGX_id":1,
                    "name":"include",
                    "value":1,
                    "clickaction":"",
                    "handler":"",
                    "image":"assets\/components\/migx\/style\/images\/tick.png"
                  },
                  {
                    "MIGX_id":2,
                    "name":"exclude",
                    "value":"0",
                    "clickaction":"",
                    "handler":"",
                    "image":"assets\/components\/migx\/style\/images\/cross.png"
                  }
                ]
              }
            ]
          }


          Config "propimages_embed":
          {
            "formtabs":[
              {
                "MIGX_id":6,
                "caption":"Edit Image",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":27,
                    "field":"Reference",
                    "caption":"Reference",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":1
                  },
                  {
                    "MIGX_id":28,
                    "field":"imageurl",
                    "caption":"Image URL",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"[]",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":2
                  }
                ],
                "pos":1
              }
            ],
            "contextmenus":"update||unpublish||activate||recall_remove_delete",
            "actionbuttons":"bulk||toggletrash",
            "columnbuttons":"",
            "filters":"",
            "extended":{
              "migx_add":"Add Images",
              "disable_add_item":"",
              "add_items_directly":"",
              "formcaption":"Property Images",
              "update_win_title":"Property Images",
              "win_id":"propimages_embed",
              "maxRecords":"",
              "addNewItemAt":"bottom",
              "multiple_formtabs":"",
              "multiple_formtabs_label":"",
              "multiple_formtabs_field":"",
              "multiple_formtabs_optionstext":"",
              "multiple_formtabs_optionsvalue":"",
              "actionbuttonsperrow":4,
              "winbuttonslist":"",
              "extrahandlers":"",
              "filtersperrow":4,
              "packageName":"properties",
              "classname":"prop_images",
              "task":"",
              "getlistsort":"",
              "getlistsortdir":"",
              "sortconfig":"",
              "gridpagesize":"",
              "use_custom_prefix":"0",
              "prefix":"",
              "grid":"",
              "gridload_mode":2,
              "check_resid":1,
              "check_resid_TV":"",
              "join_alias":"Propertys",
              "has_jointable":"no",
              "getlistwhere":"",
              "joins":"",
              "hooksnippets":"",
              "cmpmaincaption":"",
              "cmptabcaption":"",
              "cmptabdescription":"",
              "cmptabcontroller":"",
              "winbuttons":"",
              "onsubmitsuccess":"",
              "submitparams":""
            },
            "columns":[
              {
                "MIGX_id":2,
                "header":"Reference",
                "dataIndex":"Reference",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":1,
                "header":"Image Url",
                "dataIndex":"imageurl",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"this.renderImage",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"[]"
              },
              {
                "MIGX_id":3,
                "header":"ID",
                "dataIndex":"id",
                "width":10,
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":"",
                "editor":""
              }
            ]
          }



          Thanks for the response smiley
            • 47401
            • 295 Posts
            so your using a one to many relational database scheme. one property to many images. correct me if im wrong but it looks like your using a many to many.

            could you not store the images as a BLOB? [ed. note: comp_nerd26 last edited this post 10 years, 11 months ago.]
            • discuss.answer
              • 4172
              • 5,888 Posts
              In your case, remove the joins-setting

              create a file under yourpackage/migxconfigs/propimages_embed.config.inc.php with:

              <?php
              $packageName = 'properties';
              $packagepath = $this->modx->getOption('core_path') . 'components/' . $packageName . '/';
              $modelpath = $packagepath . 'model/';
              if (is_dir($modelpath))
              {
                  $this->modx->addPackage($packageName, $modelpath);
              }
              
              
              $object_id = $this->modx->getOption('object_id', $_REQUEST, 0);
              
              if (!empty($object_id) && $object = $this->modx->getObject('Property', $object_id))
              {
                  $ref = $object->get('Reference');
                  $this->customconfigs['getlistwhere'] = '{"Reference":"' . $ref . '"}';
              }
              
              


              add an aftersave hooksnippet

              {"aftersave":"propertyimage_aftersave"}


              snippet code:

              $object = &$modx->getOption('object',$scriptProperties,null);
              $co_id = (int) $modx->getOption('co_id',$_REQUEST,0);
              
              if ($parent_object = $modx->getObject('Property',$co_id)){
                  $ref = $parent_object->get('Reference');
                  $object->set('Reference',$ref);
                  $object->save();
              }
              
              return '';
              


              To hide the images-grid on a new Property add to the images-field's Restrictive Condition:

              [[migxIsNewObject]]
              
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 46315
                • 30 Posts
                Quote from: comp_nerd26 at Oct 19, 2015, 09:21 AM
                so your using a one to many relational database scheme. one property to many images. correct me if im wrong but it looks like your using a many to many.

                could you not store the images as a BLOB?

                Hi comp_nerd26

                I'm still new to all this but I'm pretty sure it's a one property to many images, at least that's what I understand from the schema. It's very possible I have it wrong.

                Regarding storing as BLOB, I'm working on an existing database that has the images stored as urls and will probably stay with the same format for now. Nice suggestion though, Thanks smiley
                  • 46315
                  • 30 Posts
                  Hi Bruno

                  Thanks for your response.

                  This is what I did in regards to your response.

                  • Removed the join from the propimages_embed config
                  • added the yourpackage/migxconfigs/propimages_embed.config.inc.php file
                  • added an aftersave hooksnippet to the "properties" config "aftersave hooksnippet" field
                  • created a snippet called "propertyimage_aftersave" with the supplied content

                  Unfortunately still no luck.

                  Error Log
                   [2015-10-20 10:25:05] (ERROR @ /assets/components/migx/connector.php) Error 42S22 executing statement: 
                  Array
                  (
                      [0] => 42S22
                      [1] => 1054
                      [2] => Unknown column 'prop_images.resource_id' in 'where clause'
                  )
                  


                  Thanks
                    • 4172
                    • 5,888 Posts
                    ah, set 'Check Resource' to 'no'

                    this is my whole setup:

                    {
                      "formtabs":[
                        {
                          "MIGX_id":135,
                          "caption":"Edit Image",
                          "print_before_tabs":"0",
                          "fields":[
                            {
                              "MIGX_id":529,
                              "field":"Reference",
                              "caption":"Reference",
                              "description":"",
                              "description_is_code":"0",
                              "inputTV":"",
                              "inputTVtype":"",
                              "validation":"",
                              "configs":"",
                              "restrictive_condition":"",
                              "display":"",
                              "sourceFrom":"config",
                              "sources":"[]",
                              "inputOptionValues":"",
                              "default":"",
                              "pos":1
                            },
                            {
                              "MIGX_id":530,
                              "field":"imageurl",
                              "caption":"Image URL",
                              "description":"",
                              "description_is_code":"0",
                              "inputTV":"",
                              "inputTVtype":"",
                              "validation":"",
                              "configs":"",
                              "restrictive_condition":"",
                              "display":"",
                              "sourceFrom":"config",
                              "sources":"[]",
                              "inputOptionValues":"",
                              "default":"",
                              "pos":2
                            }
                          ],
                          "pos":1
                        }
                      ],
                      "contextmenus":"update||publish||unpublish||remove",
                      "actionbuttons":"addItem",
                      "columnbuttons":"",
                      "filters":"",
                      "extended":{
                        "migx_add":"Add Images",
                        "disable_add_item":"",
                        "add_items_directly":"",
                        "formcaption":"Property Images",
                        "update_win_title":"Property Images",
                        "win_id":"propimages_embed",
                        "maxRecords":"",
                        "addNewItemAt":"bottom",
                        "multiple_formtabs":"",
                        "multiple_formtabs_label":"",
                        "multiple_formtabs_field":"",
                        "multiple_formtabs_optionstext":"",
                        "multiple_formtabs_optionsvalue":"",
                        "actionbuttonsperrow":4,
                        "winbuttonslist":"",
                        "extrahandlers":"",
                        "filtersperrow":4,
                        "packageName":"properties",
                        "classname":"prop_images",
                        "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":"",
                        "hooksnippets":{
                          "aftersave":"propertyimage_aftersave"
                        },
                        "cmpmaincaption":"",
                        "cmptabcaption":"",
                        "cmptabdescription":"",
                        "cmptabcontroller":"",
                        "winbuttons":"",
                        "onsubmitsuccess":"",
                        "submitparams":""
                      },
                      "columns":[
                        {
                          "MIGX_id":2,
                          "header":"Reference",
                          "dataIndex":"Reference",
                          "width":"",
                          "sortable":"false",
                          "show_in_grid":1,
                          "renderer":"",
                          "clickaction":"",
                          "selectorconfig":"",
                          "renderchunktpl":"",
                          "renderoptions":"[]"
                        },
                        {
                          "MIGX_id":1,
                          "header":"Image Url",
                          "dataIndex":"imageurl",
                          "width":"",
                          "sortable":"false",
                          "show_in_grid":1,
                          "renderer":"this.renderImage",
                          "clickaction":"",
                          "selectorconfig":"",
                          "renderchunktpl":"",
                          "renderoptions":"[]"
                        },
                        {
                          "MIGX_id":3,
                          "header":"ID",
                          "dataIndex":"id",
                          "width":10,
                          "sortable":"false",
                          "show_in_grid":1,
                          "renderer":"",
                          "clickaction":"",
                          "selectorconfig":"",
                          "renderchunktpl":"",
                          "renderoptions":"",
                          "editor":""
                        }
                      ]
                    }
                    
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 46315
                      • 30 Posts
                      Fantastic, that did it!! Thank you so much.

                      Going to have to buy you a beer. smiley