Пример #1
0
 public function detail()
 {
     $this->data['title'] = lang('heading_title');
     $parameters = $this->uri->uri_to_assoc(4);
     if (sizeof($parameters) > 0 && isset($parameters['product_id']) && $parameters['product_id'] > 0) {
         $this->data['contact_link'] = base_url() . 'pages/contact';
         $this->load->model('tool/image_model');
         $this->load->helper('number_format');
         $product = $this->product_model->getProduct($parameters['product_id']);
         $img_small = $this->image_model->resize($product['image'], $this->session->userdata('config_image_additional_width'), $this->session->userdata('config_image_additional_height'));
         $img_normal = $this->image_model->resize($product['image'], $this->session->userdata('config_image_product_width'), $this->session->userdata('config_image_product_height'));
         $img_large = $this->image_model->resize($product['image'], $this->session->userdata('config_image_popup_width'), $this->session->userdata('config_image_popup_height'));
         $this->data['product'] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'price' => format_decimal($product['price']), 'size' => $product['size'], 'color' => $product['color'], 'quantity' => $product['quantity'], 'viewed' => $product['viewed'], 'rating' => $product['rating'], 'stock_status' => $product['stock_status'], 'description' => $product['description'], 'small' => $img_small, 'normal' => $img_normal, 'large' => $img_large, 'href' => base_url() . 'pages/product/detail/product_id/' . $product['product_id']);
         // additional
         $this->data['product_images'] = array();
         $product_images = $this->product_model->getProductImages($parameters['product_id']);
         foreach ($product_images as $product_img) {
             if ($product_img['image'] != 'no_image.jpg') {
                 $img_name_arr = explode("/", $product_img['image']);
                 $this->data['product_images'][] = array('name' => $img_name_arr[1], 'small' => $this->image_model->resize($product_img['image'], $this->session->userdata('config_image_additional_width'), $this->session->userdata('config_image_additional_height')), 'normal' => $this->image_model->resize($product_img['image'], $this->session->userdata('config_image_product_width'), $this->session->userdata('config_image_product_height')), 'large' => $this->image_model->resize($product_img['image'], $this->session->userdata('config_image_popup_width'), $this->session->userdata('config_image_popup_height')));
             }
         }
         // related
         $this->data['related_products'] = array();
         $related_products = $this->product_model->getProductRelated($parameters['product_id']);
         foreach ($related_products as $related_product) {
             $image_name_arr = explode("/", $related_product['image']);
             $this->data['related_products'][] = array('product_id' => $related_product['product_id'], 'name' => $related_product['name'], 'price' => format_decimal($related_product['price']), 'href' => base_url() . 'pages/product/detail/product_id/' . $related_product['product_id'], 'image' => $this->image_model->resize($related_product['image'], $this->session->userdata('config_image_related_width'), $this->session->userdata('config_image_related_height')), 'atl' => $image_name_arr[1]);
         }
         // update viewed
         $this->product_model->updateViewed($parameters['product_id']);
         // create captcha
         $this->data['captcha'] = createCaptcha('captcha_review' . $product['product_id']);
         // review action
         $this->data['review_action'] = base_url() . 'pages/product/ajaxReview';
         // get review data
         $this->load->model('catalog/review_model');
         $this->data['reviews'] = $this->review_model->getReviewsByProductId($parameters['product_id']);
         if (isset($this->error['name'])) {
             $this->data['error_name'] = $this->error['name'];
         } else {
             $this->data['error_name'] = '';
         }
         if (isset($this->error['review'])) {
             $this->data['error_review'] = $this->error['review'];
         } else {
             $this->data['error_review'] = '';
         }
         if (isset($this->error['captcha'])) {
             $this->data['error_captcha'] = $this->error['captcha'];
         } else {
             $this->data['error_captcha'] = '';
         }
     }
     $this->template->build('template/product', $this->data);
 }
