Forums / General Questions / Allow customers to leave review without logging in or being an existing customer

Allow customers to leave review without logging in or being an existing customer

Started by travbacon on 17 Jun 2015, 2:47 AM · Views: 1,337

Results 1 to 7 of 7
17 Jun 2015, 2:47 AM
#1
travbacon avatar

travbacon

Zen Follower

Join Date:
Mar 2015
Posts:
169
Plugin Contributions:
0

Allow customers to leave review without logging in or being an existing customer

How can we allow people to leave product reviews withour logging in or being annactual customer. Of course to fight spam, the approval setting would be on. Thank you.

17 Jun 2015, 4:21 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Allow customers to leave review without logging in or being an existing customer

travbacon:

How can we allow people to leave product reviews withour logging in or being annactual customer. Of course to fight spam, the approval setting would be on. Thank you.

If you insist:

Load the file
/includes/modules/pages/product_reviews_write/header.php into a text editor

Find this code:

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

Comment it out, like so:

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

Save the file.

Don't blame me if this comes back to bite you. With this code commented out, anyone can post anything. The zencart code should sanitize any 'dangerous' inputs, thus offering some degree of protection, and I suspect your biggest problem is going to be due to hackers and scammers hammering the server looking for a weakness that they can exploit.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

17 Jun 2015, 5:28 AM
#3
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Allow customers to leave review without logging in or being an existing customer

RodG:

If you insist:

Load the file
/includes/modules/pages/product_reviews_write/header.php into a text editor

Find this code:

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

> 
> Comment it out, like so: 
> ```
// if (!$_SESSION['customer_id']) {
//  $_SESSION['navigation']->set_snapshot();
// zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
// }

Save the file.

Don't blame me if this comes back to bite you. With this code commented out, anyone can post anything. The zencart code should sanitize any 'dangerous' inputs, thus offering some degree of protection, and I suspect your biggest problem is going to be due to hackers and scammers hammering the server looking for a weakness that they can exploit.

Cheers
RodG

I'v seen this done where the merchant sends out an email 2 weeks after the order to get a review and then they are directed to place a review. The customer email is in the return URL, and then ZenCart looks up the customer number and the saves it in the $_SESSION['customer_id'] variable.

You would need to make sure your coding is SUPER SUPER sound, and can't be injected with this type of thing.

I'm not sure on the PCI implications of this...

17 Jun 2015, 12:35 PM
#4
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Allow customers to leave review without logging in or being an existing customer

Just wondering, Why would someone want to come to your site and leave a review of something they didnt purchase?

Zen cart PCI compliant Hosting

17 Jun 2015, 1:20 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,137
Plugin Contributions:
56

Re: Allow customers to leave review without logging in or being an existing customer

Merlinpa1969:

Just wondering, Why would someone want to come to your site and leave a review of something they didnt purchase?
Perhaps because they used either COWOA (check out without an account) or PayPal Express Checkout to place the order? In either case, the customer will have made a purchase but won't have a "proper" account as required to create a review.

16 Aug 2021, 8:30 AM
#6
rlexyd avatar

rlexyd

Zen Follower

Join Date:
Nov 2006
Location:
Sydney, Australia
Posts:
495
Plugin Contributions:
0

Re: Allow customers to leave review without logging in or being an existing customer

I followed the suggestion in this thread and I am now getting an Error Log every time someone goes the a product_review_write page, even if they don't write a review!!

[16-Aug-2021 16:55:19 Australia/Sydney] Request URI: /index.php?main_page=product_reviews_write&cPath=1&products_id=20, IP address: 60.
#1  require(/includes/modules/pages/product_reviews_write/header_php.php) called at [/index.php:35]
[B]--> PHP Notice: Undefined index: customer_id in /includes/modules/pages/product_reviews_write/header_php.php on line 40.[/B]

[16-Aug-2021 16:55:20 Australia/Sydney] Request URI: /index.php?main_page=product_reviews_write&cPath=1&products_id=20, IP address: 60.
#1  require(/includes/templates/responsive_classic/templates/tpl_product_reviews_write_default.php) called at [/includes/templates/responsive_classic/common/tpl_main_page.php:178]
#2  require(/includes/templates/responsive_classic/common/tpl_main_page.php) called at [/index.php:94]
[B]--> PHP Notice: Undefined index: customers_firstname in /includes/templates/responsive_classic/templates/tpl_product_reviews_write_default.php on line 43.[/B]

[16-Aug-2021 16:55:20 Australia/Sydney] Request URI: /index.php?main_page=product_reviews_write&cPath=1&products_id=20, IP address: 60.
#1  require(/includes/templates/responsive_classic/templates/tpl_product_reviews_write_default.php) called at [/includes/templates/responsive_classic/common/tpl_main_page.php:178]
#2  require(/includes/templates/responsive_classic/common/tpl_main_page.php) called at [/index.php:94]
[B]--> PHP Notice: Undefined index: customers_lastname in /includes/templates/responsive_classic/templates/tpl_product_reviews_write_default.php on line 43.[/B]

I know it's because I commented out the above so guest can write a review, but is there a way to stop that error log from being generated?!

Thanking you in advance.

*Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

16 Aug 2021, 6:32 PM
#7
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,899
Plugin Contributions:
22

Re: Allow customers to leave review without logging in or being an existing customer

Doing six year old code changes is hardly ever a good idea.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com