Пример #1
0
 function getLatestExistsSlug($slug, $table)
 {
     $this->db->order_by($table . '_id', "desc");
     $this->db->like('slug', slugify($slug));
     $this->db->limit(1);
     $query = $this->db->get($table);
     $slugName = checkRow($query);
     if (strpos($slugName->slug, '-') !== false) {
         $getLastDigit = substr($slugName->slug, strrpos($slugName->slug, '-') + 1);
         $latestSlugPlus = $getLastDigit + 1;
         $latestSlugClear = preg_replace('/[0-9]+/', '', $slugName->slug);
         return rtrim($latestSlugClear, '-') . '-' . $latestSlugPlus;
     } else {
         return $slugName->slug . '-' . 1;
     }
 }
Пример #2
0
 function getCategorySlug($slug)
 {
     $query = $this->db->get_where('category', array('slug' => $slug));
     return checkRow($query);
 }
Пример #3
0
 function getAtletSlug($slug)
 {
     $query = $this->db->get_where('atlet_profile', array('slug' => $slug));
     return checkRow($query);
 }
Пример #4
0
 function checkUserId($user_id)
 {
     $query = $this->db->get_where("user", array('user_id' => $user_id));
     //echo $this->db->last_query();
     return checkRow($query);
 }
Пример #5
0
 function getCatSlug($cat)
 {
     $this->db->like('slug', $cat);
     $this->db->limit(1);
     $query = $this->db->get('category');
     // echo $this->db->last_query();
     $row = checkRow($query);
     // print_r($row);exit();
     return $row->category_id;
 }
Пример #6
0
 function getOrderId($order_item_id)
 {
     $query = $this->db->get_where('order_item', array('order_item_id' => $order_item_id));
     return checkRow($query);
 }
Пример #7
0
 function getCategory($id)
 {
     $query = $this->db->get_where('product', array('product_id', $id));
     return checkRow($query);
 }