Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 /**
  * Productcat::getSpec()
  * 
  * get all the productCategory's specification (group include)
  * @return void
  */
 function getSpec()
 {
     $productCatSpec = new productcatspec();
     $productCatSpec->where("productcat_id", $this->id);
     $productCatSpec->order_by("position", 'asc');
     $productCatSpec->include_related("productgenspec", "*", TRUE, TRUE);
     $productCatSpec->get_iterated();
     return $productCatSpec;
 }
Ejemplo n.º 3
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;
 }