Open artelse opened 11 years ago
Hello! To solve this issue create two TVs with names: _votes_up_(example id = 5) & _votes_down_(example id = 6), then in plugin likeDislikePlugin change code lines (23-26)
$tvs = $modx->getObject('modTemplateVarResource',array('tmplvarid'=>$idtv, 'contentid'=>$idRes));
if($tvs) {
$tvs->set('value',$setObj);
$tvs->save();
on these lines
$tvUp = $modx->getObject('modTemplateVarResource',array('tmplvarid'=>5, 'contentid'=>$idRes));
$tvDown = $modx->getObject('modTemplateVarResource',array('tmplvarid'=>6, 'contentid'=>$idRes));
if($tvUp && $tvDown) {
$tvUp->set('value',$params['votes_up']);
$tvDown->set('value',$params['votes_down']);
$tvUp->save();
$tvDown->save();
Now make you snippet call LikeDislike with parameters:
&rating=`type=1,tv=votes_up`
and use with 'tmplvarid' your TV ID - for example: 'tmplvarid'=>5
Thanks for the response. I can't get it to work because the $tvUp and $tvDown are not initiated somehow. I do have the TVs assigned to my resource and referenced the right id #. Any idea?
Hi In the next version I will include tvUp and tvDown in the settings.Plug in for the event OnlikeDislikeSave can transfer any data for the vote.You can write on the level of IP MODX. Thank you Best regards, Valentin
Great, that makes sense as it enables to tie in ldl data much closer to one's own data set (resources with tv's). ETA? Thanks!
I would to be able to store plus and minus votes in different TV's in my resource. This enables me to rank resources based on these parameters. It would be great to send an array of output options. If it's an easy hack, would love to get a pointer on how to do that.