Closed MarcKoester closed 5 years ago
I think you can extend the product class as before and use the SignalSlot some code lines later to add your value to $cartProduct.
I use the Slot to add the value:
public function createCartProductChangeNewCartProductSlot($data) {
$productProduct = $data['productProduct'];
$cartProduct = $data['cartProduct'];
$cartProduct->setCompany($productProduct->getCompany());
return [
[
'cartProduct' => $cartProduct
]
];
}
But this produces the error because the extbase override
config.tx_extbase.objects.Extcode\Cart\Domain\Model\Cart\Product.className = Stadtwerk\CartExtension\Domain\Model\Cart\Product
doesn't work anymore.
I have to create my own cartProduct Model and set everything myself to make it work again. Or am I missing soemthing?
Is the property additional of the $cartProduct an option? This field can used for own stuff.
Yes that would be an option. I will use the property additional then. Thanks for your help,
I want to update from cart 4.8 to cart 5.1 and cart_products 1.0. We have extended the Extcode\Cart\Domain\Model\Cart\Product to add a company, so we can display different terms and conditions for different companies.
The Cart Product is currently created directly without the objectManager:
https://github.com/extcode/cart_products/blob/eb0db20cb06b068c8869f91fe7fc99279ab59600/Classes/Utility/ProductUtility.php#L137-L147
Is it possible to use the objectManager to initialize the product? As it was in 4.8?