Пример #1
0
 /**
  * Save review
  *
  * @access public
  * @param $data
  * @return boolean
  */
 function save_review($data)
 {
     if (is_array($data['rating'])) {
         $total = 0;
         foreach ($data['rating'] as $value) {
             $total += $value;
         }
         $reviews_rating = $total / count($data['rating']);
     } else {
         $reviews_rating = $data['rating'];
     }
     //review data
     $reviews = array('products_id' => $data['products_id'], 'customers_id' => $data['customer_id'], 'customers_name' => $data['customer_name'], 'reviews_rating' => $reviews_rating, 'languages_id' => lang_id(), 'reviews_text' => $data['review'], 'reviews_status' => 1);
     $this->db->insert('reviews', $reviews);
     //rating data
     if (is_array($data['rating'])) {
         //get insert id
         $reviews_id = $this->db->insert_id();
         foreach ($data['rating'] as $ratings_id => $value) {
             //order data
             $rating = array('ratings_id' => $ratings_id, 'customers_id' => $data['customer_id'], 'reviews_id' => $reviews_id, 'ratings_value' => $value);
             $this->db->insert('customers_ratings', $rating);
         }
     }
 }
Пример #2
0
 private function query($categories_id)
 {
     if (!empty($categories_id)) {
         $categories_id = end(explode('_', $categories_id));
         $sub_categories = array();
         $this->category_tree->get_children($categories_id, $sub_categories);
         $categories = array();
         if (!empty($sub_categories)) {
             foreach ($sub_categories as $category) {
                 $categories[] = $category['id'];
             }
         }
         $categories[] = $categories_id;
         $Qproducts_ids = $this->db->select('products_id')->from('products_to_categories')->where_in('categories_id', $categories)->group_by('products_id')->get();
         $products_ids = array();
         if ($Qproducts_ids->num_rows() > 0) {
             foreach ($Qproducts_ids->result_array() as $product) {
                 $products_ids[] = $product['products_id'];
             }
         }
         $Qproducts_ids->free_result();
     }
     $this->db->select('p.products_id, pd.products_name, p.products_quantity')->from('products p')->join('products_description pd', 'p.products_id = pd.products_id')->where(array('pd.language_id' => lang_id(), 'p.products_quantity <=' => STOCK_REORDER_LEVEL));
     if (isset($products_ids) && !empty($products_ids)) {
         $this->db->where_in('p.products_id', $products_ids);
     }
 }
 /**
  * Get email template data
  * 
  * @access public
  * @return mixed
  */
 public function get_data($template_name)
 {
     $result = $this->db->select('et.email_templates_status, etd.email_title, etd.email_content')->from('email_templates as et')->join('email_templates_description as etd', 'et.email_templates_id = etd.email_templates_id', 'inner')->where('et.email_templates_name', $template_name)->where('etd.language_id', lang_id())->get();
     if ($result->num_rows() > 0) {
         return $result->row_array();
     }
     return NULL;
 }
 /**
  * Get the categories
  *
  * @access public
  * @param $categories_id
  * @return mixed
  */
 public function get_categories($categories_id)
 {
     $result = $this->db->select('cd.categories_name, c.parent_id, cd.categories_id')->from('categories c')->join('categories_description cd', 'c.categories_id = cd.categories_id')->where(array('c.parent_id' => $categories_id, 'cd.language_id' => lang_id()))->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
Пример #5
0
 /**
  * Get Articles
  *
  * @access public
  * @param int $articles_categories_id articles categories id
  * @param int $count number of articles to be displayed
  * @return array new products array
  */
 public function get_articles($articles_categories_id, $count)
 {
     $result = $this->db->select('a.articles_id, ad.articles_name, ad.articles_url')->from('articles a')->join('articles_description ad', 'a.articles_id = ad.articles_id', 'inner')->where('a.articles_status', 1)->where('a.articles_categories_id', $articles_categories_id)->where('ad.language_id', lang_id())->order_by('articles_order', 'desc')->limit($count)->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
Пример #6
0
 /**
  * Get Latest Products
  *
  * @access public
  * @param int $count number of products to be displayed
  * @return array new products array
  */
 public function get_new_products($count)
 {
     $result = $this->db->select('p.*, pd.*, m.*, i.image, s.specials_new_products_price as specials_price, f.products_id as featured_products_id')->from('products as p')->join('products_description as pd', 'p.products_id = pd.products_id and pd.language_id =' . lang_id(), 'inner')->join('products_to_categories as p2c', 'p.products_id = p2c.products_id', 'inner')->join('products_frontpage as f', 'p.products_id = f.products_id', 'left')->join('products_images as i', 'p.products_id = i.products_id and i.default_flag = 1', 'left')->join('categories as c', 'p2c.categories_id = c.categories_id', 'inner')->join('specials as s', 'p.products_id = s.products_id and s.status = 1 and s.start_date <= now() and s.expires_date >= now()', 'left')->join('manufacturers as m', 'p.manufacturers_id = m.manufacturers_id', 'left')->join('manufacturers_info as mi', 'm.manufacturers_id = mi.manufacturers_id and mi.languages_id = ' . lang_id(), 'left')->where('p.products_status', 1)->order_by('p.products_id', 'desc')->limit($count)->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
Пример #7
0
 /**
  * Get the image groups
  *
  * @access public
  * @return mixed
  */
 public function get_groups()
 {
     $result = $this->db->select('*')->from('products_images_groups')->where('language_id', lang_id())->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
 /**
  * Get Special Products
  *
  * @access public
  * @param int $count number of products to be displayed
  * @return array special products array
  */
 public function get_specials($count)
 {
     $result = $this->db->select('p.products_id, p.products_price, p.products_tax_class_id, pd.products_name, pd.products_keyword, pd.products_short_description as short_description, s.specials_new_products_price as special_price, i.image')->from('products p')->join('products_images i', 'p.products_id = i.products_id', 'left')->join('products_description pd', 'p.products_id = pd.products_id', 'inner')->join('specials s', 's.products_id = p.products_id', 'inner')->where('p.products_status = 1')->where('pd.language_id', lang_id())->where('i.default_flag', 1)->where('s.status', 1)->order_by('s.specials_date_added', 'desc')->limit($count)->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
Пример #9
0
 /**
  * Get Slides
  *
  * @access public
  * @param string $group the slides group to be displayed
  * @return array slides array
  */
 public function get_slides($group)
 {
     $result = $this->db->select('image, image_url, description')->from('slide_images')->where('language_id', lang_id())->where('group', $group)->where('status', 1)->order_by('sort_order')->get();
     $slides = array();
     if ($result->num_rows() > 0) {
         $slides = $result->result_array();
     }
     return $slides;
 }
Пример #10
0
 /**
  * Get special products
  * 
  * @access public
  * @return array
  */
 public function get_special_products()
 {
     $result = $this->db->select('p.products_id, p.products_price, p.products_tax_class_id, pd.products_name, pd.products_keyword, s.specials_new_products_price as special_price, i.image ')->from('products p')->join('products_images i', 'p.products_id = i.products_id', 'left')->join('products_description pd', 'p.products_id = pd.products_id', 'inner')->join('specials s', 's.products_id = p.products_id', 'inner')->where('p.products_status = 1')->where('pd.language_id', lang_id())->where('i.default_flag = 1')->where('s.status = 1')->order_by('s.specials_date_added desc')->limit(config('MAX_DISPLAY_SPECIAL_PRODUCTS'))->get();
     $products = array();
     if ($result->num_rows() > 0) {
         $products = $result->result_array();
     }
     return $products;
 }
Пример #11
0
 /**
  * Get the languages resources for specified group
  *
  * @access public
  * @param $group
  * @return array
  */
 public function load($group = 'general')
 {
     $result = $this->db->select('*')->from('languages_definitions')->where('languages_id', lang_id())->where('content_group', $group)->get();
     $definitions = array();
     foreach ($result->result() as $key => $row) {
         $definitions[$row->definition_key] = $row->definition_value;
     }
     return $definitions;
 }
Пример #12
0
 /**
  * Get Banner
  *
  * @access public
  * @param string $group the image group to be displayed
  * @return array slide array
  */
 public function get_banner($group)
 {
     $result = $this->db->select('image, image_url, description')->from('slide_images')->where('language_id', lang_id())->where('group', $group)->where('status', 1)->order_by('sort_order')->get();
     if ($result->num_rows() > 0) {
         $result_array = $result->result_array();
         //randomizes the order of the slides
         shuffle($result_array);
         //return the first element
         return $result_array[0];
     }
     return NULL;
 }
Пример #13
0
 /**
  * Get the ratings
  *
  * @access public
  * @return mixed
  */
 public function get_ratings($start = NULL, $limit = NULL)
 {
     $this->db->select('r.ratings_id, r.status, rd.ratings_text')->from('ratings r')->join('ratings_description rd', 'r.ratings_id = rd.ratings_id')->where('rd.languages_id', lang_id());
     if ($start !== NULL && $limit !== NULL) {
         $this->db->limit($limit, $start);
     }
     $result = $this->db->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
Пример #14
0
 /**
  * Get the articles
  *
  * @access public
  * @param $start
  * @param $limit
  * @return mixed
  */
 public function get_articles($start = NULL, $limit = NULL)
 {
     $this->db->select('a.articles_id, a.articles_status, a.articles_order, ad.articles_name, acd.articles_categories_name')->from('articles a')->join('articles_description ad', 'a.articles_id = ad.articles_id')->join('articles_categories_description acd', 'acd.articles_categories_id = a.articles_categories_id and acd.language_id = ad.language_id')->where(array('acd.articles_categories_id' => 1, 'ad.language_id' => lang_id()));
     if ($start !== NULL && $limit !== NULL) {
         $this->db->limit($limit, $start);
     }
     $result = $this->db->get();
     if ($result->num_rows() > 0) {
         return $result->result_array();
     }
     return NULL;
 }
Пример #15
0
 public function create_news()
 {
     $this->db->insert($this->_table_blank, array('news_name' => $this->input->post('news_name', true)));
     $id = $this->db->insert_id();
     if ($this->config->item('multi_language_enable') === true and count($this->config->item('multi_language')) > 0) {
         $languages = $this->config->item('multi_language');
         foreach ($languages as $key => $value) {
             $this->db->insert($this->_table_image_content, array('news_id' => $id, 'news_text' => '', 'news_title' => '', 'news_date' => '', 'news_time' => '', 'img_full_path' => '', 'img_lang' => $key));
         }
     } else {
         $this->db->insert($this->_table_image_content, array('news_id' => $id, 'news_text' => '', 'news_title' => '', 'news_date' => '', 'news_time' => '', 'img_full_path' => '', 'img_lang' => lang_id()));
     }
 }
Пример #16
0
 /**
  * Get all categories 
  * 
  * @access public
  * @param $load_all_categories
  * @return array
  */
 function get_all($load_all_categories = false)
 {
     $this->db->select('c.categories_id, c.parent_id, c.categories_image, cd.categories_name, cd.categories_url, cd.categories_page_title, cd.categories_meta_keywords, cd.categories_meta_description')->from('categories as c')->join('categories_description as cd', 'c.categories_id = cd.categories_id', 'inner')->where('cd.language_id = ' . lang_id());
     if ($load_all_categories === false) {
         $this->db->where('c.categories_status = 1');
     }
     $query = $this->db->order_by('c.parent_id, c.sort_order, cd.categories_name')->get();
     $categories = array();
     if ($query->num_rows() > 0) {
         $categories = $query->result_array();
     }
     return $categories;
 }
Пример #17
0
 private function query($orders_id, $customers_id, $status)
 {
     $this->db->select('o.orders_id, o.customers_ip_address, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, o.invoice_number, o.invoice_date, s.orders_status_name, ot.text as order_total')->from('orders o')->join('orders_total ot', 'o.orders_id = ot.orders_id and ot.class = "total" and o.invoice_number IS NOT NULL')->join('orders_status s', 'o.orders_status = s.orders_status_id')->where('s.language_id', lang_id());
     if (!empty($orders_id)) {
         $this->db->where('o.orders_id', $orders_id);
     }
     if (!empty($customers_id)) {
         $this->db->where('o.customers_id', $customers_id);
     }
     if (!empty($status)) {
         $this->db->where('s.orders_status_id', $status);
     }
 }
Пример #18
0
 public function get_news_content($id)
 {
     $result = null;
     if ($this->config->item('multi_language_enable') === true and count($this->config->item('multi_language')) > 0) {
         $languages = $this->config->item('multi_language');
         foreach ($languages as $key => $value) {
             $result[$key] = $this->db->get_where($this->_table_image_content, array('news_id' => $id, 'img_lang' => $key))->row_array();
         }
     } else {
         $result[lang_id()] = $this->db->get_where($this->_table_image_content, array('news_id' => $id, 'img_lang' => lang_id()))->row_array();
     }
     return $result;
 }
Пример #19
0
 /**
  * List the orders status
  *
  * @access public
  * @return string
  */
 public function list_orders_status()
 {
     $start = $this->input->get_post('start') ? $this->input->get_post('start') : 0;
     $limit = $this->input->get_post('limit') ? $this->input->get_post('limit') : MAX_DISPLAY_SEARCH_RESULTS;
     $statuses = $this->orders_status_model->get_orders_status($start, $limit);
     $records = array();
     if ($statuses !== NULL) {
         foreach ($statuses as $status) {
             $orders_status_name = $status['orders_status_name'];
             if ($status['orders_status_id'] == DEFAULT_ORDERS_STATUS_ID) {
                 $orders_status_name .= ' (' . lang('default_entry') . ')';
             }
             $records[] = array('orders_status_id' => $status['orders_status_id'], 'language_id' => lang_id(), 'orders_status_name' => $orders_status_name, 'public_flag' => $status['public_flag']);
         }
     }
     $this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->orders_status_model->get_total(), EXT_JSON_READER_ROOT => $records)));
 }
Пример #20
0
 /**
  * List the unit classes
  *
  * @access public
  * @return string
  */
 public function list_unit_classes()
 {
     $start = $this->input->get_post('start') ? $this->input->get_post('start') : 0;
     $limit = $this->input->get_post('limit') ? $this->input->get_post('limit') : MAX_DISPLAY_SEARCH_RESULTS;
     $classes = $this->unit_classes_model->get_classes($start, $limit);
     $records = array();
     if ($classes !== NULL) {
         foreach ($classes as $class) {
             $unit_class_title = $class['quantity_unit_class_title'];
             if ($class['quantity_unit_class_id'] == DEFAULT_UNIT_CLASSES) {
                 $unit_class_title .= ' (' . lang('default_entry') . ')';
             }
             $records[] = array('unit_class_id' => $class['quantity_unit_class_id'], 'unit_class_title' => $unit_class_title, 'languange_id' => lang_id());
         }
     }
     $this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->unit_classes_model->get_total(), EXT_JSON_READER_ROOT => $records)));
 }
