<?xml version="1.0" encoding="UTF-8"?> <model package="staff" baseClass="xPDOObject" platform="mysql" defaultEngine="InnoDB" version="1.1"> <object class="StaffMember" table="staff_members" extends="xPDOSimpleObject" > <field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" /> <composite alias="StaffMemberCategories" class="StaffMemberCategories" local="id" foreign="staff_id" cardinality="many" owner="local" /> </object> <object class="StaffCategory" table="staff_categories" extends="xPDOSimpleObject" > <field key="category" dbtype="varchar" precision="255" phptype="string" null="false" default="" /> <composite alias="StaffMemberCategories" class="StaffMemberCategories" local="id" foreign="category_id" cardinality="many" owner="local" /> </object> <object class="StaffMemberCategories" table="staff_member_categories" extends="xPDOSimpleObject" > <field key="staff_id" dbtype="int" precision="11" phptype="integer" null="false" default="0" /> <field key="category_id" dbtype="int" precision="11" phptype="integer" null="false" default="0" /> <aggregate alias="StaffMembers" class="StaffMember" local="staff_id" foreign="id" cardinality="one" owner="foreign" /> <aggregate alias="StaffCategories" class="StaffCategory" local="category_id" foreign="id" cardinality="one" owner="foreign" /> </object> </model>
{
"formtabs":[
{
"MIGX_id":8,
"caption":"New Staff Member",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":22,
"field":"name",
"caption":"Staff Name",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
},
{
"MIGX_id":23,
"field":"staffmembercategories",
"caption":"Staff Categories",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"migxdb",
"validation":"",
"configs":"staff_member_categories",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":2
}
],
"pos":1
}
],
"contextmenus":"update||duplicate||publish||unpublish||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||duplicate||publish||unpublish||remove",
"filters":"",
"extended":{
"migx_add":"Add New Staff Member",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"staff_members",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"staff",
"classname":"StaffMember",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":2,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"",
"has_jointable":"yes",
"getlistwhere":"",
"joins":"",
"cmpmaincaption":"Staff Members",
"cmptabcaption":"All Staff Members",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"Staff Name",
"dataIndex":"name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}{
"formtabs":[
{
"MIGX_id":9,
"caption":"Staff Categories",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":24,
"field":"category_id",
"caption":"Category",
"description":"",
"description_is_code":"0",
"inputTV":"staff_categories",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
}
],
"pos":1
}
],
"contextmenus":"update||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||remove",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"staff_member_categories",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"staff",
"classname":"StaffMemberCategories",
"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":[
{
"alias":"StaffMembers"
},
{
"alias":"StaffCategories"
}
],
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"Staff ID",
"dataIndex":"staff_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":3,
"header":"Category ID",
"dataIndex":"category_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":4,
"header":"Staff Table ID",
"dataIndex":"StaffMembers_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":5,
"header":"Staff Name",
"dataIndex":"StaffMembers_name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":6,
"header":"Category Name",
"dataIndex":"StaffCategories_category",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}{"aftersave":"staff_member_categories_aftersave"}
<?php
$object = & $modx->getOption('object',$scriptProperties,null);
$properties = $modx->getOption('scriptProperties',$scriptProperties,array());
$postvalues = $modx->getOption('postvalues',$scriptProperties,array());
$co_id = $modx->getOption('co_id',$properties,0);
$configs = $modx->getOption('configs', $properties, '');
if ($object){
$object->set('staff_id',$co_id);
$object->save();
}
return '';
<?xml version="1.0" encoding="UTF-8"?>
<model package="flyerPricelist" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
<object class="fplPrices" table="migx_fpl_prices" extends="xPDOSimpleObject" >
<field key="formatId" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default=""/>
<aggregate alias="format" class="fplFormats" local="formatId" foreign="id" cardinality="one" owner="foreign"/>
</object>
<object class="fplFormats" table="migx_fpl_formats" extends="xPDOSimpleObject" >
<field key="format" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<composite alias="formatId" class="fplPrices" local="id" foreign="formatId" cardinality="many" owner="local" />
</object>
</model>
what is your MIGX - config?
{
"formtabs":[
{
"MIGX_id":1,
"caption":"Price",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":1,
"field":"formatId",
"caption":"Format",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@EVAL return $modx->runSnippet('migxLoopCollection',array('packageName'=>'flyerPricelist','classname'=>'fplFormats','outputSeparator'=>'||','where'=>'{\"published\":\"1\"}','tpl'=>'@CODE:[[+format]]'));",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
}
],
"pos":1
}
],
"contextmenus":"update||duplicate||publish||unpublish||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||duplicate||publish||unpublish||remove",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"flyerPricelist",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"flyerPricelist",
"classname":"fplPrices",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"",
"has_jointable":"yes",
"getlistwhere":"",
"joins":"",
"hooksnippets":{
"aftersave":"flyer_pricelist_aftersave"
},
"cmpmaincaption":"Pricelist",
"cmptabcaption":"Pricelist",
"cmptabdescription":"Pricelist",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"Format",
"dataIndex":"formatId",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}
'tpl'=>'@CODE:[[+format]]'
'tpl'=>'@CODE:[[+format]]==[[+id]]'
[2017-07-29 00:05:50] (ERROR @ /paas/c0246/www/core/xpdo/om/xpdoobject.class.php : 1452) Error 23000 executing statement:
INSERT INTO `modx_product_colors_product` (`modx_product_id`, `modx_product_color_id`) VALUES (0, 1)
Array
(
[0] => 23000
[1] => 1452
[2] => Cannot add or update a child row: a foreign key constraint fails (`instance_c0246_modx`.`modx_product_colors_product`, CONSTRAINT `modx_product_colors_product_modx_product_id_foreign` FOREIGN KEY (`modx_product_id`) REFERENCES `modx_products` (`id`))
)
<?xml version="1.0" encoding="UTF-8"?> <model package="Fcommerce" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1"> <object class="ProductColorsProduct" table="product_colors_product" extends="xPDOSimpleObject"> <field key="modx_product_id" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" index="index" /> <field key="modx_product_color_id" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" index="index" /> <index alias="modx_product_colors_product_modx_product_id_foreign" name="modx_product_colors_product_modx_product_id_foreign" primary="false" unique="false" type="BTREE" > <column key="modx_product_id" length="" collation="A" null="false" /> </index> <index alias="modx_product_colors_product_modx_product_color_id_foreign" name="modx_product_colors_product_modx_product_color_id_foreign" primary="false" unique="false" type="BTREE" > <column key="modx_product_color_id" length="" collation="A" null="false" /> </index> <aggregate alias="ProductColors" class="ProductColors" local="modx_product_color_id" foreign="id" cardinality="one" owner="foreign" /> <aggregate alias="Products" class="Products" local="modx_product_id" foreign="id" cardinality="one" owner="foreign" /> </object> <object class="Products" table="products" extends="xPDOSimpleObject"> <field key="product_number" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="true" /> <field key="price" dbtype="double" precision="8,2" phptype="float" null="false" /> <field key="size_width" dbtype="double" precision="8,2" phptype="float" null="false" /> <field key="size_height" dbtype="double" precision="8,2" phptype="float" null="false" /> <field key="title" dbtype="varchar" precision="200" phptype="string" null="false" /> <field key="description" dbtype="varchar" precision="255" phptype="string" null="true" /> <field key="link" dbtype="varchar" precision="255" phptype="string" null="false" /> <field key="quantity" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="100" /> <field key="quality" dbtype="varchar" precision="255" phptype="string" null="true" /> <field key="sort" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" /> <field key="product_material" dbtype="varchar" precision="255" phptype="string" null="true" /> <field key="product_typ" dbtype="varchar" precision="100" phptype="string" null="false" /> <field key="color" dbtype="varchar" precision="255" phptype="string" null="false" default="white" /> <field key="operation_type" dbtype="enum" precision="'Handmatig','Electrisch'" phptype="string" null="false" /> <field key="available_operation" dbtype="tinyint" precision="1" phptype="integer" null="false" default="1" /> <field key="remote_control_quantity" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" /> <field key="remote_control_type" dbtype="varchar" precision="255" phptype="string" null="false" default="1-kanaals handzender" /> <field key="certificate" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" /> <field key="published" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" /> <field key="created_at" dbtype="timestamp" phptype="timestamp" null="true" /> <field key="updated_at" dbtype="timestamp" phptype="timestamp" null="true" /> <aggregate alias="ProductImages" class="ProductImages" local="id" foreign="modx_product_id" cardinality="many" owner="local" /> <aggregate alias="ProductSizeProduct" class="ProductSizeProduct" local="id" foreign="modx_product_id" cardinality="many" owner="local" /> <aggregate alias="ProductColorsProduct" class="ProductColorsProduct" local="id" foreign="modx_product_id" cardinality="many" owner="local" /> </object> <object class="ProductColors" table="product_colors" extends="xPDOSimpleObject"> <field key="color_name" dbtype="varchar" precision="100" phptype="string" null="false" /> <field key="color_image" dbtype="varchar" precision="255" phptype="string" null="false" /> <field key="color_code" dbtype="varchar" precision="20" phptype="string" null="false" /> <field key="color_price" dbtype="double" precision="8,3" phptype="float" null="false" /> <field key="quantity" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="100" /> <aggregate alias="ProductColorsProduct" class="ProductColorsProduct" local="id" foreign="modx_product_color_id" cardinality="many" owner="local" /> </object> </model>
{
"formtabs":[
{
"MIGX_id":18,
"caption":"Product color",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":79,
"field":"modx_product_color_id",
"caption":"Color",
"description":"",
"description_is_code":"0",
"inputTV":"product_color",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@EVAL return $modx->runSnippet('migxLoopCollection',array('packageName'=>'Fcommerce','classname'=>'ProductColors','outputSeparator'=>'||','where'=>'{\\\"published\\\":\\\"1\\\"}','tpl'=>'@CODE:[[+color_name]]==[[+id]]'));",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
}
]
}
],
"contextmenus":"update||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||remove",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"ProductColorsProduct",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"this.preview||this.activateObject||this.deactivateObject",
"filtersperrow":4,
"packageName":"Fcommerce",
"classname":"ProductColorsProduct",
"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":[
{
"alias":"Products"
},
{
"alias":"ProductColors"
}
],
"hooksnippets":{
"aftersave":"product_colors_products_aftersave"
},
"cmpmaincaption":"Kleuren",
"cmptabcaption":"Gekoeze kleuren ",
"cmptabdescription":"Slelect kleur",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"Product id",
"dataIndex":"modx_product_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":3,
"header":"Color id",
"dataIndex":"modx_product_color_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":6,
"header":"Product tabel id",
"dataIndex":"Products_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":4,
"header":"Product name",
"dataIndex":"Products_title",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":5,
"header":"Product Color",
"dataIndex":"ProductColors_color_name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}