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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Need help with price field


Go to End


4 Posts   967 Views

Avatar
Webdoc

Community Member, 349 Posts

26 September 2010 at 5:12am

I have added price in my dataobject. but i need to add function: if price bigger than 50000 then it shows other link than normally.
Can someone help me with that. The price is textfield not currency.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

26 September 2010 at 5:19am

public function BigPrice() {
return $this->Price > 50000;
}

---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

Avatar
Webdoc

Community Member, 349 Posts

26 September 2010 at 5:21am

Edited: 26/09/2010 5:22am

And then the link in theme i use:

<% if BigPrice %>
show content over 50000
<% else %>
less than 50000
<% end_if %>

true of false

Avatar
UncleCheese

Forum Moderator, 4102 Posts

26 September 2010 at 6:02am

Yup!

---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com