Jump to content

problem with module product comments


wdracing

Recommended Posts

Hello,

 

Please I need help from you guys.

 

 

I attach a screenshot of the problem.

ONLY we i open in the front office a product it gives me the problem that you see.. infact instead of opening the product with description images etc.. it shows a White page with the old product comment ( done when the module worked well in the previous versions ) or the White page with the write " be the first to write a recension ".

 

i think that is a conflict with another module but i ve already tried to swith off other product module

 

how can i do ?

 

post-1181380-0-59047900-1499430043_thumb.gif

Link to comment
Share on other sites

Your screenshow says almost nothing.

The only thing we can see is the request with ID 2774 shows red. In general, red meands "not found" or "file missing".

We cannot not even see the full URL.

What can we guess without any details?

 

You want answers without giving enough information to help.

Provide an URL of your shop!

Edited by Scully (see edit history)
Link to comment
Share on other sites

You get a 500 ERROR when the browser tries to load the product page for product 1184.

Error 500 is usually some kind of misconfiguration or simply a syntax error somewhere in your files.

 

Log into you server and check your error-logfiles. There you can see a more detailled information.

 

Since not all products have this problem, the error might quite likely be in the comments module.

Have you changed it?

When yes: What and where?

Edited by Scully (see edit history)
Link to comment
Share on other sites

these are errors in error log file :

 

 

/home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:11:06 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:11:23 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:11:37 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:11:53 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:12:30 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:13:43 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:14:04 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:14:18 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:18:26 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207
[10-Jul-2017 17:19:48 Europe/Rome] PHP Fatal error:  Cannot use object of type Product as array in /home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207

 

i have never changed the module
 

Link to comment
Share on other sites

The compiled version shows an error in line 207. The product data cannot be loaded.

Can you post the lines 200 until 215 from this file

 

/home/yawdraci/public_html/cache/smarty/compile/a4/f2/f9/a4f2f95a94e23ad4c5865fd31f0c2dab9ad00fb0.file.productcomments.tpl.php on line 207

 

and also post the full content of your productcomments.tpl from within your theme directory.

Which PS Version do you use?

Link to comment
Share on other sites

Ehy i m sorry.

 

these are the lines requested:

 

    <div class="product_desc">
       <p class="product_name">
        <strong><?php if (isset($_smarty_tpl->tpl_vars['product']->value->name)) {?><?php echo $_smarty_tpl->tpl_vars['product']->value->name;?>
<?php } else { ?><?php echo $_smarty_tpl->tpl_vars['product']->value['name'];?>
<?php }?></strong>
       </p>
       <?php if (isset($_smarty_tpl->tpl_vars['product']->value->description_short)) {?><?php echo $_smarty_tpl->tpl_vars['product']->value->description_short;?>
<?php } else { ?><?php echo $_smarty_tpl->tpl_vars['product']->value['description_short'];?>
<?php }?>
       
      </div>
     </div>
    <?php }?>
    <div class="new_comment_form_content col-xs-12 col-sm-6">
     <div id="new_comment_form_error" class="error" style="display: none; padding: 15px 25px">
      <ul></ul>

Edited by wdracing (see edit history)
Link to comment
Share on other sites

