View Single Post
  #1  
Old 03-17-2008, 12:57 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Add Customer Location and Date/Time Stamp to Customer Reviews

eg.
Author: Joe Bloggs
Location: London
Posted: 17-03-2008 23:28:56
Message: Blah blah blah

1) Apply this SQL patch...
Code:
ALTER TABLE `xcart_product_reviews` ADD `location` TEXT NOT NULL ; ALTER TABLE `xcart_product_reviews` ADD `add_date` INT( 11 ) DEFAULT '0' NOT NULL ; INSERT INTO xcart_languages SET code='US', name='lbl_review_your_location', value='Your location', topic='Labels'; INSERT INTO xcart_languages SET code='US', name='lbl_review_location', value='Location', topic='Labels'; INSERT INTO xcart_languages SET code='US', name='lbl_review_posted', value='Posted', topic='Labels';
2) In /vote.php

Replace...
Code:
db_query ("INSERT INTO $sql_tbl[product_reviews] (remote_ip, email, message, productid) VALUES ('$REMOTE_ADDR', '$review_author', '$review_message', '$productid')");
With...
Code:
db_query ("INSERT INTO $sql_tbl[product_reviews] (remote_ip, email, message, productid, location, add_date) VALUES ('$REMOTE_ADDR', '$review_author', '$review_message', '$productid', '$review_location', '".time()."')");
3a) /skin1/modules/Customer_Reviews/reviews.tpl

Replace...

Code:
<td colspan="2"><br /><b>{$lng.lbl_author}: {$r.email|default:$lng.lbl_unknown}</b><br />{$r.message|replace:"\n":"<br />"}<br /><br /></td>
With...
Code:
<td colspan="2"><br /><b>{$lng.lbl_author}:</b> {$r.email|default:$lng.lbl_unknown}<br /> {if $r.location ne ""}<b>{$lng.lbl_review_location}:</b> {$r.location}<br />{/if} {if $r.add_date ne 0}<b>{$lng.lbl_review_posted}:</b> {$r.add_date|date_format:$config.Appearance.datetime_format}<br />{/if} {$r.message|replace:"\n":"<br />"}<br /><br /></td>
3b) /skin1/modules/Customer_Reviews/reviews.tpl

Before...

Code:
<tr> <td class="FormButton">{$lng.lbl_your_message}:</td>
Insert...
Code:
<tr> <td width="20%" class="FormButton">{$lng.lbl_review_your_location}:</td> <td width="10" align="center">&nbsp;</td> <td width="80%"><input type="text" size="24" maxlength="100" name="review_location" id="review_location" {if $login ne ""}value="{$customer_info.b_city|escape}"{else}value="{$review.location|escape}"{/if} /></td> </tr>
3c) /skin1/modules/Customer_Reviews/reviews.tpl

Removal of this code is recommended, as it auto-populates the customer email address into the name field (if customer is logged in).
Code:
({$customer_info.email|escape})
__________________
xcartmods.co.uk
Reply With Quote