jComments integration
I think this is a quickly thing?! :) Would be nice!
I already made this for my own, if i can help you, let me know :wink:
@webnut-de Great! Would love to see that. Please upload your code to another repo and link here. We are now focusing on Stable release and not working on any new features.
@codexpert I tried it, but github is new territory for me, and i dont have that much time. So i try to explain it here. Its pretty easy:
This block need to be added in the top of the product.php:
$comments = JPATH_SITE . DS .'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($comments)) {
require_once($comments);
$count = JComments::getCommentsCount($this->item->id, 'com_digicom');
}
And this block where you want to show the comments:
$comments = JPATH_SITE . DS .'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($comments)) {
require_once($comments);
echo JComments::showComments($this->item->id, 'com_digicom', $this->item->name);
}
The last thing is to write the plugin for jcomments. This file is named: com_digicom_plugin.php and need to be dropped in: /components/com_jcomments/plugins
<?php
/**
* JComments plugin for DigiCom support (http://digicom.themexpert.com/)
*
* @version 2.3
* @package JComments
* @author Sergey M. Litvinov ([email protected])
* @copyright (C) 2006-2013 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die;
class jc_com_digicom extends JCommentsPlugin
{
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$db = JFactory::getDBO();
$query = 'SELECT id, name, created_by '
. ' FROM #__digicom_products'
. ' WHERE id = '.$id
;
$db->setQuery($query);
$row = $db->loadObject();
if (!empty($row)) {
$Itemid = self::getItemid('com_digicom');
$Itemid = $Itemid > 0 ? '&Itemid='.$Itemid : '';
$info->title = $row->name;
$info->access = 0;
$info->userid = $row->created_by;
$info->link = JRoute::_('index.php?option=com_digicom&view=product&id=' . $row->id . $Itemid);
}
return $info;
}
}
That's all. Would be nice to habe an option in backend to switch it on/off.
Its also easy to show the number of comments etc. Just copy and paste this codeblocks and customize it. http://www.joomlatune.com/jcomments-developers-manual.html#jcomments_get_comments_count
@webnut-de thanks for this useful guide the event we have plan to create https://github.com/themexpert/digicom/issues/205
do you know whats its main porpose? to load this type of third part plugins ex: jcomment the code you need to load at top of product page and bottom of product page and some you need to load after title to show count... all can be loaded through a plugin by hooking these events :) so we will be able to play with any third party plugins :100:
after we release stable w'll look forward to these options