We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    So, weve got a database which works very well, but we can only remove fields from the datbase, not unpublish but i'm not sure how.

    Im reading: https://forums.modx.com/thread/?thread=85105&page=1

    But im quite confused lol!

    my scheme is this:

    <?xml version="1.0" encoding="UTF-8"?>
    <model package="inventory" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
      <object class="inventory" table="inventory" extends="xPDOSimpleObject">
     <field key="ref" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
        <field key="year" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
        <field key="make" dbtype="text" phptype="string" null="false" default=""/>
        <field key="model" dbtype="text" phptype="string" null="false" default=""/>
        <field key="location" dbtype="text" phptype="string" null="false" default=""/>
        <field key="options" dbtype="text" phptype="string" null="false" default=""/>
        <field key="upholstery" dbtype="text" phptype="string" null="false" default=""/>
        <field key="price" dbtype="float" precision="25" phptype="float" default=""/>
        <field key="gallery" dbtype="int" precision="10" phptype="integer" null="false" default=""/>
     <field key="image" dbtype="int" precision="10" phptype="integer" null="false" default=""/>
        <field key="condition" dbtype="text" phptype="string" null="false" default=""/>
        <field key="description" dbtype="text" phptype="string" null="false" default=""/>
        <field key="intro" dbtype="text" phptype="string" null="false" default=""/>
        <field key="featured" dbtype="tinyint" precision="1" attributes="unsigned" 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"/>
      </object>
    </model>
    


    formtabs:

    [{"MIGX_id":"1","caption":"Make and Model","fields":[{"MIGX_id":"8","field":"ref","caption":"Reference #","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"1","field":"make","caption":"Make","inputTV":"in_Make","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"model","caption":"Model","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"3","field":"year","caption":"Year","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"4","field":"price","caption":"Price","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"4","caption":"Descriptions","fields":[{"MIGX_id":"1","field":"description","caption":"Description","inputTV":"","inputTVtype":"richtext","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"intro","caption":"Intro","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"2","caption":"Options and Upholstery","fields":[{"MIGX_id":"1","field":"options","caption":"Options","inputTV":"","inputTVtype":"textarea","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"upholstery","caption":"Upholstery","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"3","caption":"Gallery","fields":[{"MIGX_id":"1","field":"gallery","caption":"Gallery","inputTV":"in_Gallery","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"image","caption":"Image ID","inputTV":"","inputTVtype":"text","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"5","caption":"Location and Type","fields":[{"MIGX_id":"1","field":"location","caption":"Location","inputTV":"in_Location","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"condition","caption":"Condition","inputTV":"in_Condition","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"3","field":"featured","caption":"Featured","inputTV":"in_Featured","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]}]


    columns:

    [{"MIGX_id":"1","header":"ID","dataIndex":"id","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"15","header":"Reference","dataIndex":"ref","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"2","header":"Make","dataIndex":"make","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"3","header":"Model","dataIndex":"model","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"9","header":"Price","dataIndex":"price","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"4","header":"Year","dataIndex":"year","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"5","header":"Location","dataIndex":"location","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"6","header":"Options","dataIndex":"options","width":"","renderer":"","sortable":"false","show_in_grid":"0"},{"MIGX_id":"7","header":"Upholstery","dataIndex":"upholstery","width":"","renderer":"","sortable":"false","show_in_grid":"0"},{"MIGX_id":"8","header":"Gallery","dataIndex":"gallery","width":"","renderer":"","sortable":"false","show_in_grid":"0"},{"MIGX_id":"10","header":"Condition","dataIndex":"condition","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"11","header":"Description","dataIndex":"description","width":"","renderer":"","sortable":"false","show_in_grid":"0"},{"MIGX_id":"12","header":"Intro","dataIndex":"intro","width":"","renderer":"","sortable":"false","show_in_grid":"0"},{"MIGX_id":"13","header":"Featured","dataIndex":"featured","width":"","renderer":"","sortable":"false","show_in_grid":"1"},{"MIGX_id":"14","header":"Image ID","dataIndex":"image","width":"","renderer":"","sortable":"false","show_in_grid":"0"}]
    
      • 4172
      • 5,888 Posts
      add the published - field to your columns:

      ,{
              "MIGX_id": "15",
              "header": "",
              "dataIndex": "published",
              "width": "",
              "renderer": "",
              "sortable": "false",
              "show_in_grid": "0"
      }


      and select the publish/unpublish - context-menues
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 30912
        • 463 Posts
        Thats simple enough!

        I take it i need to add a published field to the display list snippet too?


        [ed. note: Bruno17 last edited this post 13 years, 3 months ago.]
          • 4172
          • 5,888 Posts
          if you are using migxLoopCollection use
          &where=`{"published":"1"}`
          to show only published records
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 30912
            • 463 Posts
            i'm not, were using a custom snippet so I will add a where parameter.

            Thanks
              • 30912
              • 463 Posts
              Thanks Bruno, this helped a charm.