Пример #1
0
    public function index()
    {
        $cat_id = $_GET['cat_id'];
        $config['base_url'] = base_url() . 'category/?cat_id=' . $_GET['cat_id'];
        $config['total_rows'] = $this->product_model->total_product_by_category($_GET['cat_id']);
        $config['per_page'] = 20;
        $config['uri_segment'] = isset($_GET['per_page']) ? $_GET['per_page'] : 9;
        $this->pagination->initialize($config);
        $offset = $config['uri_segment'];
        $limit = $config['per_page'];
        $config['enable_query_strings'] = TRUE;
        $config['page_query_string'] = TRUE;
        $this->pagination->initialize($config);
        $products = $this->product_model->product_by_category($cat_id, $limit, $offset);
        $pro_html = '';
        if ($products) {
            foreach ($products as $products) {
                if ($products['product_image']) {
                    $image_path_original = other_asset_url($products['product_image'] . '_m.' . $products['product_ext'], '', 'uploads/images/products');
                }
                $iarr = @getimagesize($image_path_original);
                if (!is_array($iarr)) {
                    $image_path_original = image_asset_url('no_image.gif');
                }
                $img_featue = 'header.jpg';
                $heart_class = '<div class="heart" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '" style="display:none">
										' . image_asset($img_featue) . '
									</div>';
                $whislist_detail = $this->wishlist_model->get_wishlist_detail_product($products['pro_id']);
                if ($this->wishlist_model->get_wishlist_detail_product($products['pro_id'])) {
                    $img_featue = 'heart_red.jpg';
                    $heart_class = '<div class="heartred" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '">
										' . image_asset($img_featue) . '
									</div>';
                }
                $sale_tag = '';
                if ($products['sale_type_id'] == '1') {
                    $sale_tag = '<span style="float:left;"> Before: ' . round($products['product_price']) . ' kr
							<br>
							<label style="color:red">Now: ' . round($products['sale_value']) . ' kr</label> </span>
							<div class="persentage_imgs">
								-' . round(100 - $products['sale_value'] / $products['product_price'] * 100) . '%
							</div>';
                } elseif ($products['sale_type_id'] == '2') {
                    $now_price = $products['product_price'] * ($products['sale_value'] / 100);
                    $sale_tag = '<span style="float:left;"> Before: ' . round($products['product_price']) . ' kr
							<br>
							<label style="color:red">Now: ' . round($products['product_price'] - $now_price) . ' kr</label> </span>
							<div class="persentage_imgs">
										-' . round($products['sale_value']) . '%
							</div><!--persentage_img-->';
                } else {
                    $sale_tag = '<span style="float:left;"> 
							<label style="color:red">Now:' . round($products['product_price']) . ' kr</label> </span>';
                    if ($products['sale_type_id'] == '3') {
                        $sale_tag .= '<br /><span style="float:left;"><label> Buy 1 get ' . $products['sale_value'] . ' free</label></span>';
                    }
                    if ($products['sale_type_id'] == '4') {
                        $deals = explode('_', $products['sale_value']);
                        $sale_tag .= '<span style="float:left;"><label >Buy ' . $deals[0] . ' and pay for ' . $deals[1] . '</label></span>';
                    }
                }
                $pro_html .= '<div class="cata_pro product_detail" rel="' . $products['pro_id'] . '">
									<a id="product_' . $products['pro_id'] . '" href="' . base_url() . 'product/product_detail/' . $products['pro_id'] . '" ><img height="256" width="200" src="' . $image_path_original . '"/></a>
									
									' . $heart_class . '
									<p>
										' . trim_text(strip_tags($products['product_name']), 30) . '
									</p>
									<div class="clear"></div>									
									' . $sale_tag . '
								</div><!--cata_pro-->';
            }
        } else {
            $pro_html .= '<div class="cata_pro"><p>Sorry No Record Yet!</p></div>';
        }
        $cat_id = $this->input->get("cat_id");
        $data['category_name'] = get_categroy_name($cat_id);
        $data['category_detail'] = $this->categories_model->get_category_detail($cat_id);
        $data['product_category'] = get_product_oncategory($cat_id);
        //$data['product_category']  = '';
        $data['other_choice'] = other_choice_category();
        $data['related_categories'] = related_categories($cat_id);
        $data['sales_to_missed'] = sales_not_missed();
        $data['products'] = $pro_html;
        $data['pagination'] = $this->pagination->create_links();
        $data['query_params'] = $this->input->get();
        $data['total_records'] = $config['base_url'];
        $this->load->view('main/category.html', $data);
    }
