Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fancier Invoice & Packingslip v1.0


Guest

Recommended Posts

Greeting friends!

 

 

Got this great contribution installed: LINK

 

 

I whant to add Client comment on the invoice that is printed from front end - > myshop.com/cataloge/account_history_info.php

 

 

So i have added this code:

 

<?php echo TABLE_HEADING_COMMENTS; ?>

<br>

<?php
    while ($order2s_comments = tep_db_fetch_array($order2s_status_history_query)) {
    	 if (tep_not_null($order2s_comments['comments'])) {
      $has_comments = true; // Not Null = Has Comments
      if (tep_not_null($order2s_comments['comments'])) {
          $sInfo = new objectInfo($order2s_comments);
?>

<?php echo TABLE_HEADING_DATE_ADDED; ?>
<?php echo TABLE_HEADING_COMMENT_LEFT; ?>

<br>

<?php echo tep_date_short($sInfo->date_added); ?> 
<?php echo nl2br(tep_db_output($order2s_comments['comments'])); ?>

<br>

<?php
      }
      }
    }
    if ($has_comments == false) {
?>

<?php echo INVOICE_TEXT_NO_COMMENT; ?>

<?php
    }
?>

 

to this PHP - cataloge/print_my_invoice.php

 

but something is not running, i`m geeting this error:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/shop/includes/functions/database.php on line 101

 

and under it i get this:

ORDER COMMENTS:

 

No comments have been left for this order

 

Any ideas?

Edited by imop
Link to comment
Share on other sites

Hey!

 

After a bit of research got it run and work, so here is the solution:

 

if u need coment box in front-end for user direct PRINT in account_history_info.php

 

 

Just add this to your - print_my_invoice.php

 

in cataloge/print_my_invoice.php

 

 

<!-- Comments START -->
<table width="100%" border="3" cellpadding="5" bordercolor="#EEEEEE" bgcolor="#FFFFFF" style="border-collapse: collapse">
     <?php
$order2s_status_history_query = tep_db_query("select * from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' order by date_added");
if (tep_db_num_rows($order2s_status_history_query)) {
	  $has_comments = false;
?>
     <tr>
       <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
           <tr>
             <td align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                   <td width="95%" NOWRAP> <b><?php echo TABLE_HEADING_COMMENTS; ?></b><br>
                     <br></td>
                 </tr>
                 <?php
    while ($order2s_comments = tep_db_fetch_array($order2s_status_history_query)) {
    	 if (tep_not_null($order2s_comments['comments'])) {
      $has_comments = true; // Not Null = Has Comments
      if (tep_not_null($order2s_comments['comments'])) {
          $sInfo = new objectInfo($order2s_comments);
?>
                 <tr>
                   <td align="center" width="95%"><table width="95%" border="0" cellpadding="0" cellspacing="0">
                       <tr>
                         <td width="95%" class="smallText"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
                             <tr>
                               <td width="150" align="left" valign="top" class="smallText"><strong><u><?php echo TABLE_HEADING_DATE_ADDED; ?></u></strong></td>
                               <td align="left" valign="top" class="smallText"><strong><u><?php echo TABLE_HEADING_COMMENT_LEFT; ?></u></strong></td>
                             </tr>
                           </table></td>
                       </tr>
                     </table></td>
                 </tr>
                 <tr>
                   <td align="center" width="95%"><table width="95%" border="0" cellpadding="0" cellspacing="0">
                       <tr>
                         <td width="95%" class="smallText"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
                             <tr>
                               <td width="150" align="left" valign="top" class="smallText"><?php echo tep_date_short($sInfo->date_added); ?></td>
                               <td align="left" valign="top" class="smallText"><?php echo nl2br(tep_db_output($order2s_comments['comments'])); ?><br>
                                 <br></td>
                             </tr>
                           </table></td>
                       </tr>
                     </table></td>
                 </tr>
                 <?php
      }
      }
    }
    if ($has_comments == false) {
?>
                 <tr>
                   <td align="center" width="95%"><table width="95%" border="0" cellpadding="0" cellspacing="0">
                       <tr>
                         <td width="95%" class="smallText"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
                             <tr>
                               <td width="100%" align="left" valign="top" class="smallText"><?php echo INVOICE_TEXT_NO_COMMENT; ?></td>
                             </tr>
                           </table></td>
                       </tr>
                     </table></td>
                 </tr>
                 <?php
    }
?>
   <?php
}
?>
               </table></td>
           </tr>
         </table></td>
     </tr>
   </table>
<!-- Comments end -->

 

Hope someone will find this useful!

 

END

Edited by imop
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...