public function actionIndex($filtro) { $categoria = OkoCategorias::model()->findByPk((int) $filtro); $subCategoria = OkoSubCategoria::model()->findAllBySql("SELECT * FROM `oko_sub_categoria` WHERE `id_categoria` = " . (int) $filtro); $muebles = OkoMuebles::model()->findAll(); // $muebles = Yii::app()->db->createCommand() // ->select("mueble.*") // ->from("oko_sub_categoria as sub") // ->join("oko_muebles_sub_categoria as muebleSub","muebleSub.id_sub_categoria = sub.id") // ->join("oko_muebles as mueble","mueble.id = muebleSub.id_mueble") // ->where("sub.id_categoria = ".(int)$filtro) // ->queryAll(); $this->render('index', array('categoria' => $categoria, 'subCategoria' => $subCategoria, 'muebles' => $muebles, 'id' => $filtro)); }
public function id_categoriaChoices() { return OkoCategorias::model()->getCategorias(); }
<?php /* @var $this Controller */ $baseUrl = Yii::app()->baseUrl; //$cs = Yii::app()->getClientScript(); //$cs->registerScriptFile('https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); $categorias = OkoCategorias::model()->findAll(); $arregloCategorias = array(); foreach ($categorias as $data) { $arregloCategorias[] = array('label' => $data['categoria'], 'url' => array('/muebles?filtro=' . $data['id'])); } $contacto = OkoContacto::model()->findAll(); $arregloContacto = array(); foreach ($contacto as $data) { $arregloContacto[] = $data; } $mapa = 0; ?> <!DOCTYPE html> <html> <link rel="shortcut icon" href="<?php echo $baseUrl; ?> /imagenes/Iconos/favicon.png" type="image/x-icon" /> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="language" content="en"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- blueprint CSS framework --> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>