A customer would like the Evaluation of its products to customers more comfortable and asked us to do that in the future the fields
“Summary of Your Review”
and
“Review”
optional and not mandatory are more. It is therefore sufficient, when Stars be awarded and who wants nothing to write, this should also no longer have to.
To allow this, will form.phtml im Ordner app / design / frontend /[base or default]/[IhrTemplate]/template / review opened and there about. from line 76 adapted the code. For Summary We accept the following part:
<label for="summary_field" class ="required"><in>*</in><?php echo $this->__('Summary of Your Review') ?></label> <div class ="input-box"> <input type="text" name ="title" id="summary_field" class ="input-text required-entry" value="<?php echo $this->htmlEscape($data->getTitle()) ?>" /> </div>
Hieraus entfernen wir alle required Vermerke, so that finally the following Code remains:
<label for="summary_field" ><?php echo $this->__('Summary of Your Review') ?></label> <div class ="input-box"> <input type="text" name ="title" id="summary_field" class ="input-text" value="<?php echo $this->htmlEscape($data->getTitle()) ?>" /> </div>
The same we do for the actual Review of as. from line 82, so dass hier noch folgendes übrig bleibt:
<label for="review_field" ><?php echo $this->__('Review') ?></label> <div class ="input-box"> <textarea name="detail" id="review_field" cols ="5" rows="3" ><?php echo $this->htmlEscape($data->getDetail()) ?></textarea> </div>
With this change, then the Frontend adjusted. Der Kunde sieht also keine * Required asterisk more. Jedoch möchte Magento immernoch Einträge haben, Therefore, we also change the Review.php in the folder code / core / Mage / Review / model which we copy the file to the best in the folder code / local / Mage / Review / Model, so as not to fall directly into the core.
Here are the relevant points about. from line 114 to find. For Summary this is
if (!Zend_Validate::is($this->getTitle(), 'NotEmpty')) { $errors[] = $ Helper->__('Review summary can\'t be empty'); }
and the opinion itself
if (!Zend_Validate::is($this->getDetail(), 'NotEmpty')) { $errors[] = $ Helper->__('Review can\'t be empty'); }
These areas either delete or comment out.
So this area looks like
public function validate() { $errors = array(); $helper = Mage::helper('customer'); /*if (!Zend_Validate::is($this->getTitle(), 'NotEmpty')) { $errors[] = $ Helper->__('Review summary can\'t be empty'); } */ if (!Zend_Validate::is($this->getNickname(), 'NotEmpty')) { $errors[] = $ Helper->__('Nickname can\'t be empty'); } /*if (!Zend_Validate::is($this->getDetail(), 'NotEmpty')) { $errors[] = $ Helper->__('Review can\'t be empty'); } */ if (empty($errors)) { return true; } return $ errors; }
Now, the two fields not compulsory more. In order to show this more clearly, can also “(optional)” Write behind the headlines.
This again in the form.phtml
and the line
<label for="summary_field" ><?php echo $this->__('Summary of Your Review') ?></label>
in
<label for="summary_field" ><?php echo $this->__('Summary of Your Review (Opt.)') ?></label>
change.
the same for “Review” a few lines below. Now, however, it would be just that there are German front, since there is no translation. Therefore best to own translate.csv Open in your own template directory and the line
"Summary of Your Review (Opt.)","Summary of Your Review (optional)" "Review (Opt.)","Your opinion (optional)"
insert. Then upload all, evtl. Clear the cache and voila now it fits.
Used in Magento Version 1.6.2.0. Comments, Suggestions, Ask? Gladly!
version 1.8.0 it still says Nickname can’t be empty
This article is only on review summary and review not on the nickname. But I assume you’ve commented out the part for the nickname as well?