77 lines
2.8 KiB
PHP
77 lines
2.8 KiB
PHP
<?php
|
|
/*************************************************************************************/
|
|
/* */
|
|
/* Thelia */
|
|
/* */
|
|
/* Copyright (c) Octolys Development */
|
|
/* email : thelia@octolys.fr */
|
|
/* web : http://www.octolys.fr */
|
|
/* */
|
|
/* This program is free software; you can redistribute it and/or modify */
|
|
/* it under the terms of the GNU General Public License as published by */
|
|
/* the Free Software Foundation; either version 2 of the License, or */
|
|
/* (at your option) any later version. */
|
|
/* */
|
|
/* This program is distributed in the hope that it will be useful, */
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
/* GNU General Public License for more details. */
|
|
/* */
|
|
/* You should have received a copy of the GNU General Public License */
|
|
/* along with this program; if not, write to the Free Software */
|
|
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
/* */
|
|
/*************************************************************************************/
|
|
?>
|
|
<?php
|
|
|
|
// Déninition du panier
|
|
|
|
class Comparateur_panier {
|
|
|
|
var $nbart;
|
|
var $tabarticle;
|
|
|
|
function Comparateur_panier(){
|
|
$this->nbart = 0;
|
|
$this->tabarticle=array();
|
|
}
|
|
|
|
function ajouter($ref){
|
|
|
|
$existe = 0;
|
|
|
|
for($i=0; $i<$this->nbart; $i++)
|
|
if(isset($this->tabarticle[$i]) && $this->tabarticle[$i] == "$ref")
|
|
$existe = 1;
|
|
|
|
|
|
if(!$existe){
|
|
$this->tabarticle[$this->nbart] = $ref;
|
|
$this->nbart++;
|
|
}
|
|
|
|
}
|
|
|
|
function supprimer($id){
|
|
|
|
|
|
if(! $this->tabarticle[$id]) return;
|
|
|
|
$this->tabarticle[$id]="";
|
|
|
|
for($i=$id+1; $i<$this->nbart; $i++)
|
|
if(isset($this->tabarticle[$i]))
|
|
$this->tabarticle[$i-1] = $this->tabarticle[$i];
|
|
|
|
unset($this->tabarticle[$this->nbart-1]);
|
|
$this->nbart--;
|
|
}
|
|
|
|
function nbart(){
|
|
return $this->nbart;
|
|
}
|
|
|
|
|
|
}
|
|
?>
|