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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Need help with price field


Reply

4 Posts   643 Views

Avatar
Webdoc

26 September 2010 at 5:12am Community Member, 332 Posts

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

26 September 2010 at 5:19am 4085 Posts

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

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

Avatar
Webdoc

26 September 2010 at 5:21am (Last edited: 26 September 2010 5:22am), Community Member, 332 Posts

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

26 September 2010 at 6:02am 4085 Posts

Yup!

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