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

Order Modifiers buggy?


Reply


8 Posts   1297 Views

Avatar
dbenton

Community Member, 22 Posts

25 February 2010 at 9:49pm

I am trying to get order modifiers working. I wrote a shipping modifier which worked intermittently, and now I cannot get any order modifiers to work.

Here is my entire test class:

class TestModifier extends OrderModifier {
   function LiveAmount() {
      return 1;   
   }
   function TableTitle() {
      return 'Test';
   }
}

And I've added the following to mysite/_config.php:

Order::set_modifiers(array('TestModifier'));

The result is a line item on the checkout page that says "Test" and has a total column value of $0.00 (and the order total is not increased by 1 either).

Surely I am overlooking something simple.

Thanks in advance,
David

Avatar
kcd

Community Member, 54 Posts

25 February 2010 at 11:41pm

I found ?flush=1 and dev/build weren't enough to reset the cart so I closed my browser and that worked. Also when you do dev/build check your file is being picked up, mine wasn't when in the mysite directory.

Avatar
dbenton

Community Member, 22 Posts

25 February 2010 at 11:54pm

Thanks kcd. I have been (not consistently, but occasionally) deleting my cookies, running /dev/build and flushing the cache, and still the same result.

What was your solution when the environment builder wasn't including your modifier? Did you just move it to a random folder with a _config.php?

Avatar
dbenton

Community Member, 22 Posts

26 February 2010 at 12:04am

Ok, my modifier class is definitely being included. I see it when I run /dev/build and the line item shows up on the checkout page.

I just deleted cookies, restarted my browser (why not?) and ran /dev/build. Same result. I don't get it. If this modifier were run at all, it should add $1.00 to the total, correct? How can it be included on the checkout page, but not in the total cost?

The LiveValue method /is/ being called. For the fun of it, I just added

echo "Modify!";

to LiveAmount() and it was echoed three times on the checkout page, but the total was not updated.

Stumped,
David

Avatar
kcd

Community Member, 54 Posts

26 February 2010 at 9:06am

Hmmmm, I got it working literally an hour after you first posted.

I had slightly more code but nothing I thought was critical. I included $is_chargable = false (discount), show in table, show in cart, a cart title... all of which inherit default values.

I also wrote my onbeforewrite (or whatever it is called) function to save $this=>Amount = $this =>LiveAmount() and another custom variable.

Unfortunately I don't have my code on me

Avatar
dbenton

Community Member, 22 Posts

10 March 2010 at 11:37am

Thanks for your help, kcd. I've been out of town (left shortly after my first post), and while I was away the client decided to replace the ecommerce module with something a little more mature (but not integrated into SS). I think it was the right decision for this project, but I hope to work with the SS ecommerce module again in the future.

Best,
David

Avatar
kcd

Community Member, 54 Posts

10 March 2010 at 7:54pm

Understandable, SS ecommerce has been 90% ready for a couple of years now. What did you run with?

Avatar
dbenton

Community Member, 22 Posts

11 March 2010 at 4:04am

We are going to use Avactis (standalone, not hosted). I didn't chose it, but it looks promising. I start on that tomorrow, so we'll see...