示例#1
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new productcatspec();
         $o->where("productcat_id", $this->productcat_id);
         $o->select_max('position');
         $o->get();
         if (count($o->all) != 0) {
             $max = $o->position + 1;
             $this->position = $max;
         } else {
             $this->postion = 1;
         }
     }
     return parent::save($object, $related_field);
 }
示例#2
0
 function loadSpecInfo($specId)
 {
     $productCatSpec = new productcatspec();
     $productCatSpec->where("id", $specId);
     $productCatSpec->include_related("productgenspec", "*", TRUE, TRUE);
     $productCatSpec->get();
     $dis['name'] = $productCatSpec->productgenspec->name;
     $dis['description'] = $productCatSpec->productgenspec->description;
     $dis['isGroup'] = $productCatSpec->productgenspec->isGroup;
     $dis['parentcat_id'] = $productCatSpec->productgenspec->parentcat_id;
     $dis['parentcatName'] = $productCatSpec->productgenspec->parentcat->name;
     $dis['id'] = $productCatSpec->id;
     $dis['specElementType'] = $productCatSpec->productgenspec->type;
     header('Content-type: application/json');
     echo json_encode($dis);
     exit;
 }