VirtueMart Dev/Coding Central: VM1 (old version) > Feature requests
Allow review only if customer has purchased the product.
mautabar:
You have to edit this file \administrator\components\com_virtuemart\html\shop.product_details.php
Modify following code (line no 358)
/* LIST ALL REVIEWS **/
if (PSHOP_ALLOW_REVIEWS == '1') {
/*** Show all reviews available ***/
$product_reviews = ps_reviews::product_reviews( $product_id );
/*** Show a form for writing a review ***/
if( $auth['user_id'] > 0 ) {
$product_reviewform = ps_reviews::reviewform( $product_id );
}
to
/* LIST ALL REVIEWS **/
if (PSHOP_ALLOW_REVIEWS == '1') {
/*** Show all reviews available ***/
$product_reviews = ps_reviews::product_reviews( $product_id );
/*** Show a form for writing a review ***/
//akbar ali
$db =& JFactory::getDBO();
$query = "
SELECT ".$db->nameQuote('oui.user_id')."
FROM ".$db->nameQuote('#__vm_order_user_info')." oui
join ".$db->nameQuote('#__vm_order_item')." oi
WHERE ".$db->nameQuote('oi.order_status')." = 'C'
and ".$db->nameQuote('oi.product_id')." = ".$db->quote($product_id)."
and ".$db->nameQuote('oui.user_id')." = ".$db->quote($auth['user_id'])."";
$db->setQuery($query);
$result = $db->loadResult();
//ali akbar
if( $auth['user_id'] > 0 && $result> 0) {
$product_reviewform = ps_reviews::reviewform( $product_id );
}
mautabar:
This will allow customer to add review only after the order is confirmed
Navigation
[0] Message Index
[*] Previous page
Go to full version