From 9377775eca428c7022abd4bfa301ef83c8b108b8 Mon Sep 17 00:00:00 2001 From: Fabio Chelly Date: Fri, 6 Sep 2013 17:54:12 +0200 Subject: [PATCH] [-] MO productcomments : - 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 --- js/tools.js | 1 + modules/productcomments/js/productcomments.js | 12 +++++++++--- modules/productcomments/productcomments.tpl | 6 +++--- .../modules/productcomments/productcomments.tpl | 5 ++++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/js/tools.js b/js/tools.js index 5f851b0ea19c4..4da024b8cf94a 100644 --- a/js/tools.js +++ b/js/tools.js @@ -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 += ''; diff --git a/modules/productcomments/js/productcomments.js b/modules/productcomments/js/productcomments.js index aa9ac386b53a7..daebc3d0b4113 100644 --- a/modules/productcomments/js/productcomments.js +++ b/modules/productcomments/js/productcomments.js @@ -56,11 +56,11 @@ $(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", @@ -68,7 +68,9 @@ $(function() { if (data.result) { $.fancybox.close(); - document.location.href = document.location.href; + var buttons = {}; + buttons[productcomment_ok] = "productcommentRefreshPage"; + fancyChooseBox(productcomment_added, productcomment_title, buttons); } else { @@ -83,3 +85,7 @@ $(function() { return false; }); }); + +function productcommentRefreshPage() { + window.location.reload(); +} \ No newline at end of file diff --git a/modules/productcomments/productcomments.tpl b/modules/productcomments/productcomments.tpl index 036aadeeb934a..9720964567d8e 100644 --- a/modules/productcomments/productcomments.tpl +++ b/modules/productcomments/productcomments.tpl @@ -89,7 +89,7 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
-
+

{l s='Write your review' mod='productcomments'}

{$product->name|escape:html:'UTF-8'} @@ -102,7 +102,7 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';

{l s='Write your review' mod='productcomments'}

-