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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Extending the Order class


Go to End


2 Posts   1543 Views

Avatar
Dorsai

Community Member, 12 Posts

12 March 2015 at 9:26am

Edited: 12/03/2015 9:50am

Hi,

I have the following extension

class GST extends Extension {

	private static $casting = array(
		'GST' => 'Currency'
	);

	public function GST(){
		parent::__construct();
		$config = SiteConfig::current_site_config();
		$base_charge = $this->owner->Total;
		return $base_charge * ($config->GST/100);
	}

}

with the following in the app.yml
Order:
  extensions:
    - GST

The function works as desired, however it is generating a
[Notice] Trying to get property of non-object

Which while not a major problem outside of a dev environment, I am wondering how to stop it coming up. I get the feeling I am missing something very basic here.

Avatar
wmk

Community Member, 87 Posts

15 March 2015 at 3:47am

If you setup error logging you might see what line of your code throws the Notice.