Attributes can be set in products now
This commit is contained in:
@@ -1,5 +1,32 @@
|
||||
<?php
|
||||
|
||||
class Producttech extends mfBaseModel {
|
||||
private $attributes;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "attributes") {
|
||||
$this->attributes = [];
|
||||
$producttechAttributes = ProducttechAttributeModel::search(['producttech_id' => $this->id]);
|
||||
foreach($producttechAttributes as $pta) {
|
||||
$this->attributes[$pta->id] = $pta;
|
||||
}
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user