Subversion-Projekte lars-tiefland.ci

Revision

Revision 519 | Revision 528 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * @author Lars Tiefland
 * @copyright 2016
 */

/**
 * Preise_model
 * 
 * Liest alle Preise eines Artikels aus.
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id$
 * @access public
 */
class Preise_model extends CI_Model
{
        /**
         * Preise_model::get_prices()
         * 
         * git alle Preise eines Artikels zurück.
         * 
         * @param mixed $artikel_id
         * @return
         */
        public function get_prices($artikel_id)
        {
                $preise = array();
                $query = $this->db->get_where('preise', array(
                        "artikel_id" => $artikel_id,
                        "language" => "DE",
                        ));
                while ($row = $query->unbuffered_row('array'))
                {
                        $preise["preis".$row["preis_index"]] = $row["preis"];
                }
                return $preise;
        }
        /**
         * Preise_model::get_single_price()
         * 
         * Gibt nur den über $preis_index spezifizierten Preis zurück.
         * 
         * @param mixed $artikel_id
         * @param integer $preis_index
         * @return
         */
        public function get_single_price($artikel_id,$preis_index=1)
        {
                $query = $this->db->get_where('preise', array(
                        "artikel_id" => $artikel_id,
            "preis_index" => $preis_index,
                        "language" => "DE",
                        ));
            $preis = $query->result_array();
            return $preis["preis"];
        }

}

?>