Thanks for quick reply.
I am getting the error "The website server has not been able to respond to your request" when I try to flush and access the admin page.
Can you take a look at the code below?
This is my StorePage.php:
<?php
class StorePage extends Page
{
static $has_many = array (
'Products' => 'Product'
);
public function getCMSFields()
{
$fields = parent::getCMSFields();
$manager = new DataObjectManager(
$this,
'Products',
'Product',
array(
'DOMThumbnail' => 'Thumbnail',
'Title' => 'Title',
'Description' => 'Description',
'Price' => 'Price',
'OutOfStock' => 'Out Of Stock'
),
'getCMSFields'
);
$fields->addFieldToTab("Root.Content.Products", $manager);
return $fields;
}
}
class StorePage_Controller extends Page_Controller
{
}
?>
This is my Product.php:
<?php
class Product extends DataObject
{
static $db = array (
'Title' => 'Varchar(50)',
'Description' => 'Text',
'Price' => 'Decimal',
'OutOfStock' => 'Boolean'
);
static $has_one = array (
'StorePage' => 'StorePage',
'ProductImage' => 'Image'
);
public function getDOMThumbnail()
{
return $this->ProductImage()->CroppedResize(50,50);
}
function getCMSFields()
{
return new FieldSet(
new TextField('Title'),
new TextareaField('Description'),
new NumericField('Price'),
new CheckboxField('OutOfStock','This product is out of stock')
new ImageField('ProductImage'),
);
}
}
?>
Thanks,
Sam
PS: I made an error in my last post. I am actually following the Products and StorePage example at http://www.silverstripe.org/dataobjectmanager-module-forum/show/268739?showPost=268739 not your archived zipped examples.