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   681 Views

Avatar
Webdoc

Community Member, 333 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, 4096 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, 333 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, 4096 Posts

26 September 2010 at 6:02am

Yup!

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