full content of your productcomments.tpl from within your theme directory :

 

 {if isset($warehouse_vars.product_tabs) && $warehouse_vars.product_tabs}
 <section class="page-product-box tab-pane fade" id="reviewsTab">
 {else}
 <section class="page-product-box" id="reviewsTab">
 <h3 class="page-product-heading">{l s='Reviews' mod='productcomments'}</h3>
 {/if}
 <div id="product_comments_block_tab">
  {if $comments}
   {foreach from=$comments item=comment}
    {if $comment.content}
    <div class="comment row" itemprop="review" itemscope itemtype="https://schema.org/Review">
     <div class="comment_author col-sm-2">
      <span>{l s='Grade' mod='productcomments'} </span>
      <div class="star_content clearfix"  itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
       {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|escape:'html':'UTF-8'}" />
                <meta itemprop="bestRating" content = "5" />
      </div>
      <div class="comment_author_infos">
       <strong itemprop="author">{$comment.customer_name|escape:'html':'UTF-8'}</strong>
       <meta itemprop="datePublished" content="{$comment.date_add|escape:'html':'UTF-8'|substr:0:10}" />
       <em>{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}</em>
      </div>
     </div> <!-- .comment_author -->

     <div class="comment_details col-sm-10">
      <p itemprop="name" class="title_block">
       <strong>{$comment.title}</strong>
      </p>
      <p itemprop="reviewBody">{$comment.content|escape:'html':'UTF-8'|nl2br}</p>
      <ul>
       {if $comment.total_advice > 0}
        <li>
         {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'}
        </li>
       {/if}
       {if $is_logged}
        {if !$comment.customer_advice}
        <li>
         {l s='Was this comment useful to you?' mod='productcomments'}
         <button class="usefulness_btn btn btn-default button button-small" data-is-usefull="1" data-id-product-comment="{$comment.id_product_comment}">
          <span>{l s='Yes' mod='productcomments'}</span>
         </button>
         <button class="usefulness_btn btn btn-default button button-small" data-is-usefull="0" data-id-product-comment="{$comment.id_product_comment}">
          <span>{l s='No' mod='productcomments'}</span>
         </button>
        </li>
        {/if}
        {if !$comment.customer_report}
        <li>
         <span class="report_btn" data-id-product-comment="{$comment.id_product_comment}">
          {l s='Report abuse' mod='productcomments'}
         </span>
        </li>
        {/if}
       {/if}
      </ul>
     </div><!-- .comment_details -->

    </div> <!-- .comment -->
    {/if}
   {/foreach}
   {if (!$too_early AND ($is_logged OR $allow_guests))}
   <p class="align_center">
    <a id="new_comment_tab_btn" class="btn btn-default button button-small open-comment-form" href="#new_comment_form">
     <span>{l s='Write your review!' mod='productcomments'} !</span>
    </a>
   </p>
   {/if}
  {else}
   {if (!$too_early AND ($is_logged OR $allow_guests))}
   <p class="align_center">
    <a id="new_comment_tab_btn" class="btn btn-default button button-small open-comment-form" href="#new_comment_form">
     <span>{l s='Be the first to write your review!' mod='productcomments'}</span>
    </a>
   </p>
   {else}
   <p class="align_center">{l s='No customer reviews for the moment.' mod='productcomments'}</p>
   {/if}
  {/if}
 </div> <!-- #product_comments_block_tab -->
</section>

<!-- Fancybox -->
<div style="display: none;">
 <div id="new_comment_form">
  <form id="id_new_comment_form" action="#">
   <h2 class="page-subheading">
    {l s='Write a review' mod='productcomments'}
   </h2>
   <div class="row">
    {if isset($product) && $product}
     <div class="product clearfix  col-xs-12 col-sm-6">
      <img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
      <div class="product_desc">
       <p class="product_name">
        <strong>{if isset($product->name)}{$product->name}{else}{$product.name}{/if}</strong>
       </p>
       {if isset($product->description_short)}{$product->description_short}{else}{$product.description_short}{/if}
       
      </div>
     </div>
    {/if}
    <div class="new_comment_form_content col-xs-12 col-sm-6">
     <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 not_uniform" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1" />
         <input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2" />
         <input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3" />
         <input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4" />
         <input class="star not_uniform" 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:' mod='productcomments'}: <sup class="required">*</sup>
     </label>
     <input id="comment_title" name="title" type="text" value=""/>
     <label for="content">
      {l s='Comment:' mod='productcomments'}: <sup class="required">*</sup>
     </label>
     <textarea id="content" name="content"></textarea>
     {if $allow_guests == true && !$is_logged}
      <label>
       {l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
      </label>
      <input id="commentCustomerName" name="customer_name" 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="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p>
      <p class="fr">
       <button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-small">
        <span>{l s='Submit' mod='productcomments'}</span>
       </button> 
       {l s='or' mod='productcomments'} 
       <a class="closefb" href="#">
        {l s='Cancel' mod='productcomments'}
       </a>
      </p>
      <div class="clearfix"></div>
     </div> <!-- #new_comment_form_footer -->
    </div>
   </div>
  </form><!-- /end new_comment_form_content -->
 </div>
</div>
<!-- End fancybox -->
{strip}
{addJsDef productcomments_controller_url=$productcomments_controller_url|@addcslashes:'\''}
{addJsDef moderation_active=$moderation_active|boolval}
{addJsDef productcomments_url_rewrite=$productcomments_url_rewriting_activated|boolval}
{addJsDef secure_key=$secure_key}

{addJsDefL name=confirm_report_message}{l s='Are you sure that you want to report this comment?' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_added}{l s='Your comment has been added!' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_added_moderation}{l s='Your comment has been added and will be available once approved by a moderator.' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_title}{l s='New comment' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_ok}{l s='OK' mod='productcomments' js=1}{/addJsDefL}
{/strip}
 

Link to comment
Share on other sites

Two last words:

 

The initial error message says:

 

Cannot use object of type Product as array

Plese note the capital 'P' for this term. In your code, if don't find Product with capital 'P' in your code and have doubts the code shown is actually the code performed when the error occurs or we miss some parts of the errors log.

 

If you are not familiar with TPL try to load your original productcomments.tpl from a backup or from the original source you have used.

 

I am out but good luck for the fix.

Link to comment
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...