Dynamic Item Page Individual Comments

I’m using Comments Plus+ in one of my dynamic item pages, and it works fine. However, it doesn’t make a new comment “app” for every page. And I need this, as I want to have comments for each page itself. Does anybody know how to make this work or any alternatives?

PS. If you are going suggest seeing the “Reviews” example, please do not as there is no way to copy that to my site, unless you know how. Thank you.

2 Likes

I’m not sure about Comments Plus+ app compatibility with dynamic pages, but there are other comments apps that should work seamlessly with dynamic pages: Facebook Comments, Disqus Comments (found under “Blog” section in the editor Add Panel) or Comments app (found in the app market).

I tried the Comments app too and that didn’t work either. I haven’t tried Disqus though.

The Disqus application looks like it has been removed and you can not add it unless you already have it, you can make a copy of it or move it to the desired location, but adding a “new” one is not possible.

URGENT!!! , did anyone finds a solution for that, i am facing the same problem and it is driving me nuts… i have almost finished the website, the only problem i am having is connecting a separate comment box for every item on my dynamic page.
It should be a common sense that the comment box have an option to be related to the same page of the item.
Is there a way to sort out this issue?!!! please help

Same Problem, pls Help

once i received your message i thought i got the answer for it :), i have seen many people asking for the same thing… usually wix team are always responsive and helpful. until you reach this topic no one give you a solution.

I have the same problem. I want to have users be able to leave #messages on each #dynamic item page. My website requires #member #login for each item page, so I was thinking maybe this could possibly be done by creating a separate #collection for messages that collects the user’s name and message for display on the page and linking it somehow to a key #field on the main collection for the item pages? Maybe use a #reference collection? If this is not the way, then please suggest something else (I’m willing to try anything!). In any case, could you please be specific as to how a solution, including a #reference collection if that’s worth trying, would be implemented, including code if necessary? Thank you.

i still didn’t figure it out, apparently it is doable using wixcode, you need to have good knowledge of javascript.

wix team please let us know if this potion will be available in the coming three month or not, i would rather have a proper app on the page than creating one from scratch.

Just use a repeater connect it to your comment database and filter the dataset for items only related to that particular dynamic page.

When you are passing a comment to the database, pass the dynamic page ID also. That way you can filter the comments repeater for items that relate only to that particular dynamic page.

You could do all of the above without any java script if you wanted to.

@mikemoynihan99 thank you for your reply, building a basic comment box is for sure an easy task, however adding functionalities like( reply, like, moderate comments) is the part that makes it hard.
is there any plans that wix will release an app that works with dynamic pages ?

@Mike Moynihan Thank you very much for your reply. I will give it a try and keep my fingers crossed. (I’m new at this, as you can probably tell.)

@mikemoynihan99 I added the form + a name instead of the dynamic page ID, since I don’t know where to find that and since each dynamic item page uses a unique name. Then I tried using the code in the WIX video “How to Collect and Display User-Generated Content on your Website” (very fuzzy but tried my best to read it). Following is the code I used and the error message I got. Am I getting any closer or do I just not have a clue? Clearly, I don’t know JavaScript.

This is the code I used:
import wixData from ‘wix-data’;
function getData(){
let query = wixData.query(‘Messages’);

	return query.limit(1000).find().then(results = { 
		console.log('getData'. results); 
		return results.items; 
	}); 
} 

$w.onReady( () = {

$w( () = { 

	$w("#messageswrite").onAfterSave( () = { 
		getData().then((items) = { 
			$w("#messageslist").data = items; 
		}); 
	}); 
}); 

This is the error message I got:
public/pages/t8i7z.js: Unexpected token, expected , (12:10)
10 |
11 | return query.limit(1000).find().then(results = {

12 | console.log(‘getData’. results);
| ^
13 | return results.items;
14 | });
15 | }
Loading the code for the InMemoryOf (DeceasedName) page. To debug this code,
open t8i7z.js in Developer Tools.

@barbwra72099
it is saying you have an error in your code on line 12. You best doing this in 2 steps:

1st. submit comments to your database including a reference to the original post ID

2nd. filter the dataset on your dynamic page for comments that relate to that original post ID

this is a typical example of how you would pass a comment to your database when on your dynamic page.

import wixUsers from “wix-users”;

$w.onReady( function () {

//place a submit comment button on the page and call it commentButton1

$w('#commentButton1').onClick( **function**  () { 

//dataset1 is connected to your collection where you store the original post

let orininalPostId = $item(“#dataset1”).getCurrentItem()._id;

//dataset2 is connected to your collection where you store the comments, make sure you have set read/write access to dataset2

    $w("#dataset2").onReady(() => { 

let user = wixUsers.currentUser;

//get userEmail so that it can be passed to the comments database that way we know who made the comment

        user.getEmail() 

            .then((email) => { 

let currentUserEmail = email;

//create columns in your comments database and name them orininalPostId, comment, userEmail. Place an comment input box on the page and call it commentInputBox1

//now we save the comment to the database

                $w('#dataset2').setFieldValue('orininalPostId', (orininalPostId)); 
                $w('#dataset2').setFieldValue('comment', $w('#commentInputBox1').value); 
                $w('#dataset2').setFieldValue('userEmail', (currentUserEmail)); 
                $w('#dataset2').save() 

            }) 
    }) 
}) 

})

@mikemoynihan99 Thank you for both answers - working on it.

@mikemoynihan99 Your instructions were very clear; however, it still took me much trial and error to troubleshoot lines in the code (my bad for naming things wrong) and get my collections properly set up. Anyway, I fixed all the flagged lines in the code except line 11 ($item). When I submit a comment, only the comment gets submitted, not my email or the original post ID, and the successful submit message is displayed.

I have checked and rechecked many times the two collections I’m using and I’m sure I have all the fields I need, except that I cannot change the name or anything else of the original post ID field, so it doesn’t say originalPostId, but the field name is ID and the key says _id.

Also, I found an extra dataset labeled #dynamicDataset on the dynamic page in question. Maybe I put it on awhile ago and forgot about it (I didn’t see it because it is on a part of the page that wasn’t showing on my screen). I tried to delete it but cannot, and I cannot disconnect it. It is connected to one of the collections I’m using, but the dataset name is not mentioned in the code. Could that be what is messing up $item in your code?

So I have three questions:

  1. Why can I not get $item to pick up the original post ID?
  2. What should I do about that extra dataset?
  3. When I click SUBMIT MESSAGE my comments are submitted, but my email and the original post ID are not. I do not get any error message except that line 11 is flagged and $item is underlined in red.

Can you help with these questions? I do think I’m getting somewhere because I was able to eliminate a lot of flagged problems. Thank you so much for all your time and effort on this.

@barbwra72099
add these console log lines of code into the relevant part of the code and check what values it returns to the developer console:

let orininalPostId = $item(" #dataset1 ").getCurrentItem()._id;
console.log(orininalPostId);

let currentUserEmail = email;
console.log(currentUserEmail );

@mikemoynihan99
The Developer Console said "ReferenceError: $item is not defined

It did not say anything about the email. Neither got submitted to the collection - only the comment.