Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default new review question

    I think this pos of mine is solved, for now cause you never know with this store...LOL

    https://www.zen-cart.com/showthread....hlight=reviews

    But I was wondering. The reviewupdated mod is being used in conjuction with dgReiews old mod. I get the guests being able to write a review and their not needing to use last name but just first name with last initial.

    Would like to get this verion of cart to do the same thing with the logged in customer.

    This is the code I was told to do with 1.3.9h store but it does not work in this version because of the ConCat part so could someone please tell me what the code should be.

    To make reviews with first name and last name initial you need to do this to the files listed:

    In the file /includes/modules/pages/product_reviews_write/header_php.php -
    Find:

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

    To use a customers full first name and last initial,
    replace:


    $customer_query = "SELECT customers_firstname, CONCAT(LEFT(customers_lastname,0),'.') AS customers_lastname, customers_email_address
    FROM " . TABLE_CUSTOMERS . "
    WHERE customers_id = :customersID";


    I noticed that if I go to the product_reviews_write/header_php.php and remove the text in red that it lets only the first name show but would really like the initial too PLUS not sure if this will affect other stuff in the coding so I put the text back.

    if (!$_SESSION['customer_id']) {
    $customer = '';
    } else {
    $customer_query = "SELECT customers_firstname, customers_lastname, customers_email_address
    FROM " . TABLE_CUSTOMERS . "
    WHERE customers_id = :customersID";

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: new review question

    Quote Originally Posted by DarkAngel View Post
    I think this pos of mine is solved, for now cause you never know with this store...LOL

    https://www.zen-cart.com/showthread....hlight=reviews

    But I was wondering. The reviewupdated mod is being used in conjuction with dgReiews old mod. I get the guests being able to write a review and their not needing to use last name but just first name with last initial.

    Would like to get this verion of cart to do the same thing with the logged in customer.

    This is the code I was told to do with 1.3.9h store but it does not work in this version because of the ConCat part so could someone please tell me what the code should be.





    I noticed that if I go to the product_reviews_write/header_php.php and remove the text in red that it lets only the first name show but would really like the initial too PLUS not sure if this will affect other stuff in the coding so I put the text back.

    if (!$_SESSION['customer_id']) {
    $customer = '';
    } else {
    $customer_query = "SELECT customers_firstname, customers_lastname, customers_email_address
    FROM " . TABLE_CUSTOMERS . "
    WHERE customers_id = :customersID";
    Ummm,
    Code:
    $customer_query = "SELECT customers_firstname, CONCAT(LEFT(customers_lastname,0),'.') AS customers_lastname, customers_email_address
                       FROM " . TABLE_CUSTOMERS . "
                       WHERE customers_id = :customersID";
    Says to use zero characters of the left side of customers_lastname and concat that with a period... Which that all may actually be null, which doesn't sound like a favorable return value..

    Try:
    Code:
    $customer_query = "SELECT customers_firstname, CONCAT(LEFT(customers_lastname,1),'.') AS customers_lastname, customers_email_address
                       FROM " . TABLE_CUSTOMERS . "
                       WHERE customers_id = :customersID";
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: new review question

    copy-pasted what you wrote and replace the text in the /includes/modules/pages/product_reviews_write/header_php.php

    and now I get this when I click to writa a review: WARNING: An Error occurred, please refresh the page and try again.

    the log says:

    [17-Jul-2015 19:10:34 America/Chicago] PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*CONCAT(LEFT(customers_lastname,1),'.'*) AS customers_lastname, customers_email_' at line 1 :: SELECT customers_firstname, *CONCAT(LEFT(customers_lastname,1),'.'*) AS customers_lastname, customers_email_address
    FROM customers
    WHERE customers_id = 97 ==> (as called by) path/includes/modules/pages/product_reviews_write/header_php.php on line 51 <== in path/includes/classes/db/mysql/query_factory.php on line 155

  4. #4
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: new review question

    Wonder if you could humor me a moment and replace AS customers_lastname with something else? Like lastname? And see if still get the error?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: new review question

    Quote Originally Posted by mc12345678 View Post
    Wonder if you could humor me a moment and replace AS customers_lastname with something else? Like lastname? And see if still get the error?

    I luvs ya to pieces....it worked and no error, got sent to the page to write the review with the box showing where to write the name in.

    Thank you so much! I wrote a review, clicked to send it, got the alert stating it was pending review and then did happy dance.

  6. #6
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: new review question

    I forgot to ask, I am wondering about this filter issue that occurs in 1.3.9h and 1.5.4

    https://www.zen-cart.com/showthread....ters-by-prices

    there is an image there and if you want a looksee my store is http://fantasiesrealm.com/market I think it is in the all products section

    and the other link is http://www.designerperfumesnob.com that is the 1.5.4 I am helping with

    I never noticed it prior to her asking about it

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: new review question

    Cool! So as you probably know the uses of customers_lastname that follow that query need to be rewritten to use the new assignment. I am wondering though if you used back single quotes (top left of a "standard" pc keyboard) around the customers_lastname field like this:

    Code:
    `customers_lastname`
    instead single quotes like:
    Code:
    'customers_lastname'
    If the first example would let you use/reuse the field.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: new review question

    I can try and will be right back but no I did not have to do anything the first time with older code.

    brb

  9. #9
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: new review question

    I am back used this code of yoursand inserted the backwards `:


    $customer_query = "SELECT customers_firstname, CONCAT(LEFT(customers_lastname,1),'.') AS `customers_lastname`, customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id = :customersID";



    No error
    Guest sees the box to enter name/initial of last
    loggin customer now sees their own first name with initial in the box
    everything works like it should.

    thank you ever so.


    um before I forget....do those other edits still need to be done you spoke about? if so how, I am still learning.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: new review question

    Quote Originally Posted by DarkAngel View Post
    I am back used this code of yoursand inserted the backwards `:


    $customer_query = "SELECT customers_firstname, CONCAT(LEFT(customers_lastname,1),'.') AS `customers_lastname`, customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id = :customersID";



    No error
    Guest sees the box to enter name/initial of last
    loggin customer now sees their own first name with initial in the box
    everything works like it should.

    thank you ever so.


    um before I forget....do those other edits still need to be done you spoke about? if so how, I am still learning.
    So there is a post above that I have yet to really look at, but seeing as the above edit worked, no further editing is necessary to support the last name initial part... It would kind of be a pain anyways, and on your next upgrade there would be a lot that would have to be carried over... So no need to change uses of customers_lastname anywhere else. I do have to say that the above fix came from a sparked memory of Dr.Byte helping someone else somewhere else in the forum... Just remembered reading it somewhere and thought it might get things through...
    Okay, back to take a look at that other "question"/issue.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Site review and a question :)
    By respawnedelectronics in forum General Questions
    Replies: 3
    Last Post: 1 Apr 2012, 01:11 AM
  2. v139h Write a review page layout question
    By nolsowski in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 27 Jan 2012, 04:01 AM
  3. Product Review Question
    By kenny724 in forum General Questions
    Replies: 1
    Last Post: 5 Feb 2011, 04:02 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR