klox7 VIP
Total posts: 914
02 Dec 2013 09:35

Hey, I would like to place comments and reviews in my records but I'm stuck. This is example of what I need.

How to achieve this? Must I create another section besides my main record section to handle comments? Can I submit comment directly on record page or am I redirected (to comment section)? What to select in Comments provider in Edit type?

Thanks for any help!

Last Modified: 07 May 2015


Sergey
Total posts: 13,748
26 Sep 2014 08:43

It is in adapter Cobalt type as comment.


klox7 VIP
Total posts: 914
26 Sep 2014 09:13

What will I have to modify to do this for "built in comments"? It' easier to use built in comments if I just need one reply:).

And for Cobalt types as comments - can I use markup template for comments in record so I can filter comments?


Sergey
Total posts: 13,748
29 Sep 2014 10:42

I am not sure you can do it in build in comments.


klox7 VIP
Total posts: 914
29 Sep 2014 11:26

Sergey I am not sure you can do it in build in comments.

I'm in stage where I can:
* show "built in comments" in list of "cobalt type as comments",
* show "reply" button that redirects to record (cobalt type as comments),
* post a reply.

I still can't:
* show "reply" button only for record author owner (object?),
* remove reply button if record owner already replied,
* limit reply only to 1.


Sergey
Total posts: 13,748
01 Oct 2014 02:29

klox7 I'm in stage where I can:

  • show "built in comments" in list of "cobalt type as comments",

  • show "reply" button that redirects to record (cobalt type as comments),

  • post a reply.

Confusing. What (cobalt type as comments) is doing here if it is core comemnts?

Simply switch to (cobalt type as comments) adapter.


pepperstreet VIP
Total posts: 3,837
01 Oct 2014 17:30

Sergey Confusing. What (cobalt type as comments) is doing here if it is core comemnts?

I think the setup and structure is as follows:

-> Record (Type 1)
--> Record (Type 2, Cobalt-type as Comment)
---> Reply (Core Comment for Type 2)

And ALL 3 levels are displayed on the list view.


Sergey
Total posts: 13,748
02 Oct 2014 01:49

Then why only author of Type 2 comments may comment it?


klox7 VIP
Total posts: 914
02 Oct 2014 07:32

Review system that I want to achieve goes like this:

Record (Type1, Section1, record owner) --Review (Type2, Section2 - subcat, registered user) ----Reply (Type 3, Section2 - subcat - subcat, record owner from step 1)

For reply I first used built in comments but I switched to Cobalt types as comments because of filtering.

Sergey Then why only author of Type 2 comments may comment it?

That's not right. I want reply (or comment) only to be added by main record owner. So if the structure is record - comment - reply, reply can only add record owner.

The only thing I need to do now is to:
- show reply button only for main record owner - show reply in comments list (under comment) when reply is added.


Sergey
Total posts: 13,748
03 Oct 2014 01:54

Ok. That is what you mean.

I think what you have to do only 2 levels. Allo author of level 1 moderate comments or type of level 2. Then in level 2 type, add field, called answer. And allow user to edit review and fill this field. And allow only author of original record to see that field.

In other words, you create custom form template for review. For reviewwer you show all fields except answer, for author of reviewed article you show only answer. ANd you also show button reply for him. And replay is symply article edit.


Sergey
Total posts: 13,748
06 Oct 2014 03:26

I understand what you need.

klox7 My question is:

Can I show "Add reply" for replies (2nd level comments) button only to "Client" that is main record author with someting like "if is user group and if is main record author and if reply is < 1"? :)

Yes you can. But you will have to hack core template or create override. You can hide new comment form if user is not author of 1 level record there. File views/record/tmpl/default_comemnts.php


klox7 VIP
Total posts: 914
07 Oct 2014 12:05

Sergey I think what you have to do only 2 levels. Allo author of level 1 moderate comments or type of level 2. Then in level 2 type, add field, called answer. And allow user to edit review and fill this field. And allow only author of original record to see that field.

In other words, you create custom form template for review. For reviewwer you show all fields except answer, for author of reviewed article you show only answer. ANd you also show button reply for him. And replay is symply article edit.

This is nice workaround but unfortunately I have configuration that prevents record author adding reviews.


Sergey
Total posts: 13,748
08 Oct 2014 03:11

Then I do not see any other choise but create override for defafult_comments.php file in record view and there add custom check to show or not comment add form.


klox7 VIP
Total posts: 914
08 Oct 2014 19:46

I'm still trying something :)

I'm trying to display in main record view under each comment reply from another type (record - comment - under each comment field value). This is what I have now for list view but it displays same result under every list item:

<?php 
    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $query->select('field_value');
    $query->from($db->quoteName('#__js_res_record_values'));
    $query->where('type_id = 21');
    $query->where("`field_key` = 'k85a6319f87fbcb519c02b1cff28d725f'");                    
    $db->setQuery($query);
    $review_reply = $db->loadObjectList();
    foreach($review_reply as $reply) { 
        echo '<div class="row-fluid review-reply pull-left">';
        echo "<h5>Owner's reply</h3>";
        echo $reply->field_value;
        echo '</div>';
    };
?>

If anybody knows why I would appreciate!

And I will probably display Reply link as link to full comment and then bellow it will be "Add reply" button. The only problem remains how to show this to main record author and to disable reply button if reply was already added.


<?php if(JFactory::getUser()->groups[10]): ?> <div> <a class="btn-primary btn-small pull-right" <?php echo $item->nofollow ? 'rel="nofollow"' : '';?> href="/<?php echo JRoute::_($item->url);?>"> <?php echo JText::_('C_REVIEW_REPLY_LINK'); ?> </a> <?php else: ?> <?php echo ''; ?> </div> <?php endif; ?>

Thanks


Sergey
Total posts: 13,748
09 Oct 2014 10:48

In what file is your loas code example?


klox7 VIP
Total posts: 914
09 Oct 2014 12:08

In list template for comments.

Hidden text


Sergey
Total posts: 13,748
10 Oct 2014 01:54

klox7 In list template for comments.

Cobalt article list template or article comments template?

I think first. If yea then

<?php
$parent = ItemsStore::getRecord($item->parent_id);
$user = JFactory::getUser();
if(in_array(10, $user->getAuthorisedGroups()) && $parent->user_id && $user->get('id') == $parent->user_id ):
?>
    Button here.
<?php endif; ?>

klox7 VIP
Total posts: 914
10 Oct 2014 10:15

For Cobalt article list template in record. And it works. Thanks.


klox7 VIP
Total posts: 914
25 Oct 2014 07:28

Can I use markup template for comments under record so I can filter comments?


Sergey
Total posts: 13,748
28 Oct 2014 02:34

klox7 Can I use markup template for comments under record so I can filter comments?

What is markup template for comments?


klox7 VIP
Total posts: 914
28 Oct 2014 08:21

Template for section menu. Where I can sort records in records list etc.

Powered by Cobalt