On the product page, I want to create a button on the product page which will trigger review form to appear. Currently, I am having just form on the page. And submit button of this form. So where to change it?

EDIT till now I have disappeared the form from the page using this in custom.less file.

form#review-form {
    display: none;

So now I want to create a button and give it a javascript like onClick to display block

  • Is this in a tab or just a standard div? would you have a link so an example can be provided – Dava Gordon Sep 14 '17 at 15:59
  • Firstly it was in a tab now I separated. its occurring after add to cart div. @DavaGordon – Learner Sep 14 '17 at 16:09
  • I seperated it using <move element="reviews.tab" destination="main.content" after="-"/> @DavaGordon – Learner Sep 14 '17 at 16:10
  • do you want same functionality like on this website smartparcelbox.com/… – Manoj Deswal Sep 15 '17 at 4:09

If you want to do a simple toggle of the reviews for the review just do somethink like

<a class="review-link">Write Review</a>
jQuery('.review-link').on('click', function() {

Depending on your version of jquery It could be $ or if you have defined another variable via noConflict()

Sorry but best I can do from my phone

  • Do you have any idea where I have to put this code ? – Learner Sep 14 '17 at 19:26
  • to edit the form its in your theme directory under review/form.phtml this link can be added to catalog/product/view.phtml <a class="review-link"><?php echo $this->__('Add Your Review') ?></a> Without viewing the site i could not be more specific sorry – Dava Gordon Sep 14 '17 at 21:33
  • hi I got solved by doing something like this require(['jquery'],function($){ jQuery('#review_id').on('click', function() { if(!jQuery('form#review-form').is(':visible')) { alert('inshowphase'); jQuery('form#review-form').show(); } else{ alert('hidedone'); jQuery('form#review-form').hide(); } – Learner Sep 20 '17 at 12:41
  • and file was product/view/details.phtml – Learner Sep 20 '17 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.