Пример #21
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     //set page title
     $this->set_page_title(lang('sign_in_heading'));
     //breadcrumb
     $this->template->set_breadcrumb(lang('breadcrumb_my_account'), site_url('account'));
     $this->template->set_breadcrumb(lang('create_account_heading'), site_url('account/create'));
     //data
     $this->data = array();
     if (config('DISPLAY_PRIVACY_CONDITIONS') == '1') {
         //load model
         $this->load->model('info_model');
         //get the privacy
         $privacy = $this->info_model->get_article(INFORMATION_PRIVACY_NOTICE, lang_id());
         $this->data['privacy'] = array('title' => $privacy['articles_name'], 'content' => $privacy['articles_description']);
     }
 }
Пример #22
0
 function get_books($full_url = true)
 {
     $query = $this->qhda->get('regbooks');
     $result = '';
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $href = '';
             if ($full_url) {
                 $href = 'href="' . lang_url('', 'blog/qhda/' . $row->id);
             } else {
                 $href = 'href="/' . lang_id() . '/blog/qhda/' . $row->id;
             }
             $result .= '<li ><a title="' . $row->descr . '" ' . $href . '">' . $row->name . "</a></li>";
         }
     }
     $this->load->database('default', TRUE);
     return $result;
 }
Пример #23
0
    --></style>
</head>
<body style="background-color:white;">
    <div class="logo">
      
    </div>
    <table border="0" cellspacing="0" cellpadding="0" width="100%" height="80%">
        <tr>
            <td valign="top" align="left">  
            <td valign="middle" align="center" width="100%">
                <div class="transparentbox">
                    
                    <span class="top"><span></span></span>  
                    <div class="error" align="left">
                    <h1><?php 
switch (lang_id()) {
    case 'ru':
        $back = 'Вернуться назад';
        break;
    case 'en':
        $back = 'Return to previous page';
        break;
    default:
        $back = 'Return to previous page';
        break;
}
echo $heading;
?>
</h1>
		<?php 
echo $message;
Пример #24
0
 /**
  * Save a new guestbook
  *
  * @param array
  * @return bool
  */
 public function save($data)
 {
     $data['languages_id'] = lang_id();
     return $this->db->insert('guest_books', $data);
 }
 /**
  * Get total number of the articles categories
  *
  * @access public
  * @return int
  */
 public function get_total()
 {
     $this->db->select('c.articles_categories_id, c.articles_categories_status, cd.articles_categories_name, c.articles_categories_order')->from('articles_categories c')->join('articles_categories_description cd', 'c.articles_categories_id = cd.articles_categories_id and c.articles_categories_id > 1')->where('cd.language_id', lang_id())->order_by('c.articles_categories_order');
     $result = $this->db->get();
     return $result->num_rows();
 }
 public function get_categories($categories_id)
 {
     $Qcategories = $this->db->select('cd.categories_name, c.parent_id, cd.categories_id')->from('categories c')->join('categories_description cd', 'c.categories_id = cd.categories_id')->where(array('c.parent_id' => $categories_id, 'cd.language_id' => lang_id()))->get();
     return $Qcategories->result_array();
 }
