hello friends I have a litter bit problem and I want to know if it possible to solve it!!
I want to put the products in a tab inside ProductGroup and not in the tree, it is working but when I want to save the ProductGroup or Publish it an error appears!! this is my code could you help with this, thank u, the problem can be in the type of relationship but I don't know how to solve it!!
class ProductGroup extends Page {
static $add_action = 'a Product Group Page';
static $casting = array();
static $allowed_children = array("Product", "ProductGroup");
static $default_child = 'Product';
static $icon = "cms/images/treeicons/folder";
static $db = array();
static $belongs_many_many = array(
"ChildProducts" => "Product"
);
function getCMSFields() {
$fields = parent::getCMSFields();
// standard extra fields like weight and price
$tablefield = new HasManyComplexTableField(
$this,
'ChildProducts',
'Product',
array(
'Title'=>'Title',
'Price' => 'Price',
'Weight'=>'Weight',
'Model'=> 'Author',
'Content'=>'Content'
),
'getCMSFields_forPopup',
"ParentID = {$this->ID} AND ShowInMenus = 1 "
);
$tablefield->relationAutoSetting = true;
$tablefield->setAddTitle( 'Products Details' );
$fields->addFieldToTab("Root.Content.Products", $tablefield);
return $fields;
}