Success message when Vote

  • Posts: 84
  • Thank you received: 11
  • Hikashop Business
1 year 3 months ago #292254

-- HikaShop version -- : 3.4
-- Joomla version -- : 3.8.7

I've tried to add a simple success message to the onclick event for sending a review and rating in but when the success message is added, the comment function ceases functioning. Can someone help me add a "Message Received" alert or <p> element to the vote/form file?

Here is my existing code that "should" work but doesn't:

<input class="button btn" type="button" value="<?php echo JText::_('HIKASHOP_SEND_COMMENT'); ?>" onclick="hikashop_send_comment(); success();"/> 
<script>
  function success() {
    alert("You're review has been received and will soon be approved by a moderator. Thank you!");
}
</script>

Please Log in or Create an account to join the conversation.

  • Posts: 12085
  • Thank you received: 1666
  • MODERATOR
1 year 3 months ago #292301

Hello,

I just tested your modification and it worked fine on my end so you're probably having a JavaScript error on your website which prevent your JavaScript code to be triggered.

Best regards,
Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 11
  • Hikashop Business
1 year 3 months ago #292306

Arg... I'm using a pretty native version of Hikashop, hardly modified at all. I checked console and only found an error about importing a Google Font. Would using a tabular view make a difference? Here's the page (the code is not in place since it breaks sending the comment) if that helps for a diagnosis: www.gorillamind.com/products/gorilla-mind-rush - under Leave a Review tab.

Please Log in or Create an account to join the conversation.

  • Posts: 66586
  • Thank you received: 9792
  • MODERATOR
1 year 3 months ago #292315

Hi,

We would need to see the page with the issue to be able to say more.

Right now, without the code modified and with the form only available if you already purchased the product, we can't see anything.
If you can't do it on your live website, then try making a copy of the website so that we can look at the issue on the copy.

Also, I would recommend something simpler like:

<input class="button btn" type="button" value="<?php echo JText::_('HIKASHOP_SEND_COMMENT'); ?>" onclick="hikashop_send_comment(); alert('You\'re review has been received and will soon be approved by a moderator. Thank you!');"/>
Because with your code, if another extension has a javascript function named success, it will break the extension.
That's why everything you see in the code of HikaShop is prefixed with hikashop so that there is no conflict with something else.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 11
  • Hikashop Business
1 year 3 months ago #292395

Arg. I tried that but it still doesn't send the comment. Alert displays just fine but its like it won't allow the comment to send some how. I'm at a loss.

Please Log in or Create an account to join the conversation.

  • Posts: 12085
  • Thank you received: 1666
  • MODERATOR
1 year 3 months ago #292396

Hello,

What do you exactly mean by :

Alert displays just fine but its like it won't allow the comment to send some how. I'm at a loss.


Can you give us more information about it through some screenshots for example ?

Also can you give us a link where we can reproduce and test the issue you are having ?

Thank you.

Last edit: 1 year 3 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 11
  • Hikashop Business
1 year 3 months ago #292521

Well weird update - it's working now. I have no idea why. I tried your code - nothing. Then I turned the comment function option to Vote and Comment - it WAS Vote and Comment Connected. Tried your code - it worked. Then I turned comment function back to Vote and Comment Connected. Still worked. Whatever. I also cleaned up the function a little to display a div instead of a dialog.
Here's the new code if anyone else wants to replicate:

<input class="button btn" type="button" value="<?php echo JText::_('HIKASHOP_SEND_COMMENT'); ?>" onclick="hikashop_send_comment(); hikacommentsuccess();"/>
  <div id="hikacommentsuccess" style="display:none">Your review has been received and will soon be approved by a moderator. Thank you!</div>
<script>
function hikacommentsuccess() {
    var x = document.getElementById("hikacommentsuccess");
    if (x.style.display === "block") {
        x.style.display = "none";
    } else {
        x.style.display = "block";
    }
}
</script>

The following user(s) said Thank You: nicolas, oloccina

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 11
  • Hikashop Business
1 year 2 months ago #292973

We now have another challenge. We need this message to display ONLY IF the user has added a star rating and display the <div id='hikashop_vote_status_form' class="hikashop_vote_notification" ></div> if the user HAS NOT added a star rating.

Can you help us add the necessary code?

Please Log in or Create an account to join the conversation.

  • Posts: 23610
  • Thank you received: 3666
  • MODERATOR
1 year 2 months ago #292974

Hello,

Please do not duplicate your posts.
www.hikashop.com/forum/install-update/89...er-hasn-t-rated.html

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 11
  • Hikashop Business
1 year 2 months ago #293034

Read the other post. This issue is a separate issue. This thread is about showing a message to the user that they must ALSO provide a rating to post their comment. The other thread is about showing blank stars if the user hasn't added a rating.

Please Log in or Create an account to join the conversation.

  • Posts: 12085
  • Thank you received: 1666
  • MODERATOR
1 year 2 months ago #293080

Hello,

The solution for that customization will probably be to directly customize the "Mini" file of the "Vote" view of your front-end template but also the "vote.js" file.

Best regards,
Mohamed Thelji.

Please Log in or Create an account to join the conversation.

Time to create page: 0.077 seconds
Powered by Kunena Forum