Пример #27
0
 /**
  * Save a category
  *
  * @access public
  * @return string   
  */
 public function save_category()
 {
     $this->load->helper('html_output');
     $parent_id = $this->input->post('parent_category_id');
     $flag = $this->input->post('product_flag');
     $categories_id = $this->input->post('categories_id');
     $categories_name = $this->input->post('categories_name');
     $parent_id = !empty($parent_id) ? end(explode('_', $parent_id)) : 0;
     $flag = !empty($flag) ? $flag : 0;
     $categories_id = !empty($categories_id) && is_numeric($categories_id) ? $categories_id : NULL;
     //search engine friendly urls
     $formatted_urls = array();
     $urls = $this->input->post('categories_url');
     if (is_array($urls) && !empty($urls)) {
         foreach ($urls as $languages_id => $url) {
             $url = format_friendly_url($url);
             if (empty($url)) {
                 $url = format_friendly_url($categories_name[$languages_id]);
             }
             $formatted_urls[$languages_id] = $url;
         }
     }
     $data = array('parent_id' => $parent_id, 'sort_order' => $this->input->post('sort_order'), 'image' => 'image', 'categories_status' => $this->input->post('categories_status'), 'name' => $this->input->post('categories_name'), 'url' => $formatted_urls, 'page_title' => $this->input->post('page_title'), 'meta_keywords' => $this->input->post('meta_keywords'), 'meta_description' => $this->input->post('meta_description'), 'flag' => $flag);
     $category_id = $this->categories_model->save($categories_id, $data);
     if ($category_id > 0) {
         $response = array('success' => TRUE, 'feedback' => lang('ms_success_action_performed'), 'categories_id' => $category_id, 'text' => $categories_name[lang_id()]);
     } else {
         $response = array('success' => FALSE, 'feedback' => lang('ms_error_action_not_performed'));
     }
     $this->output->set_header("Content-Type: text/html")->set_output(json_encode($response));
 }