Пример #2
0
    public function product_detail($product_id)
    {
        $product_detail = $this->product_model->get_product_detail($product_id, 0);
        if (!$product_detail) {
            redirect(base_url());
        }
        $product_view = $product_detail['product_view'] + 1;
        $update_view = $this->product_model->product_up($product_id, $product_view);
        $sale_info = $this->sale_model->get_sale($product_detail['sale_type_id']);
        $detail = '';
        $sale_tag = '';
        if ($product_detail) {
            if ($product_detail['from_api'] == 0) {
                $image_path_original = other_asset_url($product_detail['product_image'] . '_l.' . $product_detail['product_ext'], '', 'uploads/images/products');
            } else {
                $image_path_original = $product_detail['product_image'];
            }
            $wish_list = $this->wishlist_model->get_wishlist_detail_product($product_id);
            $wish_div = '';
            if (!$wish_list) {
                $wish_div = '<a href="#" class="add_wishlist" rel="' . $product_id . '">' . image_asset('btn_02.jpg') . '</a>';
            }
            $product_link = '';
            if ($product_detail['buy_link_type'] == '1') {
                $product_link = '<a href="' . base_url() . 'product/visit/?url=' . urlencode($product_detail['product_buy_link']) . '" class="buylink" target="_blank" rel="' . $product_id . '">' . image_asset('btn_01.jpg') . '</a>';
            }
            $map = '';
            if ($product_detail['buy_link_type'] == '2') {
                $map = '<div id="map_canvas" class="gray_bg" rel="' . $product_detail['product_buy_link'] . '" style="width:300px; height:300px;">
				</div>';
            }
            if ($product_detail['sale_type_id'] == '1') {
                $sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($product_detail['product_price']) . ' kr
							<br>
							<label style="color:red">Nu: ' . makeCurrency($product_detail['sale_value']) . ' kr</label> </span>
							<div class="persentage_imgs" style="float:left">
								-' . makeCurrency(100 - $product_detail['sale_value'] / $product_detail['product_price'] * 100) . '%
							</div>
							';
            } elseif ($product_detail['sale_type_id'] == '5') {
                $sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($product_detail['product_price']) . ' kr
							<br>
							<label style="color:red">Nu: ' . makeCurrency($product_detail['sale_price']) . ' kr</label> </span>
							<div class="persentage_imgs" style="float:left">
								-' . $product_detail['api_reduction_percent'] . '%
							</div>
							';
            } elseif ($product_detail['sale_type_id'] == '2') {
                $product_detail['product_price'] . "*" . $product_detail['sale_value'];
                $now_price = $product_detail['product_price'] * ($product_detail['sale_value'] / 100);
                $sale_tag = '<span class="beforeprice">Price Före: ' . makeCurrency($product_detail['product_price']) . ' SEK</span> 
							<span class="afterprice" style="float:left">Nu: ' . makeCurrency($product_detail['product_price'] - $now_price) . ' SEK</span>
							<div class="persentage_imgs" style="float:left">
										-' . makeCurrency($product_detail['sale_value']) . '%
							</div>';
            }
            $detail = '
                                                <div class="product_detail_area">
                                                    <div class="img_left">
                                                            <a href="' . $product_detail['product_buy_link'] . '" target="_blank">
                                                                    <img width="" height="" src="' . $image_path_original . '" title="large image" />
                                                            </a>
                                                            <br />';
            if (is_array($this->product_model->get_product_more_images($product_id))) {
                $detail .= '<a href="' . $product_detail['product_buy_link'] . '" target="_blank" class="viewmoreimages" rel="' . $product_id . '" style="margin-left:125px;">' . image_asset('more_images.jpg') . '</a>';
            }
            $detail .= '                                        </div>
                                                    <div class="product_info">
                                                            <p>
                                                                    ' . $product_detail['product_name'] . '
                                                            </p>
                                                            ' . $sale_tag . '
                                                            <div class="clear"></div>
                                                            <div class="add_btns">
                                                                    ' . $product_link . '								
                                                                    ' . $wish_div . '
                                                            </div><!--add_btns-->
                                                            <div class="clear"></div>
                                                            <div class="gray_bg" style="padding:10px;font-size:12px;font-family:tahoma;color:#666">
                                                                    Produkten finns tillgänglig på: 
                                                                    <b>' . $product_detail['store_name'] . '</b>
                                                                    <p><strong>Beskrivning:</strong></p>
                                                                    ' . strip_tags($product_detail['product_description'], "<br><br><b><strong>") . '
                                                            </div>
                                                            ' . $map . '
                                                    </div>											
                                                    <div class="share_btns" >
                                                            <span class="st_sharethis_large" displayText="ShareThis"></span>
                                                            <span class="st_facebook_large" displayText="Facebook"></span>
                                                            <span class="st_twitter_large" displayText="Tweet"></span>
                                                            <span class="st_linkedin_large" displayText="LinkedIn"></span>
                                                            <span class="st_pinterest_large" displayText="Pinterest"></span>
                                                            <span class="st_email_large" displayText="Email"></span>
                                                    </div>
                                                </div>';
        }
        $data['category_name'] = get_categroy_name($product_detail['cat_id']);
        $data['product_category'] = get_product_oncategory($product_detail['cat_id'], 3, 0);
        $data['other_choice'] = other_choice_category();
        $data['related_categories'] = related_categories($product_detail['cat_id']);
        $data['sales_to_missed'] = sales_not_missed();
        $data['product_detail'] = $detail;
        $data['product_id'] = $product_id;
        $data['cat_id'] = $product_detail['cat_id'];
        $data['store_name'] = $product_detail['store_name'];
        $data['detail'] = $product_detail;
        //$this->load->view('product_detail.html',$data);
        $this->template->load('responsive/default', 'responsive/detail', $data);
        //  $this->output->enable_profiler(true);
    }
