/**
* A kosárhoz hozzá adja a terméket hozzá tartozó mennyiséggel együtt.
* A products arrayben a termék id-je az index
* és ugyan ezzel indexelem a qauntities tömböt, így te megoldásod is maradhat és egyértelmű.
*
* @param Product $product
* @param int $quantity
*/
public function addProduct($product, $quantity)
{
if (!isset($this->products[$product->getId()])) {
$this->products[$product->getId()] = $product;
$this->quantities[$product->getId()] = $quantity;
} else {
$this->quantities[$product->getId()] += $quantity;
}
//echo "elemek száma: " . count($this->items) . " db & " . count($this->quantity) . " db.<br>";
}