/** * @param \Eccube\Entity\CartItem $AddCartItem * @return \Eccube\Entity\Cart */ public function setCartItem(\Eccube\Entity\CartItem $AddCartItem) { $find = false; foreach ($this->CartItems as $CartItem) { if ($CartItem->getClassName() === $AddCartItem->getClassName() && $CartItem->getClassId() === $AddCartItem->getClassId()) { $find = true; $CartItem->setPrice($AddCartItem->getPrice())->setQuantity($AddCartItem->getQuantity()); } } if (!$find) { $this->addCartItem($AddCartItem); } return $this; }
/** * CartItem に対応する ProductClass を設定します。 * * @param CartItem $CartItem */ protected function loadProductClassFromCartItem(CartItem $CartItem) { $ProductClass = $this->entityManager->getRepository($CartItem->getClassName())->find($CartItem->getClassId()); $CartItem->setObject($ProductClass); if (is_null($this->ProductType) && $ProductClass->getDelFlg() == Constant::DISABLED) { $this->setCanAddProductType($ProductClass->getProductType()); } }