Subversion-Projekte lars-tiefland.shop_ns

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php
    /**
     * @package shop
     * @author Lars Tiefland <ltiefland@gmail.com>
     * @copyright 2012
     * @version $Id$
     */

    /**
     * @package shop
     * @author Lars Tiefland <ltiefland@gmail.com>
     * @copyright 2012
     * @version $Id$
     */

    namespace Weban;
    class basket
    {
        public $items;
        public $versand;
        public function __construct()
        {
            $this->items = array();
        }

        public function addItem( $item_id, $menge = 1 )
        {
            $item = new artikel( $item_id );
            $preis = $item->preis[1]["preis"];
            $this->items[] = array(
                "ID" => $item_id,
                "menge" => $menge,
                "preis" => $preis,
                "basketItemSumme" => $preis * $menge,
                );
        }

        public function changeMenge( $b_item, $menge )
        {
            $this->items[$b_item]["menge"] = $menge;
        }

        public function delete( $b_item )
        {
            unset( $this->items[$b_item] );
        }

        public function setVersand( $v_item, $zuschlag = 0 )
        {
            $this->versand = array(
                "ID" => $v_item,
                "menge" => 1,
                "zuschlag" => $zuschlag,
                );
        }
    }
?>