Zen Cart Logo
Forums / Managing Customers and Orders / Batch Form print - with comments on screen

Batch Form print - with comments on screen

Views: 1,555

Results 1 to 6 of 6
18 Jul 2011, 8:39 PM
#1
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Batch Form print - with comments on screen

Hello -

When say 100 orders come in, 35 may have comments. We then may print 10 of those. Having the comments in Batch Form Print makes this a one process step.

I've been working at this a while and cannot get the 1st comment to be generated in the extra column I created in Batch Form Print.

Here is what I have so far and it's generating --none-- , so at least it's half there...

<td class="dataTableContent" align="left">
				<?php 
				//--Add comments starts--
$orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
from " . TABLE_ORDERS_STATUS_HISTORY . "
where orders_id = '" . zen_db_input($oID) . "'
order by date_added limit 1");
//--Add comments ends--
				echo ($orders_history->fields['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($orders_history->fields['comments']))) ?></td>

I am assuming I have the execute code in the wrong location. any help?

19 Jul 2011, 12:58 PM
#2
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Batch Form print - with comments on screen

I can see where the php code to grab the info should be higher on the page - below the order search function before the display of the orders... correct? That would split the code in two spots.

  1. php code to grab the info (but exactly where ???
<?php 
//--Add comments starts--
$orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
from " . TABLE_ORDERS_STATUS_HISTORY . "
where orders_id = '" . zen_db_input($oID) . "'
order by date_added limit 1");
//--Add comments ends-- 
    ?>
  1. The display of the comment in the table on screen
<td class="dataTableContent" align="left"> echo ($orders_history->fields['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($orders_history->fields['comments']))) ?> </td>

Is this getting closer?

19 Jul 2011, 9:24 PM
#3
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Batch Form print - with comments on screen

this is so close.

I put the execute code up at the top of the page - under the require code, still nothing. It seems like it makes sense and should work, but......

any suggestions?

21 Jul 2011, 1:33 AM
#4
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Batch Form print - with comments on screen

Able to get this to work by replacing $oID with
$orders->fields['orders_id'] and putting the code within the order loop.

I get the comments displayed BUT it takes the comment from the newest order and repeats it for all orders down the column.

Any suggestions to display the associated order comment?

21 Jul 2011, 2:34 PM
#5
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Batch Form print - with comments on screen

any help would be greatly appreciated!

I have changed the code to display the comment in the form of batch print to this:

<td class="dataTableContent" align="left"><?php echo $orders_history->fields['comments']; ?></td>

Still repeats the newest orders' first comment for all orders down the column.

Anyone know how to stop this and have that order from that line be associated to it's own 1st comment (if a comment was inputted on that order during checkout)

Coffee anyone?

25 Jul 2011, 7:18 PM
#6
sbbemn avatar

sbbemn

Zen Follower

Join Date:
Jan 2010
Posts:
182
Plugin Contributions:
0

Re: Batch Form print - with comments on screen

I would like to add the resolution to this. This adds the first comment from the order being placed to the table on super_batch_forms.php
Makes for easy comment reading batch style for us.

Not the only thread I tend to speak with myself on... really I get out of the office sometimes and see daylight.

Code to add at about 293 in the table

<td class="dataTableHeadingContent" align="left" colspan="2">Order Comments</td>

Code to add about line 297 before the end of the loop after while (!$orders->EOF) {

//--Add comments starts--
$orders_history = $db->Execute("select comments
from " . TABLE_ORDERS_STATUS_HISTORY . "
where orders_id = '" . zen_db_input($orders->fields['orders_id']) . "'
order by date_added limit 1");
//--Add comments ends-- 

add Line of code what is now about 314 in the table

<td class="dataTableContent" align="left" width="400"><?php echo $orders_history->fields['comments']; ?></td>