Integrating comments, ratings and social bookmarking with Virtuemart

This tutorial is provided in good faith based on the copy of Virtuemart available at the time of writing.  Changes can made by the original author and are beyond our control rendering the following advice out of date.  In addition the following code may not work reliably due to the way Virtuemart does things (that we don't expect).  Use at your own risk.

To integrate JXtended Comments with Virtuemart, you need to make adjustments to a core file (as best we can determine).  Please not that if you upgrade Virtuemart, you will loose an modifications that you have done.  Unfortunately Virtuemart does not support Joomla's layout override system.

Find the  the following file:

/administrator/components/com_virtuemart/html/shop.product_details.php

Add the following code to the end of the file:

<?php
// For JXtended Comments.
JHtml::addIncludePath(JPATH_SITE.'/components/com_comments/helpers/html');

// Attach the comments stylesheet.
JHTML::stylesheet('comments.css', 'components/com_comments/media/css/');

$menus      = &JSite::getMenu();
$menu       = $menus->getActive();
$context    = 'virtuemart';
$url        = 'index.php?option=com_virtuemart&page=shop.product_details&product_id='.$product_id;
$route      = $url.'&Itemid='.$menu->id;

// Display the social bookmarks.
echo JHtml::_('comments.share', $route, $product_name);

// Display the ratings.
echo JHtml::_('comments.rating', $context, $product_id, $url, $route, $product_name);

// Display the social bookmarks.
echo JHtml::_('comments.comments', $context, $product_id, $url, $route, $product_name);

// End JXtended Comments.

This will allow the comments, ratings and social-bookmarks to be displayed on the product detail page.