Linkable Product Reviews

EDIT: Just realised that the thread i posted to has instructions for v2.0.12, sorry :smiley:



Hi,



Does anyone know how to achieve Linkable Product Reviews in v2.0??



I had this in my old 1.3.4 store after following this mod for 1.3.4: [URL=“http://forum.cs-cart.com/showthread.php?t=10668&highlight=linkable+reviews”]http://forum.cs-cart.com/showthread.php?t=10668&highlight=linkable+reviews[/URL]



This is a missing feature in my mind, can anyone please help me achieve this?



Regards,

Aleks

Solution originaly posted by whiplash13 (John), Thanks :smiley:



This is working in version 2.0.10 - 2.0.13 and works for Product of the day and Category pages as well.



The code below was done for the electro skin so you may need to tweek it a bit for a different skin.



In //addons/discussion/controllers/customer/init.post.php

ADD the code below just above the ?>


function fn_get_review_count($object_id,$object_type)
{
global $db_tables;

$discussion = fn_get_discussion($object_id, $object_type);

if (empty($discussion)) {
return false;
}
return db_get_field("SELECT COUNT(b.post_id) as val FROM ?:discussion_rating as a LEFT JOIN ?:discussion_posts as b ON a.post_id = b.post_id WHERE a.thread_id = ?i and b.status = 'A'", $discussion['thread_id']);

}




NEXT in skins/electro/customer/common_templates/scripts.tpl



ADD


{if $smarty.request.show_reviews == "Y"} setTimeout("fn_show_reviews_tab();", 1000); {/if}




AFTER


jQuery.runCart('C');



NEXT in skins/electro/customer/addons/discussion/views/discussion/components/average_rating.tpl



ADD


{assign var="rev_count" value=$object_id|fn_get_review_count:$object_type}




BELOW


{assign var="average_rating" value=$object_id|fn_get_average_rating:$object_type}




THEN

ADD


```php {literal}


{/literal}



```



BELOW


{if $average_rating}



THEN

REPLACE


{include file="addons/discussion/views/discussion/components/stars.tpl" stars=$average_rating|fn_get_discussion_rating}




WITH



{include file="addons/discussion/views/discussion/components/stars.tpl" stars=$average_rating|fn_get_discussion_rating} {$average_rating|number_format:1}

{if $smarty.request.product_id}
Read reviews ({$rev_count})
{else}
Read reviews ({$rev_count})
{/if}







LASTLY

In skins/electro/customer/addons/discussion/views/discussion/components/stars.tpl

REMOVE the

and

tags as they were moved to average_ratings.tpl.