Hi there,
I am writing a new Ecommerce Modul because the old one doesn't seem to be developed any further.
I added Products as Pages and gave them a Quantaty. Until now everything works fine. When a Product is baught by a client I decrement the Quantaty like this:
$product = DataObject::get_by_id('EcommerceProduktPage', $productid);
$product->Quantaty--;
$product->write();
This Way the Product Quantaty decreases correctly in the Database on EcommerceProductPage_live Table, but how do I also decrease it on EcommerceProductPage Table to prevent heaving a different Preview from Live Version in the Backend? One way is to simply run a Database Query, but I prefer the Silverstripe Way if there is one existing.
Greetings
Andre