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.

E-Commerce Modules /

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

Help with super simple OrderModifier


Reply


2 Posts   496 Views

Avatar
nimesodelta

Community Member, 21 Posts

16 March 2012 at 9:42pm

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

Avatar
Jedateach

Forum Moderator, 232 Posts

26 March 2012 at 1:15pm

Edited: 26/03/2012 1:16pm

Hi nimesodelta,

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

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


...not tested though.