Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2008
    Posts
    3
    Plugin Contributions
    0

    Default Modify the Write Reviews to Only Show First Name and then there Country Name

    I have successfully modified the product_reviews_write (header_php.php) to have the first name on the posted review.

    However, I have been unable to figure out how to add there Country Name (e.g. John - United Kingdom)

    below is what i have done so far, if someone could lend a hand and help me out that would be greatly appreciated!

    Thank you so much

    Tina Marie

    PHP Code:
    $zco_notifier->notify('NOTIFY_HEADER_START_PRODUCT_REVIEWS_WRITE');

    if (!
    $_SESSION['customer_id']) {
      
    $_SESSION['navigation']->set_snapshot();
      
    zen_redirect(zen_href_link(FILENAME_LOGIN'''SSL'));
    }

    require(
    DIR_WS_MODULES zen_get_module_directory('require_languages.php'));

    $product_info_query "SELECT p.products_id, p.products_model, p.products_image,
                                  p.products_price, p.products_tax_class_id, pd.products_name
                           FROM " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd
                           WHERE p.products_id = :productsID
                           AND p.products_status = '1'
                           AND p.products_id = pd.products_id
                           AND pd.language_id = :languagesID"
    ;

    $product_info_query $db->bindVars($product_info_query':productsID'$_GET['products_id'], 'integer');
    $product_info_query $db->bindVars($product_info_query':languagesID'$_SESSION['languages_id'], 'integer');
    $product_info $db->Execute($product_info_query);

    if (!
    $product_info->RecordCount()) {
      
    zen_redirect(zen_href_link(FILENAME_PRODUCT_REVIEWSzen_get_all_get_params(array('action'))));
    }

    $customer_query "SELECT customers_firstname, customers_lastname, customers_email_address
                       FROM " 
    TABLE_CUSTOMERS "
                       WHERE customers_id = :customersID"
    ;


    $customer_query $db->bindVars($customer_query':customersID'$_SESSION['customer_id'], 'integer');
    $customer $db->Execute($customer_query);

    if (isset(
    $_GET['action']) && ($_GET['action'] == 'process')) {
      
    $rating zen_db_prepare_input($_POST['rating']);
      
    $review_text zen_db_prepare_input($_POST['review_text']);

      
    $error false;
      if (
    strlen($review_text) < REVIEW_TEXT_MIN_LENGTH) {
        
    $error true;

        
    $messageStack->add('review_text'JS_REVIEW_TEXT);
      }

      if ((
    $rating 1) || ($rating 5)) {
        
    $error true;

        
    $messageStack->add('review_text'JS_REVIEW_RATING);
      }

      if (
    $error == false) {
        if (
    REVIEWS_APPROVAL == '1') {
          
    $review_status '0';
        } else {
          
    $review_status '1';
        }

        
    $sql "INSERT INTO " TABLE_REVIEWS " (products_id, customers_id, customers_name, reviews_rating, date_added, status)
                VALUES (:productsID, :customersID, :customersName, :rating, now(), " 
    $review_status ")";


        
    $sql $db->bindVars($sql':productsID'$_GET['products_id'], 'integer');
        
    $sql $db->bindVars($sql':customersID'$_SESSION['customer_id'], 'integer');
        
    $sql $db->bindVars($sql':customersName'$customer->fields['customers_firstname'] . ' ' $customer->fields[''], 'string');
        
    $sql $db->bindVars($sql':rating'$rating'string');

        
    $db->Execute($sql); 

  2. #2
    Join Date
    Dec 2008
    Posts
    85
    Plugin Contributions
    0

    Default Re: Modify the Write Reviews to Only Show First Name and then there Country Name

    Hi Tina,

    I can't help you with the Country name (wish I could) but just wanted to say 'Thanks' for posting your 'First Name Only' re-write of the review code. It was just what I was looking for and was very easy. I hope that someone more knowledgeble will answer your request for help.

    Thanks again,
    Tony
    "What good is it for a man to gain the whole world, yet forfeit his soul?" Mark 8:36
    www.speedcreed.com ~ Christian Gifts, Art, and more ~

  3. #3
    Join Date
    Dec 2008
    Posts
    85
    Plugin Contributions
    0

    Default Re: Modify the Write Reviews to Only Show First Name and then there Country Name

    I did think of one additional thing that might be helpful: In order to make it clearer to customers that their last names will not appear on their review, the following file can be changed as follows: includes/languages/english/product_reviews_write.php

    Change from this:
    PHP Code:
    define('SUB_TITLE_FROM''Written by:'); 
    To this, or something similar:

    PHP Code:
    define('SUB_TITLE_FROM''Written by (Privacy Note: even though your full name is depicted below, only your first name will appear on your review): '); 
    "What good is it for a man to gain the whole world, yet forfeit his soul?" Mark 8:36
    www.speedcreed.com ~ Christian Gifts, Art, and more ~

  4. #4
    Join Date
    Jul 2004
    Location
    Australia
    Posts
    51
    Plugin Contributions
    0

    Default Re: Modify the Write Reviews to Only Show First Name and then there Country Name

    I don't need the country included but I had a request from a client to only show the first name for reviews. Thanks to both of you for this - I had a bit of trouble with the code posted at the top though. In the end I just found this line in /includes/modules/pages/product_reviews_write/header_php.php:

    Code:
       
     $sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'], 'string');
    and changed it to:

    Code:
        
    $sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' ' . $customer->fields[''], 'string');
    For the reviews already in the system with a last name, I went into phpMyAdmin and found the reviews area and edited each one to remove the last name. There were only 5 so it was an easy job, not sure if there is a better way if you have lots of reviews already.


    In includes/languages/english/product_reviews_write.php I did it slightly differently than above as I think it works better:

    Code:
     
    define('SUB_TITLE_FROM', 'Written by:');
    
    
    define('SUB_TITLE_REVIEW', '<strong>Privacy Note: Even though your full name is displayed above, only your first name will appear on your published review.</strong><br><br>Please tell us what you think of this product and share your opinions with others. Be sure to focus your comments on the product.<br><br>');
    Thanks

    Jen
    Jen

    Red Instead design. print. web. photography.

 

 

Similar Threads

  1. v151 Customers Name - Last Name, First Name
    By cjcraven in forum General Questions
    Replies: 8
    Last Post: 14 May 2014, 04:08 PM
  2. Product Reviews First Name Only
    By muah in forum General Questions
    Replies: 3
    Last Post: 5 Sep 2010, 02:27 AM
  3. switch the display of order of first name and last name on each address
    By weber in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 21 Nov 2008, 07:34 PM
  4. Replies: 3
    Last Post: 29 Jan 2008, 04:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg