3061 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 204 Views |
-
Listing 2 DataObjectSets

11 February 2012 at 7:52pm
Howdy, I have created 2 DataObjects Rewards and Redemptions. I would like to display them on a single list sorted by their created field.
Here is the code doing the work;
function getRewardRedemptions() {
$doSet = new DataObjectSet();if($Rewards = DataObject::get('Rewards',"MemberID={$this->Member->ID}")) {
$doSet->merge($Rewards);
}
if($this->Member && $Redemptions = DataObject::get('Redemptions',"MemberID={$this->Member->ID}")) {
$doSet->merge($Redemptions);
}
$doSet->Sort('Created');
return $doSet;
}It all works a-ok with one small hick up the list is grouping the Objects. So all the rewards and the redemptions are sitting together. What I would like to happen is the rewards and redemptions to be intertwinned.
I'm pretty certain there is one little tweak I need to make so it all falls into place.
Any help would be greatly appreciated.
-
Re: Listing 2 DataObjectSets

12 February 2012 at 1:06am
What you are doing should work - at least within your getRewardRedemptions function itself. Did you do a var_dump there, or a foreach echo?
What does your template look like? (the bit that handles getRewardRedemptions)?
-
Re: Listing 2 DataObjectSets

12 February 2012 at 11:51pm
Thanks Martimiz, It turns out the problem was mine. Although the redemption has a created field there was also a sent date. So it was working correctly.
I did a var_dump I could see that the Created field was way back when. Once I started using the correct date field all was sweet.
Thanks again.
| 204 Views | ||
|
Page:
1
|
Go to Top |

