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.

Customising the CMS /

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


Reply


4 Posts   1047 Views

Avatar
Andre

Community Member, 126 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, 5513 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, 126 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, 126 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