Skip to content

Commit

Permalink
[-] MO productcomments :
Browse files Browse the repository at this point in the history
- Module was broken and works now
- A message is displayed to indicate when a comment has been added.
- Error li are correctly indented

#PNM-753
#PNM-1601
#PNM-1660
#PNM-1609
#PNM-1491
#PNM-1311
#PNM-1233
#PNM-1232
#PNM-937
#PNM-775
  • Loading branch information
fchellypresta committed Sep 6, 2013
1 parent 1b0c5be commit 9377775
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions js/tools.js
Expand Up @@ -322,6 +322,7 @@ function fancyChooseBox(question, title, buttons, otherParams)
for (var caption in buttons) {
if (!buttons.hasOwnProperty(caption)) continue;
funcName = buttons[caption];
if (typeof otherParams == 'undefined') otherParams = 0;
otherParams = escape(JSON.stringify(otherParams));
action = funcName ? "$.fancybox.close();window['" + funcName + "'](JSON.parse(unescape('" + otherParams + "')), " + i + ")" : "$.fancybox.close()";
msg += '<input class="button" style="margin-right: 5px" type="button" value="' + caption + '" onclick="' + action + '" />';
Expand Down
12 changes: 9 additions & 3 deletions modules/productcomments/js/productcomments.js
Expand Up @@ -56,19 +56,21 @@ $(function() {
e.preventDefault();

// Form element

url_options = parseInt(productcomments_url_rewrite) ? '?' : '&';
$.ajax({
url: productcomments_controller_url + url_options + 'action=add_comment&secure_key=' + secure_key + '&rand=' + new Date().getTime(),
data: $('#fancybox-content form').serialize(),
data: $('#id_new_comment_form').serialize(),
type: 'POST',
headers: { "cache-control": "no-cache" },
dataType: "json",
success: function(data){
if (data.result)
{
$.fancybox.close();
document.location.href = document.location.href;
var buttons = {};
buttons[productcomment_ok] = "productcommentRefreshPage";
fancyChooseBox(productcomment_added, productcomment_title, buttons);
}
else
{
Expand All @@ -83,3 +85,7 @@ $(function() {
return false;
});
});

function productcommentRefreshPage() {
window.location.reload();
}
6 changes: 3 additions & 3 deletions modules/productcomments/productcomments.tpl
Expand Up @@ -89,7 +89,7 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
<!-- Fancybox -->
<div style="display: none;">
<div id="new_comment_form">
<form action="#">
<form id="id_new_comment_form" action="#">
<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
<div class="product clearfix">
<img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
Expand All @@ -102,7 +102,7 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
<div class="new_comment_form_content">
<h2>{l s='Write your review' mod='productcomments'}</h2>

<div id="new_comment_form_error" class="error" style="display: none;">
<div id="new_comment_form_error" class="error" style="display: none; padding: 15px 25px">
<ul></ul>
</div>

Expand Down Expand Up @@ -136,7 +136,7 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
{/if}

<div id="new_comment_form_footer">
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}'></input>
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
<p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p>
<p class="fr">
<button id="submitNewMessage" name="submitMessage" type="submit">{l s='Send' mod='productcomments'}</button>&nbsp;
Expand Down
5 changes: 4 additions & 1 deletion themes/default/modules/productcomments/productcomments.tpl
Expand Up @@ -27,6 +27,9 @@ var productcomments_controller_url = '{$productcomments_controller_url}';
var confirm_report_message = "{l s='Are you sure you want report this comment?' mod='productcomments'}";
var secure_key = "{$secure_key}";
var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
var productcomment_added = '{l s='Your comment has been added !' mod='productcomments'}';
var productcomment_title = '{l s='New comment' mod='productcomments'}';
var productcomment_ok = '{l s='OK' mod='productcomments'}';
</script>

<div id="idTab5">
Expand Down Expand Up @@ -89,7 +92,7 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
<!-- Fancybox -->
<div style="display: none;">
<div id="new_comment_form">
<form action="#">
<form id="id_new_comment_form" action="#">
<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
<div class="product clearfix">
<img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
Expand Down

11 comments on commit 9377775

@dmytropaduchak
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tanks...

@hdfrr
Copy link

@hdfrr hdfrr commented on 9377775 Sep 24, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help

@satustore
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not work for me my site http://satustore.com

@sant009m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done the above changes to all file mentioned. It works only in Firefox and does not work with Internet Explorer and Chrome. Please check

@hdfrr
Copy link

@hdfrr hdfrr commented on 9377775 Oct 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my shop works perfectly in all browsers, try to update the browser cache.

PrestaShop™ 1.5.5.0

@sant009m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I m too using 1.5.5.0, Checked on different PC's but same problem
you can too check http://gadgetsduniya.abcz8.com/presta/
Create an account this is a test site

@hdfrr
Copy link

@hdfrr hdfrr commented on 9377775 Oct 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to change the settings, is set to: you can make comments after you enter the customer account, login

Is working fine!

@sant009m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow guest comments is already deactivated, only logged in customers are allowed to comment. But not working in Internet Explorer and Chrome. Firefox it works without any problem.

@hdfrr
Copy link

@hdfrr hdfrr commented on 9377775 Oct 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sant009m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I saw it, thanks. But I am not able to comment from my Laptop. Cleared browser cache. Created new customer and tried, but same problem. Let me check from another Laptop from where I have never accessed this website. I will update.

@essenza707
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

СПАСИБО!

Please sign in to comment.