Jump to content

[free module] Product reviews (comments) for PrestaShop 1.7


Recommended Posts

On 7/13/2020 at 5:02 AM, Smithikamobiles said:

hey any one help getting this php error in error log...

 

PHP Fatal error: Uncaught TypeError: Argument 2 passed to ProductCommentsPostCommentModuleFrontController::addCommentGrades() must be of the type array, boolean given, called in /home/smithikakart/smithikamobiles.in/modules/productcomments/controllers/front/PostComment.php on line 87 and defined in /home/smithikakart/smithikamobiles.in/modules/productcomments/controllers/front/PostComment.php:113 Stack trace: #0 /home/smithikakart/smithikamobiles.in/modules/productcomments/controllers/front/PostComment.php(87): ProductCommentsPostCommentModuleFrontController->addCommentGrades(Object(PrestaShop\Module\ProductComment\Entity\ProductComment), false) #1 /home/smithikakart/smithikamobiles.in/classes/controller/Controller.php(312): ProductCommentsPostCommentModuleFrontController->display() #2 /home/smithikakart/smithikamobiles.in/classes/Dispatcher.php(515): ControllerCore->run() #3 /home/smithikakart/smithikamobiles.in/index.php(28): DispatcherCore->dispatch()

I have the same error. Did you find a solution?

Share this post


Link to post
Share on other sites
  • 1 month later...
  • Replies 207
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Free product reviews module for new PrestaShop 1.7.x this addon is a modification of old 'productcomments' module that we have by default in each installation of prestashop 1.6.x / 1.5.x. Now it

Emerchandiserph  Hello, I think the theme is the cause ?

Excuse me I do not know too much about 1.7 (A lot of bug)

Posted Images

Hi!

Thanks a lot for your amazing job and contributions to the Prestashop Community for many years now :-)

I wanted to know if there were a way to prevent users to post several comments on the same product? From what I see, at the moment, there is no restriction.

Share this post


Link to post
Share on other sites
  • 1 month later...
  • 3 weeks later...
  • 2 weeks later...

Hello. How to change in the latest version of the module so that the e-mail address is not mandatory?

Share this post


Link to post
Share on other sites

lastest version is v. 9.5.2 , try this for fixing problem on newest prestashop release.

I have prestashop 1744 and only version previous v. 9.3.8 work fine for me

Share this post


Link to post
Share on other sites
  • 3 weeks later...
Posted (edited)

Hi Milos,

Greetings of the day.

I need help to find a solution if the number of characters goes above 105 then the content variable holding comments data goes down below the author's name instead right side of the page.

Attached screenshot. URL => https://www.hrms-systems.com/presta-addons/en/men/1-1-hummingbird-printed-t-shirt.html

I have updated the tpl file to show messages related 64 characters in Title and 100 characters in comments

 

{if $PRODUCT_COMMENT_BODY == 1}
<p itemprop="reviewBody">{$comment.content|escape:'html':'UTF-8'|nl2br nofilter}</p>
{/if}

{if $PRODUCT_COMMENT_BODY == 1}
<p itemprop="reviewBody">{$comment.content|truncate:105}</p>
{/if}

 

spacer.png

 

spacer.png


 

{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2016 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*
*  MODIFIED BY MYPRESTA.EU FOR PRESTASHOP 1.7 PURPOSES !
*
*}

<script type="text/javascript">
    var myprestacomments_controller_url = '{$myprestacomments_controller_url nofilter}';
    var confirm_report_message = '{l s='Are you sure that you want to report this comment?' mod='myprestacomments' js=1}';
    var secure_key = '{$secure_key}';
    var myprestacomments_url_rewrite = '{$myprestacomments_url_rewriting_activated}';
    var MyprestaComment_added = '{l s='Your comment has been added!' mod='myprestacomments' js=1}';
    var MyprestaComment_added_moderation = '{l s='Your comment has been submitted and will be available once approved by a moderator.' mod='myprestacomments' js=1}';
    var MyprestaComment_title = '{l s='New comment' mod='myprestacomments' js=1}';
    var MyprestaComment_ok = '{l s='OK' mod='myprestacomments' js=1}';
    var moderation_active = {$moderation_active};
