Esempio n. 1
0
 function checkUrlUnique($productCatId = 0)
 {
     $product = new Product();
     $url = $this->input->post('url');
     $product->where('url', $url);
     $product->get();
     if ($product->result_count() > 0) {
         echo "false";
         exit;
     }
     $productcat = new Productcat();
     if ($productCatId != 0) {
         $productcat->where('id !=', $productCatId);
     }
     $productcat->where('url', $url);
     $productcat->get();
     if ($productcat->result_count() > 0) {
         echo "false";
         exit;
     }
     echo "true";
     exit;
 }
Esempio n. 2
0
 /**
  * Productscat::getAllChildCat()
  * get all child category in tree
  * @param mixed $parentCat
  * @return
  */
 function getAllChildCat($parentCat = NULL, $listProductCat = NULL)
 {
     if ($listProductCat == NULL) {
         $listProductCat = array();
     }
     if ($parentCat == NULL) {
         $parentCat = $this;
     } else {
         array_push($listProductCat, $parentCat->get_clone());
     }
     $child = new Productcat();
     $child->where('parentcat_id', $parentCat->id);
     $child->get_iterated();
     if ($child->result_count() > 0) {
         foreach ($child as $row) {
             $listProductCat = $this->getAllChildCat($row, $listProductCat);
         }
     }
     return $listProductCat;
 }