Пример #2
0
 public function detail()
 {
     $this->data['title'] = lang('heading_title');
     $parameters = $this->uri->uri_to_assoc(4);
     if (sizeof($parameters) > 0 && isset($parameters['category_id'])) {
         $limit = $this->session->userdata('config_catalog_limit');
         $offset = '0';
         if (array_key_exists('page', $parameters)) {
             $offset = isset($parameters['page']) ? $parameters['page'] : '0';
         } else {
             $offset = '0';
         }
         $category_id = 0;
         if (array_key_exists('child_id', $parameters)) {
             $category_id = isset($parameters['child_id']) ? $parameters['child_id'] : 0;
         } else {
             if (array_key_exists('category_id', $parameters)) {
                 $category_id = isset($parameters['category_id']) ? $parameters['category_id'] : 0;
             }
         }
         $data = array('filter_category_id' => $category_id, 'sort' => 'p.sort_order', 'order' => 'ASC', 'start' => $offset, 'limit' => $limit);
         $product_total = $this->product_model->getTotalProducts($data);
         $results = $this->product_model->getProducts($data);
         $this->data['products'] = array();
         $this->load->model('tool/image_model');
         $this->data['banners'][] = $this->image_model->resize('data/banner/banner3.jpg', 940, 333);
         $this->data['banners'][] = $this->image_model->resize('data/banner/banner2.jpg', 940, 333);
         $this->data['banners'][] = $this->image_model->resize('data/banner/banner1.jpg', 940, 333);
         $this->load->helper('number_format');
         foreach ($results as $product) {
             $img_normal = $this->image_model->resize($product['image'], $this->session->userdata('config_image_category_width'), $this->session->userdata('config_image_category_height'));
             $img_large = $this->image_model->resize($product['image'], $this->session->userdata('config_image_thumb_width'), $this->session->userdata('config_image_thumb_height'));
             $this->data['products'][] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'price' => format_decimal($product['price']), 'normal' => $img_normal, 'large' => $img_large, 'href' => base_url() . 'pages/product/detail/product_id/' . $product['product_id']);
         }
         $link_page = "";
         if (array_key_exists('category_id', $parameters)) {
             $link_page = isset($parameters['category_id']) ? 'category_id/' . $parameters['category_id'] . '/' : '';
         }
         if (array_key_exists('child_id', $parameters)) {
             $link_page .= isset($parameters['child_id']) ? 'child_id/' . $parameters['child_id'] . '/' : '';
         }
         if ($product_total > $limit) {
             $config['base_url'] = base_url() . 'pages/category/detail/' . $link_page . 'page/';
             $config['total_rows'] = $product_total;
             $config['cur_page'] = $offset;
             $config['per_page'] = $limit;
             $this->data['pagination'] = create_pagination_pages($config);
         }
     }
     $this->template->build('template/category', $this->data);
 }
Пример #3
0
 public function index()
 {
     $this->data['title'] = lang('heading_title');
     $products = $this->product_model->getLatestProducts($this->session->userdata('config_catalog_limit'));
     $this->data['products'] = array();
     $this->load->model('tool/image_model');
     $this->data['banners'][] = $this->image_model->resize('data/banner/banner3.jpg', 940, 333);
     $this->data['banners'][] = $this->image_model->resize('data/banner/banner2.jpg', 940, 333);
     $this->data['banners'][] = $this->image_model->resize('data/banner/banner1.jpg', 940, 333);
     $this->load->helper('number_format');
     foreach ($products as $product) {
         $img_normal = $this->image_model->resize($product['image'], $this->session->userdata('config_image_category_width'), $this->session->userdata('config_image_category_height'));
         $img_large = $this->image_model->resize($product['image'], $this->session->userdata('config_image_thumb_width'), $this->session->userdata('config_image_thumb_height'));
         $this->data['products'][] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'price' => format_decimal($product['price']), 'normal' => $img_normal, 'large' => $img_large, 'href' => base_url() . 'pages/product/detail/product_id/' . $product['product_id']);
     }
     if (isset($this->session->userdata['success'])) {
         $this->data['success'] = $this->session->userdata['success'];
         $this->session->unset_userdata('success');
     } else {
         $this->data['success'] = '';
     }
     $this->template->build('template/index', $this->data);
 }
Пример #4
0
    echo $special_row;
    ?>
">
              <tr>
                <td class="right"><input type="text" name="product_special[<?php 
    echo $special_row;
    ?>
][priority]" value="<?php 
    echo $product_special['priority'];
    ?>
" size="2" /></td>
                <td class="right"><input type="text" name="product_special[<?php 
    echo $special_row;
    ?>
][price]" value="<?php 
    echo format_decimal($product_special['price']);
    ?>
