in my code I have a subclass of Page, and I am trying to update some of its additional parameters but unlike regular updates my changes do not take effect. They are visible in the admin console as unpublished versions, how can I just simply change some parameters?
I have overridden canEdit and canPublish to allow changes from any user (as that will be my intended use) but I am trying it out with admin anyway, the code looks similar to this:
$product->QuantityInStock -= 1; $product->write();
I have also tried calling following:
$product->publish('Stage', 'Live'); $product->doPublish();
None of it actually publishes the page, it only produces unpublished versions which I can review in the admin console and can "roll back" to them but that is not really what I want as I would like to have a counter on the page which any user can update via special form and code.
Also, I only want to update the product object, it is not created anew.
I would really appreciate some help!