Пример #3
0
    public function index()
    {
        $query_params = $this->input->get();
        $tmp_url = '';
        if (isset($query_params['brand'])) {
            $tmp_url .= "&brand=" . $query_params['brand'];
        }
        if (isset($query_params['min_price'])) {
            $tmp_url .= "&min_price=" . $query_params['min_price'];
        }
        if (isset($query_params['max_price'])) {
            $tmp_url .= "&max_price=" . $query_params['max_price'];
        }
        $cat_id = $_GET['cat_id'];
        $config['base_url'] = base_url() . 'category/?cat_id=' . $_GET['cat_id'] . $tmp_url;
        $config['total_rows'] = $this->product_model->total_product_by_category($_GET['cat_id']);
        $config['per_page'] = 24;
        $config['prev_link'] = '&lt; Föregående';
        $config['next_link'] = 'Nästa &gt;';
        $config['uri_segment'] = isset($_GET['per_page']) ? $_GET['per_page'] : 0;
        //$this->pagination->initialize($config);
        $offset = $config['uri_segment'];
        $limit = $config['per_page'];
        $config['enable_query_strings'] = TRUE;
        $config['page_query_string'] = TRUE;
        $this->pagination->initialize($config);
        $products = $this->product_model->product_by_category($cat_id, $limit, $offset);
        $pro_html = '';
        if ($products) {
            foreach ($products as $products) {
                if ($products['from_api'] == 0) {
                    $image_path_original = other_asset_url($products['product_image'] . '_m.' . $products['product_ext'], '', 'uploads/images/products');
                } else {
                    $image_path_original = str_replace('440', '220', $products['product_image']);
                }
                //        echo $image_path_original ;
                //$iarr = @getimagesize($image_path_original);
                //if(!is_array($iarr)){
                //$image_path_original = image_asset_url('no_image.gif');
                //      }
                $img_featue = 'header.jpg';
                $heart_class = '<div class="heart" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '" style="display:none">
										' . image_asset($img_featue) . '
									</div>';
                $whislist_detail = $this->wishlist_model->get_wishlist_detail_product($products['pro_id']);
                if ($this->wishlist_model->get_wishlist_detail_product($products['pro_id'])) {
                    $img_featue = 'heart_red.jpg';
                    $heart_class = '<div class="heartred" rel="' . $products['pro_id'] . '" id="wish_heart_' . $products['pro_id'] . '">
										' . image_asset($img_featue) . '
									</div>';
                }
                $sale_tag = '';
                if ($products['sale_type_id'] == '1') {
                    $sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($products['product_price']) . ' kr
							<br>
							<label style="color:red">Nu: ' . makeCurrency($products['sale_value']) . ' kr</label> </span>
							<div class="persentage_imgs">
								-' . makeCurrency(100 - $products['sale_value'] / $products['product_price'] * 100) . '%
							</div>';
                } elseif ($products['sale_type_id'] == '5') {
                    $sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($products['product_price']) . ' kr
							<br>
							<label style="color:red">Nu: ' . makeCurrency($products['sale_price']) . ' kr</label> </span>
							<div class="persentage_imgs">
								-' . $products['api_reduction_percent'] . '%
							</div>';
                } elseif ($products['sale_type_id'] == '2') {
                    $now_price = $products['product_price'] * ($products['sale_value'] / 100);
                    $sale_tag = '<span style="float:left;"> Före: ' . makeCurrency($products['product_price']) . ' kr
							<br>
							<label style="color:red">Nu: ' . makeCurrency($products['product_price'] - $now_price) . ' kr</label> </span>
							<div class="persentage_imgs">
										-' . makeCurrency($products['sale_value']) . '%
							</div><!--persentage_img-->';
                } else {
                    $sale_tag = '<span style="float:left;"> 
							<label style="color:red">Nu:' . makeCurrency($products['product_price']) . ' kr</label> </span>';
                    if ($products['sale_type_id'] == '3') {
                        $sale_tag .= '<br /><span style="float:left;"><label> Buy 1 get ' . $products['sale_value'] . ' free</label></span>';
                    }
                    if ($products['sale_type_id'] == '4') {
                        $deals = explode('_', $products['sale_value']);
                        $sale_tag .= '<span style="float:left;"><label >Buy ' . $deals[0] . ' and pay for ' . $deals[1] . '</label></span>';
                    }
                }
                $pro_html .= '<div class="cata_pro product_detail" rel="' . $products['pro_id'] . '">
									<a id="product_' . $products['pro_id'] . '" href="' . base_url() . 'product/product_detail/' . $products['pro_id'] . '" ><img src="' . $image_path_original . '"/></a>
									
									' . $heart_class . '
									<p>
										' . trim_text(strip_tags($products['product_name']), 32) . '
									</p>
									<div class="clear"></div>									
									' . $sale_tag . '
								</div><!--cata_pro-->';
            }
        } else {
            $pro_html .= '<div class="cata_pro"><p>Kommer snart! </p></div>';
        }
        $cat_id = $this->input->get("cat_id");
        $data['category_name'] = get_categroy_name($cat_id);
        $data['category_detail'] = $this->categories_model->get_category_detail($cat_id);
        $data['product_category'] = get_product_oncategory($cat_id);
        //$data['product_category']  = '';
        $data['other_choice'] = other_choice_category();
        $data['related_categories'] = related_categories($cat_id);
        $data['sales_to_missed'] = sales_not_missed();
        $data['products'] = $pro_html;
        $data['pagination'] = $this->pagination->create_links();
        $data['query_params'] = $this->input->get();
        $data['total_records'] = $config['total_rows'];
        $this->template->load('responsive/default', 'responsive/category', $data);
        //$this->output->enable_profiler(TRUE);
    }