public function getBuyable($data = null) { if ($this->controller->dataRecord instanceof Buyable) { return $this->controller->dataRecord; } return DataObject::get_by_id('Product', (int) $this->request->postVar("BuyableID")); //TODO: get buyable }