Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » How to call action from dataobject

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1791 Views
  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: How to call action from dataobject Link to this post

    do i need to use those fields what i wanna show in that like picture and price. but anyways this code dont show in web also the categorie names aint visible in that page.

    do i use it like this then:
    <% control Categories %>
    $CategoryName
    <% control Bikes %>
    <div class="pilt">
    <table width="220" border="0" cellspacing="0" cellpadding="0" style="height:170; vertical-align:top; text-align:center;">
    <tr>
    <td height="19"><div style="text-align:center;"><strong><a href="$link" title="$Mootorrattanimi">$Mootorrattanimi</a><strong></div></td>
    </tr>
    <tr>
    <td height="150" valign="top"><div style="text-align:center;"><a href="$link" title="$Mootorrattanimi">$Photo.Setheight(143)</a></div></td>
    </tr>
    </table>
    </div>
    <% end_control %>
    <% end_control %>

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: How to call action from dataobject Link to this post

    Something is wrong with the function because everything else shows up the fields and stuff. Only when the fields are inside categories controller they dont show up so something is wrong with the controller code with categories.
    Also categorie names dont show up

  • UncleCheese
    Avatar
    4085 Posts

    Re: How to call action from dataobject Link to this post

    Your Categories() function doesn't return anything!!

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

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: How to call action from dataobject Link to this post

    its shows categories in backend but not in frontend

    nothing , nada, ничего.

    if <% control Bikes %> is before categories its shows the bike info but not category if its after categories its doesnt show anything. thats why i thing the function is broken.

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: How to call action from dataobject Link to this post

    i use also the show in dataobject maybe there is some function needed also in dataobject.

  • UncleCheese
    Avatar
    4085 Posts

    Re: How to call action from dataobject Link to this post

    Like I said, your Categories() function doesn't return anything. That's the problem.

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

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: How to call action from dataobject Link to this post

    made it from your example.

    Can u figure out what can be wrong

  • UncleCheese
    Avatar
    4085 Posts

    Re: How to call action from dataobject Link to this post

    This function:

    public function Categories() {
    $ret = new DataObjectSet();
    foreach(singleton('Bike')->dbObject('BikeCategory')->enumValues() as $cat) {
    $ret->push(new ArrayData(array(
    'CategoryName' => $cat,
    'Bikes' => DataObject::get("Bike","BikeCategory = '$cat'")
    )));
    }
    }

    has no return..

    you need to add:

    return $ret;

    1791 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.