ohama Posted July 16, 2008 Posted July 16, 2008 My store owner wants to add the purchase date, last 4 digits of Credit Card number, and the order number to the invoice. I can add text to the invoice, but my PHP just isn't working. Let's start with one item - the purchase date. I want to show the contents of the date_purchased field in the orders table where the orders_id matches that of this particular order. I tried adding this near the top of admin/invoice.php: // Date of Purchase -START- $purchase_date = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); // Date of Purchase -END- Then in the body of the invoice I added this: <!-- Date of Purchase -START- --> <tr> <td class="main"><b><?php echo ENTRY_PURCHASE_DATE; ?></b> <?php echo tep_data_query($purchase_date->customer['date_purchased']); ?> </td> </tr> <!-- Date of Purchase -END- --> The word "customer" in $purchase_date->customer['date_purchased'] is something I mimicked from elsewhere in the file, but I can't quite get the logic of the rest of the file. "ENTRY_PURCHASE_DATE" is defined in admin/includes/english/invoice.php. CAN ANYONE SEE glaring errors in this code?
ohama Posted July 20, 2008 Author Posted July 20, 2008 Then in the body of the invoice I added this: <!-- Date of Purchase -START- --> <tr> <td class="main"><b><?php echo ENTRY_PURCHASE_DATE; ?></b> <?php echo tep_data_query($purchase_date->customer['date_purchased']); ?> </td> </tr> <!-- Date of Purchase -END- --> CAN ANYONE SEE glaring errors in this code? I'm very disappointed to have gotten no replies, but I solved this one myself, and I thought I'd share how in case anyone else needs to know. It was the word "customer" in the code that was the problem, but what word should it be? I looked at the included file orders.php and discovered that the 'date_purchased' field was in a category called "info". So the code that worked, adding the purchase date to my invoices, was this: <!-- Date of Purchase -START- --> <tr> <td class="main"><b><?php echo ENTRY_PURCHASE_DATE; ?></b> <?php echo $order->info['date_purchased']; ?> </td> </tr> <!-- Date of Purchase -END- -->
Recommended Posts
Archived
This topic is now archived and is closed to further replies.