Magento产品评论表未提交

时间:2016-02-02 19:09:20

标签: php magento

我的产品评论表单未提交 - 几个月前用过。出于某种原因,它只是进入主页。我花了好几个小时试图解决问题并且无法解决问题。任何帮助将不胜感激。

由于

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="form-add">
<h2 style="float: left;"><?php echo $this->__('Write Your Own Review') ?></h2>
<span style="float: right; margin-top: 7px; color: #d40101">All fields are required</span>
<hr class="product-normal-border">
<?php if ($this->getAllowWriteReviewFlag()): ?>
    <script type="text/javascript">
        //<![CDATA[
        var RecaptchaOptions = {
            theme : '<?php echo $this->getCaptchaTheme(); ?>',
            lang : '<?php echo $this->getCaptchaLang(); ?>',
        };
        //]]>
    </script>
<form action="<?php echo $this->getAction() ?>" method="post" id="review-form">
    <?php echo $this->getBlockHtml('formkey'); ?>
    <fieldset>
        <?php echo $this->getChildHtml('form_fields_before')?>
        <h3><?php echo $this->__("You're reviewing:"); ?> <span style="font-weight: bold; color: #013675"><?php echo $this->escapeHtml($this->getProductInfo()->getName()) ?></span></h3>
        <?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
            <h4 style="font-weight: bold;"><?php echo $this->__('How do you rate this product?') ?> <em style="color: red;" class="required">*</em></h4>
            <span class="rating-stars" id="rating-stars">
                <?php foreach ($this->getRatings() as $_rating): ?>
<!--                            --><?php //echo $this->escapeHtml($_rating->getRatingCode()) ?>
                        <span class="star-rating">
                    <?php foreach ($_rating->getOptions() as $_option): ?>
                        <input type="radio" name="ratings[<?php echo     $_rating->getId() ?>]"id="<?php echo $this->escapeHtml($_rating->getRatingCode()) ?>_<?php echo $_option->getValue() ?>" value="<?php echo     $_option->getId() ?>" class="radio" ><i></i>
                    <?php endforeach; ?>
                      </span>
                <?php endforeach; ?>
            </span><br /><br />
            <input type="hidden" name="validate_rating" class="validate-rating" value="" />
            <script type="text/javascript">decorateTable('product-review-table')</script>
        <?php endif; ?>
            <ul class="form-list">
                <li>
                    <label for="nickname_field" class="required"><em>*</em>    <?php echo $this->__('Nickname') ?></label>
                    <div class="input-box">
                        <input type="text" name="nickname" id="nickname_field" class="input-text required-entry" value="<?php echo $this->escapeHtml($data->getNickname()) ?>" />
                    </div>
                </li>
                <li>
                    <label for="summary_field" class="required"><em>*</em><?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->escapeHtml($data->getTitle()) ?>" />
                    </div>
                </li>
                <li>
                    <label for="review_field" class="required"><em>*</em><?php echo $this->__('Review') ?></label>
                    <div class="input-box">
                        <textarea name="detail" id="review_field" cols="5" rows="3" class="required-entry"><?php echo $this->escapeHtml($data->getDetail()) ?></textarea>
                    </div>
                </li>
                <li class="wide" style="height: 120px; padding-top: 10px;">
                    <style type="text/css">
                        .recaptcha_input_area {
                            height: 34px !important;
                        }
                        .recaptcha_theme_red #recaptcha_response_field {
                            height: 20px !important;
                        }
                    </style>
                    <div class="input-box">
                        <?php echo $this->getCaptchaCode(); ?>
                    </div>
                </li>
            </ul>
        </fieldset>
        <div class="buttons-set">
            <button type="submit" title="<?php echo $this->__('Submit Review') ?>" class="button"><span><span></span></span></button>
        </div>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('review-form');
    Validation.addAllThese(
    [
           ['validate-rating', '<?php echo $this->__('Please select one of each of the ratings above') ?>', function(v) {
                var trs = $('rating-stars').select('span');
                var inputs;
                var error = 1;

                for( var j=0; j < trs.length; j++ ) {
                    var tr = trs[j];
                    if( j >= 0 ) {
                        inputs = tr.select('input');
                        for( i in inputs ) {
                            if( inputs[i].checked == true ) {
                                error = 0;
                            }
                        }

                        if( error == 1 ) {
                            return false;
                        } else {
                            error = 1;
                        }
                    }
                }
                return true;
            }]
    ]
    );
//]]>
</script>
<?php else: ?>
<p class="review-nologged" id="review-form">
    <?php echo $this->__('Only registered users can write reviews. Please, <a href="%s">log in</a> or <a href="%s">register</a>', $this->getLoginLink(), Mage::helper('customer')->getRegisterUrl()) ?>
</p>
<?php endif ?>
</div>

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。 我用set csrf保护修复它添加密钥到网址“否” 系统配置 - 高级系统