Payments are experiencing issues due to temporary restrictions in Russia. If your payment does not go through, please submit a support request.Our support team is available 24/7 — we are always here to help with hosting and server issues.We are now accepting requests for dedicated server rental and colocation services in our data center.Reminder: we recommend enabling backups for additional data protection.A new VPS/VDS lineup with NVMe storage and improved performance is now available.Maintenance work on some servers has been completed. All services are operating normally.

MODULE FOR 1C-BITRIX

YLab: Likes/Dislikes

YLab: Likes/Dislikes

The module implements a like/dislike functionality for any Bitrix entity. The content type ID is defined arbitrarily within the project scope. The solution is built on the PHP ORM class Ylab\Likes\YlabLikesTable. It defines the VoteDislike constant for dislikes and the VoteLike constant for likes.

Technical details

Published
08.11.2018
Version
0.0.1
Installed
500 - 999 times
Compatible editions
«First Site», Start, Standard, Small Business, Business
Responsiveness
No
Composite support
No
Compatible with Sites24
No
Developer
YLab: Likes/Dislikes

What this solution does

The module implements a like/dislike functionality for any Bitrix entity. The content type ID is defined arbitrarily within the project scope.

The solution is built on the PHP ORM class Ylab\Likes\YlabLikesTable. It defines the VoteDislike constant for dislikes and the VoteLike constant for likes.

Static methods are available for managing votes:

setLike($iContentId, $iContentType, $iUserId) — records a like from a specified user.

setDislike($iContentId, $iContentType, $iUserId) — records a dislike from a specified user.

In both methods, $iContentId and $iContentType identify the object and content type, while $iUserId specifies the user ID casting the vote.

The getContentStat($mContentId, $iContentType, $iUserLike = null) method returns vote statistics. The $mContentId parameter accepts a single ID or an array of IDs. The $iContentType parameter specifies the content type. The optional $iUserLike parameter allows retrieving the voting status of a specific user.

To integrate the interface in JavaScript, initialize the YlabLikesForm library using CJSCore::Init(['YlabLikesForm']).

The YLab: Likes/Dislikes module is a library for managing voting systems within the 1C-Bitrix environment. It enables recording content ratings on behalf of the current user and retrieving up-to-date statistics.

The BX.Ylab.Likes.setAjaxPath(AjaxPath) method configures the paths to event PHP handlers. The default configuration specifies the following routes: /bitrix/themes/ylab.likes/ajax/setLike.php for likes, /bitrix/themes/ylab.likes/ajax/setDislike.php for dislikes, and /bitrix/themes/ylab.likes/ajax/getContentStat.php for retrieving statistics.

The BX.Ylab.Likes.setLike(iContentId, iContentType, oCallback) method records a like vote for specified content. It accepts the content ID, content type ID, and a callback function that executes after the request is sent.

The BX.Ylab.Likes.setDislike(iContentId, iContentType, oCallback) method similarly records a dislike vote for the specified content, utilizing the same parameters: content ID, content type ID, and a callback function.

The BX.Ylab.Likes.getContentStat(iContentId, iContentType, oCallback) method requests data on the total number of votes for the content and the current user's voting status. The result is passed to the specified callback function.

The component is ready for use and includes all necessary functionality for displaying likes and dislikes. To integrate it, call the component by specifying the element ID and the content type ID. Caching parameters are set via CACHE_TYPE and CACHE_TIME.

If “YLab: Likes/Dislikes” is required, General iT can help with installation, configuration and a technical check after integration.

YOUR PROJECT INFRASTRUCTURE

A home for your website

BEFORE YOU ORDER

Let’s go through the details.

Is installation free?
The solution itself is free. Installation, configuration and customisation services are agreed separately. A compatible platform and an appropriate platform licence are required.
How do I check compatibility?
Compare the supported editions and solution version in the technical details with your project. Before installing on a live website, we recommend making a backup and checking the solution in a test environment.
Can you help with implementation?
We can help install the module, check its settings and verify how it works in your project. Compatibility with other customisations and the scope of work are assessed before we begin.

GENERAL iT

Let’s discuss your project

Получатель: ООО «Дженерал Ай Ти Рус»

1C-BITRIX

Install solution

Enter a domain with or without https://. The installer will open in your website control panel in a new tab.

Solution screenshots

Solution screenshot