Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

DataObject::get_by_id -> receiving the previev page istead of Life


Go to End


4 Posts   1499 Views

Avatar
Andre

Community Member, 146 Posts

10 November 2009 at 7:47am

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

Avatar
Willr

Forum Moderator, 5523 Posts

10 November 2009 at 5:29pm

You need to write then publish the page

			$page->write();
			$page->publish("Stage", "Live");

Ecommerce is missing alot of features, developers but having 2 half decent modules is not as smart as 1 good module so perhaps you want to submit improvements as patches to open.silverstripe.org which can be integrated into the module.

Avatar
Andre

Community Member, 146 Posts

11 November 2009 at 4:23am

Hi, many thanks for your help.

The Problem is not only many feature missing in Ecommerce, the Problem is, it isn't working for me, cause there are so many things implemented without passion. I need a Shop System for the German Market and Translation in the Ecommerce Modul is horrible. You have to rewrite to many things to make everything work like a charm, so I prefer to rebuild the Shop less complex but working. For the first version, there will be no Shopingcart because this is not needed for my clients at the moment. They just sell single Items. In the next Versions these Things will be implemented.

Greetings Andre

Avatar
Andre

Community Member, 146 Posts

11 November 2009 at 4:23am

Hi, many thanks for your help.

The Problem is not only many feature missing in Ecommerce, the Problem is, it isn't working for me, cause there are so many things implemented without passion. I need a Shop System for the German Market and Translation in the Ecommerce Modul is horrible. You have to rewrite to many things to make everything work like a charm, so I prefer to rebuild the Shop less complex but working. For the first version, there will be no Shopingcart because this is not needed for my clients at the moment. They just sell single Items. In the next Versions these Things will be implemented.

Greetings Andre