Jump to content


Photo
- - - - -

Can i display specific fields for an item based on value of another field


Best Answer Kess , 20 December 2013 - 07:23

First go to the item type editing screen and copy the id of an element which you want to use as a condition:

 

g3b_200x0.png

 

Then in the full.php you can do the following:

$osvalue = $item->getElement('487a4095-5e4f-4156-892e-ad77a6174d73')->getElementData()->get('option');
if (in_array("windows", $osvalue)) {
    echo "It's here";
}
else {
    echo "It's not here";
}

Of course, instead of echo you should put there something more useful. Like an output of a position from your item type, for example. Same as in the previous examples.

Go to the full post


  • This topic is locked This topic is locked
3 replies to this topic

#1 tkdas

tkdas
  • JBZoo User
  • User rate: 0
  • posts: 28
  • topics: 12

Posted 17 December 2013 - 11:12

I do business listings. 

Let us say it has few fields like: 

listing level (basic, premium, super premium)

 

Based on the listing level I want to render another specific value. 

Is that possible. 

 

Other wise can this be done on Author Level? 

As in how can i cofigure to render  itmes in full view based on the ACL level of the Item Author (the business which has listed)


  • 0

#2 Kess

Kess
  • JBZoo User (rus)
  • User rate: 11.9
  • posts: 406
  • topics: 40

Posted 17 December 2013 - 12:05

You can easily add conditions based on the user groups. There is even an article in the FAQ section about this. But if this is not enough, I think it shouldn't be hard to also make conditions based on the value of a specific element.


  • 0

#3 tkdas

tkdas
  • Topic Starter
  • JBZoo User
  • User rate: 0
  • posts: 28
  • topics: 12

Posted 19 December 2013 - 00:37

Thanks. I have looked at the article you had linked. 

COuld you please guide me with the code snippet on how can I make the display (in full layout) of certain fields dependent on the value of another field in Zoo/JBZoo? What parameter stores the value of any zoo field?


  • 0

#4 Kess

Kess
  • JBZoo User (rus)
  • User rate: 11.9
  • posts: 406
  • topics: 40

Posted 20 December 2013 - 07:23   Best Answer

First go to the item type editing screen and copy the id of an element which you want to use as a condition:

 

g3b_200x0.png

 

Then in the full.php you can do the following:

$osvalue = $item->getElement('487a4095-5e4f-4156-892e-ad77a6174d73')->getElementData()->get('option');
if (in_array("windows", $osvalue)) {
    echo "It's here";
}
else {
    echo "It's not here";
}

Of course, instead of echo you should put there something more useful. Like an output of a position from your item type, for example. Same as in the previous examples.


  • 0




Click to return to top of page in style!