Jump to:

2084 Posts in 1005 Topics by 453 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Help with super simple OrderModifier

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 432 Views
  • nimesodelta
    Avatar
    Community Member
    18 Posts

    Help with super simple OrderModifier Link to this post

    Hey all,

    Firstly, thanks for all the hard work everyone has been doing on the cart! looking great!

    Please help.

    All I want to do is create a custom Modifier that does nothing more than add $10 to the order Total. I dont need any ModifierForms etc etc... just add $10 to the total
    I know, I know... this should be easy... I have the following:

    <?php
    class ModifierExample extends OrderModifier {
       
       protected function LiveName() {
          return "Test";
       }

       protected function LiveCalculatedTotal() {
          return 10;
       }

       public function LiveTableValue() {
          return $this->LiveCalculatedTotal();
       }
       
    }

    and added correct line to _config

    But i get the following error going to the checkout page:
    [User Error] While the order can be edited, you must call the runUpdate method everytime you get the details for this modifier

    Sessions cleared dev/build etc etc all done..
    Sorry if I'm completely missing something stupid here... it's driving me nuts! Thanks in advance

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Help with super simple OrderModifier Link to this post

    Hi nimesodelta,

    In the latest version of shop, this should be enough:

    <?php
    class ModifierExample extends OrderModifier {
    function value() {
    return 10;
    }
    }


    ...not tested though.

    432 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.