Zen Cart Logo
Forums / Addon Templates / Write Reviews errors not going to the right page

Write Reviews errors not going to the right page

Locked

Views: 1,831

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
17 Oct 2009, 12:25 PM
#1
lat9 avatar

lat9

Administrator

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

Write Reviews errors not going to the right page

Running 1.38a + security + FEC:

If javascript is disabled, so the error-checking falls within the server's realm, none of the input errors are displayed for the "Write a Review" page. The culprit appears to be \includes\modules\pages\product_reviews_write\header.php, starting at line 56:

  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);
  }

Which should be:

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

    $messageStack->add('product_reviews_write', JS_REVIEW_TEXT);
  }

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

    $messageStack->add('product_reviews_write', JS_REVIEW_RATING);
  }
18 Oct 2009, 10:16 AM
#2
lat9 avatar

lat9

Administrator

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

Re: Write Reviews errors not going to the right page

... and then \includes\templates\template_default\tpl_product_reviews_write_default needs to add the following line to actually display the messages:

<?php if ($messageStack->size('product_reviews_write') > 0) echo $messageStack->output('product_reviews_write'); ?>
<div class="centerColumn" id="reviewsWrite">
19 Oct 2009, 6:29 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Write Reviews errors not going to the right page

Actually, leaving the key as 'review_text' will work just fine on a clean default install, since the output for that key is already in the tpl_product_reviews_write_default.php file, on line 44:```

<?php if ($messageStack->size('review_text') > 0) echo $messageStack->output('review_text'); ?>

So, it would appear that the "bug" is in your own template somewhere, and not in the default core code of v1.3.8a.
20 Oct 2009, 11:12 AM
#4
lat9 avatar

lat9

Administrator

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

Re: Write Reviews errors not going to the right page

:oops: You are (as always) correct; it was my mess-up.