Added some linked data in Order to cache

This commit is contained in:
Frank Schubert
2022-05-18 15:45:32 +02:00
parent 40753b6394
commit e0551d35fa
5 changed files with 111 additions and 24 deletions

View File

@@ -15,7 +15,13 @@ class Product extends mfBaseModel {
$this->attributes = [];
// get tech attribs
$ptattribs = ProducttechAttributeModel::search(['producttech_id' => $this->producttech_id]);
$ptattribs = mfValuecache::singleton()->get("ProducttechAttributes-techid-".$this->producttech_id);
if($ptattribs === null) {
$ptattribs = ProducttechAttributeModel::search(['producttech_id' => $this->producttech_id]);
if(count($ptattribs)) {
mfValuecache::singleton()->set("ProducttechAttributes-techid-".$this->producttech_id, $ptattribs);
}
}
// fill atrribs with existing values of product attribs
foreach($ptattribs as $pta) {
$attrib = ProductAttributeModel::getFirst(['product_id' => $this->id, 'producttechattribute_id' => $pta->id]);