Thanks DrByte,
Your code worked great and I can now move on to complete other work on the site. I actually ended up setting the "review by" to first name and state.
I am very greatful to all the postees on the Zen Cart forum for all the long hours spent helping others. A great big, Thank You!, to all.
Below is the code I used for "reviews by", "first name, city, and state" and "first name and state only":
First Name, City, and State:
In: /includes/modules/pages/product_reviews_write/header_php
Add (around line 46): for first name, city and state
Code:
// customer entry query added
$customer_address_query = "SELECT entry_city, entry_zone_id, entry_country_id, entry_state FROM " . TABLE_ADDRESS_BOOK . " WHERE customers_id = :customersID LIMIT 1";
$customer_address_query = $db->bindVars($customer_address_query, ':customersID', $_SESSION['customer_id'], 'integer');
$result = $db->Execute($customer_address_query);
$customer_city = $result->fields['entry_city'];
$customer_state = zen_get_zone_name($result->fields['entry_country_id'], $result->fields['entry_zone_id'], $result->fields['entry_state']);
Replace this code (around line 86): for first name, city and state
Code:
$sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' ' . $customer->fields['customer_lastname'], 'string');
with:
Code:
$sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' from ' . $customer_city . ', ' . $customer_state, 'string');
In: /includes/templates/YOUR_TEMPLATE/templates/tpl_product_reviews_write_default.php
Replace this code (around line 41): for write review page text
Code:
<h3 id="reviewsWriteReviewer" class=""><?php echo SUB_TITLE_FROM, zen_output_string_protected($customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname']); ?></h3>
with:
Code:
<h3 id="reviewsWriteReviewer" class=""> <?php echo SUB_TITLE_FROM, zen_output_string_protected($customer->fields['customers_firstname'] . ' from ' . $customer_city . ', ' . $customer_state, 'string'); ?></h3>
First Name and State:
In: /includes/modules/pages/product_reviews_write/header_php
Add (around line 46): for first name and state
Code:
// customer entry query added
$customer_address_query = "SELECT entry_city, entry_zone_id, entry_country_id, entry_state FROM " . TABLE_ADDRESS_BOOK . " WHERE customers_id = :customersID LIMIT 1";
$customer_address_query = $db->bindVars($customer_address_query, ':customersID', $_SESSION['customer_id'], 'integer');
$result = $db->Execute($customer_address_query);
$customer_city = $result->fields['entry_city'];
$customer_state = zen_get_zone_name($result->fields['entry_country_id'], $result->fields['entry_zone_id'], $result->fields['entry_state']);
Replace this code (around line 86): for first name and state
Code:
$sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' ' . $customer->fields['customer_lastname'], 'string');
with:
Code:
$sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' from ' . $customer_state, 'string');
In: /includes/templates/YOUR_TEMPLATE/templates/tpl_product_reviews_write_default.php
Replace this code (around line 41): for write review page text
Code:
<h3 id="reviewsWriteReviewer" class=""><?php echo SUB_TITLE_FROM, zen_output_string_protected($customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname']); ?></h3>
with:
Code:
<h3 id="reviewsWriteReviewer" class=""> <?php echo SUB_TITLE_FROM, zen_output_string_protected($customer->fields['customers_firstname'] . ' from ' . $customer_state, 'string'); ?></h3>
I hope this didn't get too confusing!
Again, the first section is for restricting the "review by" to "First Name, City, and State".
The second section is for restricting the "review by" to "First Name and State".
Hope this helps others that want to do something similar.
All credit goes to DrByte and too many others on the forum to list!
Thank You All,
Ardoon