17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 965 Views |
-
Problems with $belongs_many_many

8 April 2008 at 8:23pm
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;
}
| 965 Views | ||
|
Page:
1
|
Go to Top |

