I'm programming a webshop and so I added 3 new pagetypes. Since I've build my database with /dev/build it ain't possible for me to view my sitetree in the admin panel. I can visite my site normally, and the rest in the admin panel like security works. I have inserted a new tab within my pagetype but that doesn't show either.
When I try to load the page type a box is displayed within the text: Warning at line 2591 of /srv/www/htdocs/website/cms/code/model/SiteTree.php.
This is the source code of ProductPage.php:
class ProductPage extends Page {
private static $db = array(
'Name' => 'Varchar(30)',
'Price' => 'Double',
'Description' => 'Text'
);
private static $has_one = array('Photo' => 'Image' );
private static $many_many = array( 'Categories' => 'ProductCategory' );
private static $can_be_root = false;
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TextField::create('Name','Productname:'), 'Content');
$fields->addFieldToTab('Root.Main', NumericField::create('Price','Productprice:'), 'Content');
$fields->addFieldToTab('Root.Main', TextareaField::create('Description','Productdescription:'), 'Content');
$fields->addFieldToTab('Root.Attachments', $photo = UploadField::create('Photo'));
$photo->getValidator()->setAllowedExtensions(array('png','jpg','jpeg'));
$photo->setFolderName('product-photos');
$fields->addFieldToTab('Root.Categories', CheckboxSetField::create(
'Categories',
'Selected categories',
$this->Parent()->Categories()->map('ID', 'Title')
));
return $fields;
}
public function CategoriesList() {
if ($this->Categories()->exists()) {
return implode(', ', $this->Categories()->column('Title'));
}
}
This is the source code of ProductHolder:
class ProductHolder extends Page {
private static $allowed_children = 'ProductPage';
private static $has_many = array(
'Categories' => 'ProductCategory'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Categories', GridField::create(
'Categories',
'Article categories',
$this->Categories(),
GridFieldConfig_RecordEditor::create()
));
}
}
The controllers of both classes are also included in the files, but there empty so that's why I haven't included them.
I hope you guys can help me :)
Thank you!