1735 Posts in 449 Topics by 392 members
E-Commerce Module
SilverStripe Forums » E-Commerce Module » Order Modifiers buggy?
Discuss the E-Commerce Module.
Moderators: martimiz, Nicolaas, Howard, Sean, Ryan M., biapar, Willr, Ingo, Jedateach, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 966 Views |
-
Order Modifiers buggy?

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 -
Re: Order Modifiers buggy?

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.
-
Re: Order Modifiers buggy?

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?
-
Re: Order Modifiers buggy?

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
to LiveAmount() and it was echoed three times on the checkout page, but the total was not updated.echo "Modify!";
Stumped,
David -
Re: Order Modifiers buggy?

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
-
Re: Order Modifiers buggy?

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 -
Re: Order Modifiers buggy?

10 March 2010 at 7:54pm
Understandable, SS ecommerce has been 90% ready for a couple of years now. What did you run with?
-
Re: Order Modifiers buggy?

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...
| 966 Views | ||
|
Page:
1
|
Go to Top |

