<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Urunler extends MY_Controller {


    public function __construct()
    {
        parent::__construct();
        $this->load->model("imageupload_model");
        $this->load->model("file_model");
        $this->load->model('kategoriler_model');
        $this->load->model('markalar_model');
        $this->load->model('galeri_model');
        $this->load->model('products_model');
    }


	public function index()
	{
        redirect(base_url("anasayfa"));
	}


    /*public function urungruplari()
    {
        $viewData = new stdClass();

        $this->load->model('kategoriler_model');

        $kategori = $this->kategoriler_model->get_all
        (
            array
            (
                "ustid" => 0,
                "isActive"   => 1
            ),  "rank ASC"
        );


        $markalar = $this->imageupload_model->get_all
        (
            array
            (                   
                "kind" => "markalar",
                "isActive"   => 1
            ), "rank ASC"
        );
        $viewData->markalar     = $markalar;    

        

        $viewData->kategori = $kategori;
        $viewData->sayfa    = "anasayfa";
        $viewData->nerdengeliyorum = true;

        $this->load->view('urun_gruplari', $viewData);
    }


    public function alt_kategori($katid,$katadi)
    {
        $viewData = new stdClass();

        $this->load->model('kategoriler_model');

        $kategori = $this->kategoriler_model->get_all
        (
            array
            (
                "ustid" => $katid,
                "isActive"   => 1
            ),  "rank ASC"
        );

         $kategorialt = $this->kategoriler_model->get_all
        (
            array
            (
                "ustid" => 0,
                "isActive"   => 1
            ),  "rank ASC"
        );

        
        $kategori1 = $this->kategoriler_model->get
        (
            array
            (
               "id" => $katid,
               "isActive"   => 1
            ), "rank ASC"
        );

        $this->load->model('imageupload_model');
        $digergorsel = $this->imageupload_model->get_all
        (
            array
            (
               "kind" => "kategoriler",
               "urunid" => $katid,
               "isCover" => 0,
               "isActive"   => 1
            ), "rank ASC"
        );

        $markalar = $this->imageupload_model->get_all
        (
            array
            (                   
                "kind" => "markalar",
                "isActive"   => 1
            ), "rank ASC"
        );

        
        $viewData->markalar     = $markalar;
        $viewData->kategori     = $kategori;
        $viewData->kategorialtkoleksiyon     = $kategorialt;
        $viewData->dgorsel      = $digergorsel;
        $viewData->sayfa        = "urun_detay";
        $viewData->folder_name  = "kategoriler_v";
        $viewData->img_tur_name = "kategoriler";
        $viewData->ayar_detay   = $kategori1;
        $viewData->nerdengeliyorum = "altkoleksiyon";

        $this->load->view('urun_gruplari', $viewData);
    }*/


    public function urunler()
    {
        $viewData = new StdClass();
        $urunler = $this->products_model->get_all
        (
            array
            (
               "isActive"   => 1
            ), "rank ASC"
        );

    
        $viewData->urunler      = $urunler;
        $viewData->sayfa        = "anasayfa";
        $viewData->folder_name  = "products_v";
        $viewData->img_tur_name = "products";
        $viewData->urunler_footer = $this->urunler_footer;
        $viewData->kurumsal_footer = $this->hizmetler_footer;
        $viewData->nerdengeliyorum = true;

        $this->load->view('frontend/neleryapiyoruz', $viewData);    
    }


    public function urundetay($urunid, $urunadi)
    {

        $viewData = new StdClass();


        $uruntek = $this->products_model->get
        (
            array
            (
               "id" => $urunid,
               "isActive"   => 1
            ), "rank ASC"
        );


        $urunler = $this->products_model->get_all
        (
            array
            (
               "isActive"   => 1
            ), "rank ASC"
        );

       
     
        $viewData->urun         = $uruntek;
        $viewData->ayar_detay   = $uruntek;
        $viewData->solMenu      = $urunler;
        $viewData->sayfa        = "urun_detay";
        $viewData->folder_name  = "products_v";
        $viewData->img_tur_name = "products";
        $viewData->urunler_footer = $this->urunler_footer;
        $viewData->kurumsal_footer = $this->hizmetler_footer;
        $viewData->nerdengeliyorum = "";


        $this->load->view('frontend/nydetay', $viewData); 
    }


    /*public function siparis_formu()
    {


        $viewData = new stdClass(); 

        $this->load->model("emailsettings_model");

        $user = $this->emailsettings_model->get
        (
            array
            (
                "isactive"  => 1
            ),  "LIMIT 0,1"
        );

        $isim   = $this->security->xss_clean($this->input->post("isim"));
        $tel    = $this->security->xss_clean($this->input->post("tel"));
        $mail   = $this->security->xss_clean($this->input->post("mail"));
        $urun  = $this->security->xss_clean($this->input->post("urun"));
        $konu   = $this->security->xss_clean($this->input->post("mesaj"));

        $mailmetin  = "<b>Ad Soyad</b>:".$isim."/n";
        $mailmetin .= "<b>Sipariş Verilen Ürün</b>:   ".$urun."/n";
        $mailmetin .= "<b>E-Posta</b>: ".$mail."/n";
        $mailmetin .= "<b>Telefon</b>: ".$tel."/n";
        $mailmetin .= "<b>Konu</b>:    ".$konu;
    


        $send = mail_send($user->user,"Sipariş Formu",$mailmetin);
        if ($send)
        {
            $alert = array
            (
                "mesaj"  => "Siparişiniz Başarı ile alındı, teşekkür ederiz..."
            );
        } 

        else 
        {
           $alert = array
            (
                "mesaj"  => "Bir hata oluştu, Lütfen daha sonra tekrar deneyin..."
            );  
        }

         $this->session->set_flashdata("alert", $alert);
            redirect(base_url("koleksiyonlar"));
    }*/
}


