Ajax Content Comments

This article covers the methods provided for Content Comments by the Aurora Ajax Library.

Comments can be placed against any type of content (Page/Blog Post/etc), the only requirement is that the Content ID be provided when adding the comment.

Ajax Method Group: Ajax_Frontend_Content_Comments

add

Overview

Permission Required: None

Method Call: /ajax/Ajax_Frontend_Content_Comments/add

Aurora Demo Example: https://demo.auroracommerce.com/blog/2010/09/our-new-site-is-here

📘

This method allows you to submit new comments for any Content Page or Blog Post Content Items in Aurora.

Method Description

Method specific parameters

ParameterValuesDefaultDescriptionRequired
content_idPositive IntegerThe Internal ID Aurora uses to identify a Content Item (Blog Post/Content Page).Yes
nameStringFree-form text containing the customer's full name.Yes
email_addressString (email)The customer's email address.Yes
websiteString (URL)The URL provided with the comment.No
commentStringFree-form text containing the customer's comment.Yes

find

Overview

Permission Required: None

Method Call: /ajax/Ajax_Frontend_Content_Comments/find

📘

This method returns a recordset containing any matching Content Comments based on a range of conditions.

Method Description

Method specific parameters

ParameterValuesDefaultDescriptionRequired
content_idPositive IntegerThe Internal ID Aurora uses to identify a Content Item (Blog Post/Content Page).Yes
return_formatHTML or JSONHTMLThe format this method should return its data in.

When 'JSON' is selected, the return data is provided in the items return variable as a JSON array of record data.

When 'HTML' is selected, the return data is provided in the content return variable as a free-form string (merged from the template selected).
No
return_templateString'content/comments/list.tpl.html'The name of the template to be used when merging the response data for return as HTML.

This parameter is only used when the return_format is "HTML" and allows you to specify which template should be used to produce the return HTML.
No
pageNon-negative Integer1The number of the page of results you would like to have returned.

The number of items returned per page defaults to the value specified in the "Posts per page" setting located under Store > Settings > Blog, but can be overridden using the "items_per_page" parameter if desired.
No
items_per_pagePositive Integer20The number of content items to return per page.

This should be used to retrieve a particular number of items instead of any 'limit' variable. So if you require a list of 50 Content Items, then simply set this to 50 and do not provide a 'page' value (or do provide a 'page' value but set it to 1).
No
limitPositive Integer20The number of content items to return in this request.

The limit parameter has been made available for use alongside the start parameter only, but it is recommended that the built-in paging (items_per_page and page) combination be used instead, as this is far simpler in nature and provides better support for the automated paging values.
No
startPositive Integer1The number of the content item to start returning in this request.

e.g. If 3 is provided, then the 3rd item in the result set will be the first to be returned.

The start parameter has been made available for use alongside the limit parameter only, but it is recommended that the built-in paging (items_per_page and page) combination be used instead, as this is far simpler in nature and provides better support for the automated paging values.
No

Data Returned

The data returned by this method is delivered as a Json encoded array of values, as described below.

Method specific fields

VariableValuesDescription
itemsArray( content_comment )For more details regarding the fields available here, please see the content_comment variable in the "get: Data Returned" section of this article.

If the return_format is set the "HTML", this field will be empty.
contentStringThe merged template content produced as a result of the request data.

If the return_format is set the "JSON", this field will be empty.

Common fields

VariableValuesDescription
more_availableBooleanIf there are more Content Items to be returned after the current record set that were not return due to paging or some other limit, then this will be true. Otherwise it is false.

This is commonly used for deciding whether or not to show the "Next Page" link when listing Content Items.
total_itemsNon-negative IntegerThe total number of Content Items that matched the request made, regardless of any paging or limits in force.

This is commonly used for showing how many results there are matching a particular query/search when paging, e.g. "1-20 of 650" where 650 is the value returned within the total_items variable.
number_of_pagesNon-negative IntegerThe total number of pages of results based on the current settings used for the original request.

This is most useful when simply using the default value for items_per_page, so that your calling script(s) can generate their paging as needed, without the need to know the specifics about the limits in play.

get

Overview

Permission Required: None

Method Call: /ajax/Ajax_Frontend_Content_Comments/get

📘

This method returns a single Content Comment based on the Comment ID provided.

Method Description

Method specific parameters

ParameterValuesDefaultDescriptionRequired
comment_idPositive IntegerThe Internal ID Aurora uses to identify a Content Comment.Yes

Data Returned

The data returned by this method is delivered as a Json encoded array of values, as described below.

VariableValuesDescription
itemContainer( content_comment )A container holding all of the comment details.
content_comment.idPositive IntegerThe Internal ID Aurora uses to identify a Content Comment.
content_comment.content_idPositive IntegerThe Internal ID Aurora uses to identify a Content Item (Blog Post/Content Page).
content_comment.nameStringFree-form text containing the customer's full name.

Aurora does not enforce any validation on this to ensure it is a full name or just some abbreviation or even a nick-name, and so this field could contain anything provided by the customer.
content_comment.email_addressString (email)The customer's email address.
content_comment.websiteString (URL)The URL provided with the comment.
content_comment.commentStringFree-form text containing the customer's comment.
content_comment.

date_created_with_zone
String (ISO 8601 date)The date and time the comment was created by the customer.

Related Aurora Demo Example Files
example.com/blog/comments.tpl.html
example.com/_js/blog.js