I've been following Silverstripe DataObjects as Pages - Part 2: Using Model Admin and URL Segments to create a product catalogue tutorial on my localhost and running into a sidebar problem.
When I use the same method to create a sidebar as tutorial one, an error message shows on my site [User Error] Uncaught Exception: Object->__call(): the method 'categorypages' does not exist on 'Product'
This is the code I added to Product.php for sidebar to appear.
//Return the Title as a menu title
public function MenuTitle()
{
return $this->Title;
}
//Ensure that the DO shows up in menu (it is needed otherwise sidebar doesn't show when not logged in)
function canView()
{
return $this->CategoryPages()->canView();
}
Does anyone know how to fix this problem? Thanks very much.