Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.87 KB | None | 0 0
  1. <div class="form-add">
  2. <h2><?php echo $this->__('Write Your Own Review') ?></h2>
  3. <?php if ($this->getAllowWriteReviewFlag()): ?>
  4. <form action="<?php echo Mage::helper('em0113settings')->getActionReview()?>" method="post" id="review-form">
  5. <?php echo $this->getBlockHtml('formkey'); ?>
  6. <fieldset>
  7. <?php echo $this->getChildHtml('form_fields_before')?>
  8. <h3><?php echo $this->__("You're reviewing:"); ?> <span><?php echo $this->escapeHtml($this->getProductInfo()->getName()) ?></span></h3>
  9. <?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
  10. <h4><?php echo $this->__('How do you rate this product?') ?> <em class="required">*</em></h4>
  11. <span id="input-message-box"></span>
  12. <table class="data-table" id="product-review-table">
  13. <col />
  14. <col width="1" />
  15. <col width="1" />
  16. <col width="1" />
  17. <col width="1" />
  18. <col width="1" />
  19. <thead>
  20. <tr>
  21. <th>&nbsp;</th>
  22. <th><span class="nobr"><?php echo $this->__('1 star') ?></span></th>
  23. <th><span class="nobr"><?php echo $this->__('2 stars') ?></span></th>
  24. <th><span class="nobr"><?php echo $this->__('3 stars') ?></span></th>
  25. <th><span class="nobr"><?php echo $this->__('4 stars') ?></span></th>
  26. <th><span class="nobr"><?php echo $this->__('5 stars') ?></span></th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <?php foreach ($this->getRatings() as $_rating): ?>
  31. <tr>
  32. <th><?php echo $this->escapeHtml($_rating->getRatingCode()) ?></th>
  33. <?php foreach ($_rating->getOptions() as $_option): ?>
  34. <td class="value"><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" /></td>
  35. <?php endforeach; ?>
  36. </tr>
  37. <?php endforeach; ?>
  38. </tbody>
  39. </table>
  40. <input type="hidden" name="validate_rating" class="validate-rating" value="" />
  41. <script type="text/javascript">decorateTable('product-review-table')</script>
  42. <?php endif; ?>
  43. </fieldset>
  44. <div class="buttons-set">
  45. <button type="submit" title="<?php echo $this->__('Submit Review') ?>" class="button"><span><span><?php echo $this->__('Submit Review') ?></span></span></button>
  46. </div>
  47. </form>
  48. <script type="text/javascript">
  49. //<![CDATA[
  50. var reviewStars = new SrkaReviewStars('product-review-table');
  51. var dataForm = new VarienForm('review-form');
  52. Validation.addAllThese(
  53. [
  54. ['validate-rating', '<?php echo $this->__('Please select one of each of the ratings above') ?>', function(v) {
  55. var trs = $('product-review-table').select('tr');
  56. var inputs;
  57. var error = 1;
  58.  
  59. for( var j=0; j < trs.length; j++ ) {
  60. var tr = trs[j];
  61. if( j > 0 ) {
  62. inputs = tr.select('input');
  63.  
  64. for( i in inputs ) {
  65. if( inputs[i].checked == true ) {
  66. error = 0;
  67. }
  68. }
  69.  
  70. if( error == 1 ) {
  71. return false;
  72. } else {
  73. error = 1;
  74. }
  75. }
  76. }
  77. return true;
  78. }]
  79. ]
  80. );
  81. //]]>
  82. </script>
  83. <?php else: ?>
  84. <p class="review-nologged" id="review-form">
  85. <?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()) ?>
  86. </p>
  87. <?php endif ?>
  88. </div>
  89.  
  90. <div class="form-add">
  91. <h2><?php echo $this->__('Write Your Own Review') ?></h2>
  92. <?php if ($this->getAllowWriteReviewFlag()): ?>
  93. <form action="<?php echo Mage::helper('em0113settings')->getActionReview()?>" method="post" id="review-form">
  94. <fieldset class="rating">
  95. <?php echo $this->getChildHtml('form_fields_before')?>
  96. <h3><?php echo $this->__("You're reviewing:"); ?> <span><?php echo $this->escapeHtml($this->getProductInfo()->getName()) ?></span></h3>
  97. <?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
  98. <h4><?php echo $this->__('How do you rate this product?') ?> <em class="">*</em></h4>
  99. <span id="input-message-box"></span>
  100. <table class="data-table" id="product-review-table">
  101. <tbody>
  102. <input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
  103. <input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
  104. <input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
  105. <input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
  106. <input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
  107. <input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
  108. <input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
  109. <input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
  110. <input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
  111. <input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
  112. </tbody>
  113. </table>
  114. <input type="hidden" name="validate_rating" class="validate-rating" value="" />
  115. <script type="text/javascript">decorateTable('product-review-table')</script>
  116. <?php endif; ?>
  117. </fieldset>
  118. <div class="buttons-set">
  119. <button type="submit" title="<?php echo $this->__('Submit Review') ?>" class="button"><span><span><?php echo $this->__('Submit Review') ?></span></span></button>
  120. </div>
  121. </form>
  122. <script type="text/javascript">
  123. //<![CDATA[
  124. var dataForm = new VarienForm('review-form');
  125. Validation.addAllThese(
  126. [
  127. ['validate-rating', '<?php echo $this->__('Please select one of each of the ratings above') ?>', function(v) {
  128. var trs = $('product-review-table').select('tr');
  129. var inputs;
  130. var error = 1;
  131.  
  132. for( var j=0; j < trs.length; j++ ) {
  133. var tr = trs[j];
  134. if( j > 0 ) {
  135. inputs = tr.select('input');
  136.  
  137. for( i in inputs ) {
  138. if( inputs[i].checked == true ) {
  139. error = 0;
  140. }
  141. }
  142.  
  143. if( error == 1 ) {
  144. return false;
  145. } else {
  146. error = 1;
  147. }
  148. }
  149. }
  150. return true;
  151. }]
  152. ]
  153. );
  154. //]]>
  155. </script>
  156. <?php else: ?>
  157. <p class="review-nologged" id="review-form">
  158. <?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()) ?>
  159. </p>
  160. <?php endif ?>
  161.  
  162. if (!Zend_Validate::is($this->getTitle(), 'NotEmpty')) {
  163. $errors[] = Mage::helper('review')->__('Review summary can't be empty');
  164. }
  165.  
  166. if (!Zend_Validate::is($this->getNickname(), 'NotEmpty')) {
  167. $errors[] = Mage::helper('review')->__('Nickname can't be empty');
  168. }
  169.  
  170. if (!Zend_Validate::is($this->getDetail(), 'NotEmpty')) {
  171. $errors[] = Mage::helper('review')->__('Review can't be empty');
  172. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement