Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » DataObject::get_by_id -> receiving the previev page istead of Life

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

Page: 1
Go to End
Author Topic: 1006 Views
  • Andre
    Avatar
    Community Member
    126 Posts

    DataObject::get_by_id -> receiving the previev page istead of Life Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: DataObject::get_by_id -> receiving the previev page istead of Life Link to this post

    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.

  • Andre
    Avatar
    Community Member
    126 Posts

    Re: DataObject::get_by_id -> receiving the previev page istead of Life Link to this post

    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

  • Andre
    Avatar
    Community Member
    126 Posts

    Re: DataObject::get_by_id -> receiving the previev page istead of Life Link to this post

    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

    1006 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.