<?php
class ProductObject extends DataObject {
static $db = array (
'name' => 'Text',
'code' => 'Text',
'description' => 'Text',
'voc' => 'Boolean',
'bodyshop' => 'Boolean',
'phosphate' => 'Boolean',
'npe' => 'Boolean',
);
static $has_one = array (
'MyProductSheet' => 'File',
'MyMSDS' => 'File'
);
static $many_many = array(
'AvailableSizes' => 'ProductSize',
);
function getCMSFields() {
return new FieldSet(
new TextField('code', 'Product Code'),
new TextField('name', 'Product Name'),
new TextAreaField('description', 'Description'),
new CheckboxField(
$name = "voc",
$title = "VOC Compliant"),
new CheckboxField(
$name = "bodyshop",
$title = "Bodyshop Safe"),
new CheckboxField(
$name = "phosphate",
$title = "Phosphate Free"),
new CheckboxField(
$name = "npe",
$title = "NPE Free"),
new FileIFrameField('MyProductSheet', 'Upload Product Data Sheet'),
new FileIFrameField('MyMSDS', 'Upload MSDS'),
new ManyManyDataObjectManager(
$this,
'AvalableSizes',
'ProductSize',
array(
'size' => 'Size',
)
)
);
}
}
?>