Пример #28
0
 /**
  * Get the total number of speical products
  *
  * @access public
  * @return int
  */
 public function get_total($search = NULL, $manufacturers_id = NULL, $in_categories = array())
 {
     if (count($in_categories) > 0) {
         $this->db->select('p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status')->from('specials s')->join('products p', 'p.products_id = s.products_id')->join('products_description pd', 'p.products_id = pd.products_id')->join('products_to_categories p2c', 'p.products_id = p2c.products_id')->where('pd.language_id', lang_id())->where_in('p2c.categories_id', $in_categories);
     } else {
         $this->db->select('p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status')->from('specials s')->join('products p', 'p.products_id = s.products_id')->join('products_description pd', 'p.products_id = pd.products_id')->where('pd.language_id', lang_id());
     }
     if ($search !== NULL) {
         $this->db->like('pd.products_name', $search);
     }
     if (is_numeric($manufacturers_id)) {
         $this->db->where('p.manufacturers_id', $manufacturers_id);
     }
     $result = $this->db->get();
     return $result->num_rows();
 }
 /**
  * Get total number of the feature products
  *
  * @access public
  * @param $in_categories
  * @return int
  */
 public function get_total($in_categories = array())
 {
     $this->db->select('pd.products_id, pd.products_name, pf.sort_order')->from('products_frontpage pf')->join('products_description pd', 'pf.products_id = pd.products_id');
     if (count($in_categories) > 0) {
         $this->db->join('products_to_categories p2c', 'p2c.products_id = pf.products_id')->where_in('p2c.categories_id', $in_categories);
     }
     $this->db->where('pd.language_id', lang_id());
     $result = $this->db->get();
     return $result->num_rows();
 }