</script>

<div id="myprestacommentsBlock">
    <h1 class="h1 products-section-title text-uppercase ">{l s='Reviews' mod='myprestacomments'}</h1>
    <div class="tabs">
       
        <div id="new_comment_form_ok" class="alert alert-success" style="display:none;padding:15px 25px"></div>
        <div id="product_comments_block_tab">
            {if $comments}
                {foreach from=$comments item=comment}
                    {if $comment.content}
                        <div class="comment clearfix" >
                            <div class="comment_author" >
                                <span>{l s='Grade' mod='myprestacomments'}&nbsp</span>
                                <div class="star_content clearfix" >
                                    {section name="i" start=0 loop=5 step=1}
                                        {if $comment.grade le $smarty.section.i.index}
                                            <div class="star"></div>
                                        {else}
                                            <div class="star star_on"></div>
                                        {/if}
                                    {/section}
                                    <meta itemprop="worstRating" content = "0" />
                                    <meta itemprop="ratingValue" content = "{$comment.grade}" />
                                    <meta itemprop="bestRating" content = "5" />
                                </div>
                                {if $PRODUCT_COMMENTS_DGRADE}
                                <div class="criterions_grade">
                                    {foreach MyprestaCommentCriterion::getByProductAndByComment($comment.id_product_comment) AS $criterion}
                                        {$criterion.name}<br/>
                                        {section name="i" start=0 loop=5 step=1}
                                            {if $criterion.grade le $smarty.section.i.index}
                                                <div class="criterion star"></div>
                                            {else}
                                                <div class="criterion star star_on"></div>
                                            {/if}
                                        {/section}
                                        <br/>
                                    {/foreach}
                                </div>
                                {/if}
                                <div class="comment_author_infos" >
                                    {if $PRODUCT_COMMENT_AUTHOR == 1}
                                        <strong itemprop="author">{$comment.customer_name|escape:'html':'UTF-8'}</strong><br/>
                                    {/if}
                                    {if $PRODUCT_COMMENT_DATE == 1}
                                        <em>{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}</em>
                                    {/if}
                                    <meta itemprop="datePublished" content="{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}" />
                                </div>
                            </div>
                            <div class="comment_details">
                                {if $PRODUCT_COMMENT_TITLE == 1}
                                    <h4 class="title_block" itemprop="name">{$comment.title}</h4>
                                {/if}
                                {if $PRODUCT_COMMENT_BODY == 1}
                                    <p itemprop="reviewBody">
                                    {$comment.content|truncate:105}</p>
                                {/if}
                                <ul>
                                    
                                    {if $logged}
                                        
                                        
                                    {/if}
                                </ul>
                                {hook::exec('displayMyprestaComment', $comment) nofilter}
                            </div>
                        </div>
                    {/if}
                {/foreach}
            {else}
                {if (!$too_early AND ($logged OR $allow_guests))}
                    <p class="align_center alert alert-info">
                        <a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='myprestacomments'} !</a>
                    </p>
                {else}
                    <p class="align_center">{l s='No customer reviews for the moment.' mod='myprestacomments'}</p>
                {/if}
            {/if}
        </div>
        
        <hr/>
      
        <div class="clearfix pull-left">
            {if ($too_early == false AND ($logged OR $allow_guests))}
                <a class="open-comment-form btn btn-primary" href="#new_comment_form">{l s='Write your review' mod='myprestacomments'}</a>
            {/if}
        </div>
        <br/> <br/>
        
    </div>

    {if isset($myprestacomments_product) && $myprestacomments_product}
        <!-- Fancybox -->
        <div style="display:none">
            <div id="new_comment_form">
                <form id="id_new_comment_form" action="#">
                    <h2 class="title">{l s='Write your review' mod='myprestacomments'}</h2>
                    {if isset($myprestacomments_product) && $myprestacomments_product}
                        <div class="product clearfix">
                            <div class="product_desc">
                                <p class="product_name"><strong>{if isset($myprestacomments_product->name)}{$myprestacomments_product->name}{elseif isset($myprestacomments_product.name)}{$myprestacomments_product.name}{/if}</strong></p>
                                {if isset($myprestacomments_product->description_short)}{$myprestacomments_product->description_short nofilter}{elseif isset($myprestacomments_product.description_short)}{$myprestacomments_product.description_short nofilter}{/if}
                            </div>
                        </div>
                    {/if}
                    <div class="new_comment_form_content">
                        <h2>{l s='Write your review' mod='myprestacomments'}</h2>
                        <div id="new_comment_form_error" class="error" style="display:none;padding:15px 25px">
                            <ul></ul>
                        </div>
                        {if $criterions|@count > 0}
                            <ul id="criterions_list">
                                {foreach from=$criterions item='criterion'}
                                    <li>
                                        <label>{$criterion.name|escape:'html':'UTF-8'}</label>
                                        <div class="star_content">
                                            <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1"/>
                                            <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2"/>
                                            <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3"/>
                                            <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4"/>
                                            <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="5" checked="checked"/>
                                        </div>
                                        <div class="clearfix"></div>
                                    </li>
                                {/foreach}
                            </ul>
                        {/if}
                        <label for="comment_title">{l s='Title for your review' mod='myprestacomments'}<sup class="required">*</sup></label>
                        <input id="comment_title" placeholder="Maximum 64 Characters allowed" maxlength="64" name="title" type="text" value=""/>

                        <label for="content">{l s='Your review' mod='myprestacomments'}<sup class="required">*</sup></label>
                        <textarea id="content" maxlength="100" placeholder="Maximum 100 Characters allowed"name="content"></textarea>

                        {if $allow_guests == true && !$logged}
                            <label>{l s='Your name' mod='myprestacomments'}<sup class="required">*</sup></label>
                            <input id="commentCustomerName" name="customer_name" type="text" value=""/>
                            <label>{l s='Your email' mod='myprestacomments'}<sup class="required">*</sup></label>
                            <input id="commentCustomerEmail" name="customer_email" type="text" value=""/>
                        {/if}

                        <div id="new_comment_form_footer">
                            <input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}'/>
                            
                            <p class="row required"><sup>*</sup> {l s='Required fields' mod='myprestacomments'}</p>
                            <p class="row required"><sup>*</sup>Maximum 100 Characters allowed in comments </p>
                            <p class="row required"><sup>*</sup> Maximum 64 Characters allowed in comments title </p>

                            <p class="fr">
                                {if $PRODUCT_COMMENTS_GDPR == 1}
                                {literal}
                                    <input onchange="if($(this).is(':checked')){$('#submitNewMessage').removeClass('gdpr_disabled'); $('#submitNewMessage').removeAttr('disabled'); rebindClickButton();}else{$('#submitNewMessage').addClass('gdpr_disabled'); $('#submitNewMessage').off('click'); $('#submitNewMessage').attr('disabled', 1); }" id="gdpr_checkbox" type="checkbox" >
                                {/literal}
                                    {l s='I accept ' mod='myprestacomments'} <a target="_blank" href="{$link->getCmsLink($PRODUCT_COMMENTS_GDPRCMS)}">{l s='privacy policy' mod='myprestacomments'}</a> {l s='rules' mod='myprestacomments'}
                                {/if}

                                <button {if $PRODUCT_COMMENTS_GDPR == 1}disabled{/if} class="btn btn-primary {if $PRODUCT_COMMENTS_GDPR == 1}gdpr_disabled{/if}" id="submitNewMessage" name="submitMessage" type="submit">{l s='Send' mod='myprestacomments'}</button>&nbsp;
                                {l s='or' mod='myprestacomments'}&nbsp;<a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='myprestacomments'}</a>
                            </p>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </form><!-- /end new_comment_form_content -->
            </div>
        </div>
        <!-- End fancybox -->
    {/if}
</div>

 

Any idea?

Have a nice day.

 

Edited by Zohaib-fk
Post Updated with screenshots and code updates (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More