/** * @param \Extcode\Cart\Domain\Model\Cart\Product $product * @param \Extcode\Cart\Domain\Model\Cart\Product $newProduct * * @internal param $id * @internal param $newQuantity * * @return void */ public function changeProduct($product, $newProduct) { $newQuantity = $product->getQuantity() + $newProduct->getQuantity(); $this->subCount($product->getQuantity()); $this->subGross($product->getGross()); $this->subNet($product->getNet()); $this->subTax($product->getTax(), $product->getTaxClass()); // if the new product has a variant then change it in product if ($newProduct->getBeVariants()) { $product->addBeVariants($newProduct->getBeVariants()); } $product->changeQuantity($newQuantity); $this->addCount($product->getQuantity()); $this->addGross($product->getGross()); $this->addNet($product->getNet()); $this->addTax($product->getTax(), $product->getTaxClass()); //update all service attributes $this->updateServiceAttributes(); }