" /></td>
                <td class="left"><input type="text" name="product_special[<?php 
    echo $special_row;
    ?>
][date_start]" value="<?php 
    echo $product_special['date_start'];
    ?>
" class="date" /></td>
                <td class="left"><input type="text" name="product_special[<?php 
    echo $special_row;
    ?>
][date_end]" value="<?php 
    echo $product_special['date_end'];
    ?>
Пример #5
0
 function manage_trans_config()
 {
     if (!$this->m_admin->check_is_any_admin(76)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $login_id = $this->login_id;
     $login_type = $this->login_type;
     $editable_list = $this->m_admin->trans_config_get_all('editable', 1);
     if (isset($_POST) && !empty($_POST)) {
         $can_redirect_to = 0;
         foreach ($editable_list as $row) {
             $conf_type = $row['conf_type'];
             $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
             $post_data = 'post_data' . $row['trans_conf_id'];
             $field_desc = $row['conf_name'] . ' (' . $row['trans_conf_desc'] . ')';
             if ($conf_type == 'can') {
                 $post_list[$post_data] = check_is_positive_numeric($this->input->post($conf_slug));
                 $this->form_validation->set_rules($conf_slug, $field_desc, 'trim|required|integer');
             } else {
                 $post_list[$post_data] = check_is_positive_decimal($this->input->post($conf_slug));
                 $this->form_validation->set_rules($conf_slug, $field_desc, 'trim|required|numeric');
             }
         }
         if ($this->input->post('button_action') == "save") {
             if ($this->form_validation->run() === TRUE) {
                 foreach ($editable_list as $row) {
                     $post_data = 'post_data' . $row['trans_conf_id'];
                     $update_value = format_decimal($post_list[$post_data]);
                     $this->m_admin->trans_config_set($row['trans_conf_id'], $update_value);
                 }
                 $message_info = add_message_info($message_info, 'Transaction Config success update.');
                 $can_redirect_to = 1;
             }
         }
         direct_go:
         if ($message_info != NULL) {
             $this->session->set_flashdata('message', $message_info);
         }
         if ($can_redirect_to == 1) {
             redirect(uri_string(), 'refresh');
         }
     }
     // set the flash data error message if there is one
     $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));
     foreach ($editable_list as $row) {
         $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
         $conf_value = $this->m_admin->trans_config_get($row['trans_conf_id']);
         $this->data[$conf_slug] = array('name' => $conf_slug, 'id' => $conf_slug, 'type' => 'text', 'style' => 'text-align:right;width:50px', 'value' => $this->form_validation->set_value($conf_slug, $conf_value));
     }
     $this->data['editable_list'] = $editable_list;
     $this->data['page_path_name'] = 'admin/manage_trans_config';
     $this->load->view('template/index', $this->data);
 }
Пример #6
0
 public function autocomplete()
 {
     $json = array();
     $parameters = $this->uri->uri_to_assoc(4);
     if (sizeof($parameters) > 0 && (isset($parameters['filter_name']) || isset($parameters['filter_model']) || isset($parameters['filter_category_id']))) {
         $this->load->model('catalog/product_model');
         $this->load->helper('number_format');
         if (isset($parameters['filter_name'])) {
             $filter_name = $parameters['filter_name'];
         } else {
             $filter_name = '';
         }
         if (isset($parameters['filter_model'])) {
             $filter_model = $parameters['filter_model'];
         } else {
             $filter_model = '';
         }
         if (isset($parameters['filter_category_id'])) {
             $filter_category_id = $parameters['filter_category_id'];
         } else {
             $filter_category_id = '';
         }
         if (isset($parameters['filter_sub_category'])) {
             $filter_sub_category = $parameters['filter_sub_category'];
         } else {
             $filter_sub_category = '';
         }
         if (isset($parameters['limit'])) {
             $limit = $parameters['limit'];
         } else {
             $limit = 20;
         }
         $data = array('filter_name' => $filter_name, 'filter_model' => $filter_model, 'filter_category_id' => $filter_category_id, 'filter_sub_category' => $filter_sub_category, 'start' => 0, 'limit' => $limit);
         $results = $this->product_model->getProducts($data);
         foreach ($results as $result) {
             $json[] = array('product_id' => $result['product_id'], 'name' => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'), 'model' => $result['model'], 'price' => format_decimal($result['price']));
         }
     }
     echo json_encode($json);
 }