Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Mod: Display number of reviews

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 11-02-2003, 07:33 PM
  BoomBoomBap's Avatar 
BoomBoomBap BoomBoomBap is offline
 

Senior Member
  
Join Date: Nov 2002
Location: San Francisco
Posts: 184
 

Default Mod: Display number of reviews

I was looking to find a way to display the number of reviews and reached this post: http://forum.x-cart.com/viewtopic.php?t=2292 - which shows how to display the number of votes

Taking off from this idea I made the following mod:

In customer/vote.php add the following code:

Code:
################### //display total reviews $reviews_result = func_query_first ("SELECT COUNT(remote_ip) as total FROM $sql_tbl[product_reviews] WHERE productid='$productid'"); if ($reviews_result["total"] == 0) $smarty->assign ("reviews_result", $reviews_result); $smarty->assign ("reviews_total", $reviews_result["total"]); ###################

and then in skin1/customer/Modules/Customer_Reviews/reviews.tpl add the following code where you want to display the number:

Code:
{$reviews_total}


Personally I placed it here:
Code:
{$reviews_total} {$lng.lbl_customer_reviews}

This shows something like "11 Customer Reviews"

Neat !


Next I'd like to limit the number of reviews shown to 5 and then "click here to display all"
__________________
Site 1 > XCART LIVE 3.4.12

Site 2 > XCART LIVE 4.0.17
Reply With Quote
  #2  
Old 11-02-2003, 08:32 PM
  BoomBoomBap's Avatar 
BoomBoomBap BoomBoomBap is offline
 

Senior Member
  
Join Date: Nov 2002
Location: San Francisco
Posts: 184
 

Default

Okay, I've figured out how to limit the number of reviews displayed and then have a link to show all.

In customer/vote.php find this:

Code:
$reviews = func_query ("SELECT * FROM $sql_tbl[product_reviews] WHERE productid='$productid'");

replace with this:

Code:
//for showing all reviews if ($show_all_reviews == yes) { $reviews = func_query ("SELECT * FROM $sql_tbl[product_reviews] WHERE productid='$productid'"); } else { $reviews = func_query ("SELECT * FROM $sql_tbl[product_reviews] WHERE productid='$productid' LIMIT 5"); } // change the LIMIT number to display less or more reviews // end

Then, in skin1/modules/Customer_Reviews/vote.tpl add this:


If you have NOT used the mod listed in the first post then remove
Code:
({$reviews_total} total)
and this part of the mod should still work.
__________________
Site 1 > XCART LIVE 3.4.12

Site 2 > XCART LIVE 4.0.17
Reply With Quote
  #3  
Old 11-02-2003, 09:48 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Great mod
__________________
ex x-cart guru
Reply With Quote
  #4  
Old 01-04-2005, 06:23 PM
 
ghhoz ghhoz is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 40
 

Default

Thanks for sharing this mod - fits what i was looking for perfectly.
__________________
Cheers from Melanie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xcart V4.0.4 (Unix) - LIVE
AOM, Fancy Categories
Marketing Manager,
Reward Points & Refer Rewards
Advanced Site Map
Easy Checkout

Gift & Homeware House
www.giftandhomewarehouse.com.au
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:35 AM.

   

 
X-Cart forums © 2001-2020