Пример #30
0
 /**
  * Render the master template or a single region
  *
  * @access	public
  * @param	string	optionally opt to render a specific region
  * @param	boolean	FALSE to output the rendered template, TRUE to return as a string. Always TRUE when $region is supplied
  * @return	void or string (result of template build)
  */
 function render($region = NULL, $buffer = FALSE, $parse = FALSE)
 {
     /// _pussbb modification
     $this->add_js("http://www.google.com/jsapi", 'import', false, true);
     if (lang_id() != $this->CI->config->item('lang')) {
         $this->add_js("  google.load('language', \"1\"); \r\n       google.setOnLoadCallback(initialize); \r\n          function initialize() { \r\n            var v = {type:'horizontal'};  \r\n            google.language.getBranding('branding');    \r\n            }\t", 'embed');
     }
     /// end of modification
     // Just render $region if supplied
     if ($region) {
         if (isset($this->regions[$region])) {
             $output = $this->_build_content($this->regions[$region]);
         } else {
             show_error("Cannot render the '{$region}' region. The region is undefined.");
         }
     } else {
         foreach ($this->regions as $name => $region) {
             $this->output[$name] = $this->_build_content($region);
         }
         if ($this->parse_template === TRUE or $parse === TRUE) {
             // Use provided parser class and method to render the template
             $output = $this->CI->{$this->parser}->{$this->parser_method}($this->master, $this->output, TRUE);
             // Parsers never handle output, but we need to mimick it in this case
             if ($buffer === FALSE) {
                 $this->CI->output->set_output($output);
             }
         } else {
             // Use CI's loader class to render the template with our output array
             $output = $this->CI->load->view($this->master, $this->output, $buffer);
         }
     }
     return $output;
 }