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

class Flisteleri extends MY_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('products_model');
        $this->load->helper('text_helper');
    }

    public function index()
    {
        $viewData = new stdClass(); 
        
        $urunler = $this->products_model->get_all
        (
            array
            (
               "isActive"   => 1
            ), "rank ASC"
        );
       
        $viewData->urunler          = $urunler;
        $viewData->urunler_footer   = $this->urunler_footer;
        $viewData->sayfa            = "anasayfa";
        $viewData->folder_name      = "ekstrasayfalar_v";
        $viewData->img_tur_name     = "kampanyalar";
        $viewData->nerdengeliyorum  = "";
        $viewData->dea            = $this->dolar_efektif_alis; 
        $viewData->eea            = $this->euro_efektif_alis; 
        $viewData->des            = $this->dolar_efektif_satis;
        $viewData->ees            = $this->euro_efektif_satis;

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





    public function fiyatlisteleridetay($urunid,$urunadi)
    {
        $viewData = new StdClass();

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

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

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

        

        $this->load->model('imageupload_model');
        $itemsSlider = $this->imageupload_model->get_all
        (
            array
            (
               "kind"       => "products",
               "urunid"     => $urunid,
               "isActive"   => 1
            ), "rank ASC"
        );


        $rows = $this->db->where("urunid",$urunid)->get('documents')->result();
        if (!empty($rows->dosya)) {$dosyavarmi = "evet";} else {$dosyavarmi = "hayir";}
      
        $viewData->urunler_footer   = $this->urunler_footer;
        $viewData->urun             = $urunler;
        $viewData->urunler_coklu    = $urunler_coklu;
        $viewData->ayar_detay       = $urunler;
        $viewData->dgorsel          = $itemsSlider;
        $viewData->galeri           = $itemsSlider;
        $viewData->docs             = $rows;
        $viewData->sayfa            = "urun_detay";
        $viewData->folder_name      = "ekstrasayfalar_v";
        $viewData->img_tur_name     = "kampanyalar";
        $viewData->nerdengeliyorum  = "";
        $viewData->dea            = $this->dolar_efektif_alis; 
        $viewData->eea            = $this->euro_efektif_alis; 
        $viewData->des            = $this->dolar_efektif_satis;
        $viewData->ees            = $this->euro_efektif_satis;

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