chris23 Posted July 27, 2007 Share Posted July 27, 2007 Support for PDF Customer Invoice contribution This contribution will add a link to a customer's order history detail page (account_history_info.php). When clicked, this link will generate a PDF copy invoice for the order. This contribution is based on PDF Invoice (http://www.oscommerce.com/community/contributions,3027) Apart from recoding PDF Invoice to work client side, I have added the following features, configurable from within admin: 1. Font can be chosen - arial, times, courier, helvetica. 2. Colours for the invoice elements can be chosen. Hex values supplied are automatically converted to RGB as needed by FPDF so you can easily match up your stylesheet.css colours to the invoice colours for a consistent look. 3. An optional watermark (text of your choice e.g. "Copy Invoice") can be added to the invoice. 4. An optional VAT tax reference can be added to the invoice. 5. Choice of displaying generated PDF inline or by forcing a download - set within admin configuration. 6. PDF Metadata (Store owner, Invoice number etc) is automatically added to the PDF. 7. Choice of store logos - png, gif, jpg. 8. Custom footer splash (marketing text) can be added. 9. Store logo size can be easily 'tweaked'. The invoice will also display product attributes, if applicable (something which is missing from PDF Invoice) Download contribution at http://www.oscommerce.com/community/contributions,5321 Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 28, 2007 Share Posted July 28, 2007 Support for PDF Customer Invoice contribution This contribution will add a link to a customer's order history detail page (account_history_info.php). When clicked, this link will generate a PDF copy invoice for the order. This contribution is based on PDF Invoice (http://www.oscommerce.com/community/contributions,3027) Apart from recoding PDF Invoice to work client side, I have added the following features, configurable from within admin: 1. Font can be chosen - arial, times, courier, helvetica. 2. Colours for the invoice elements can be chosen. Hex values supplied are automatically converted to RGB as needed by FPDF so you can easily match up your stylesheet.css colours to the invoice colours for a consistent look. 3. An optional watermark (text of your choice e.g. "Copy Invoice") can be added to the invoice. 4. An optional VAT tax reference can be added to the invoice. 5. Choice of displaying generated PDF inline or by forcing a download - set within admin configuration. 6. PDF Metadata (Store owner, Invoice number etc) is automatically added to the PDF. 7. Choice of store logos - png, gif, jpg. 8. Custom footer splash (marketing text) can be added. 9. Store logo size can be easily 'tweaked'. The invoice will also display product attributes, if applicable (something which is missing from PDF Invoice) Download contribution at http://www.oscommerce.com/community/contributions,5321 Hi, I from France. :blush: I tried your contributions which is great!!! :thumbsup: But there is a problem of security with it. Indeed, all customers can see the invoice of other customer by changing ID number in the navbar. What to do to solve this problem? Sorry for my english. Thanks ;) Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 28, 2007 Author Share Posted July 28, 2007 Salut Jean, But there is a problem of security with it. Indeed, all customers can see the invoice of other customer by changing ID number in the navbar. This is very strange. It shouldn't happen. The following code in pdfinvoice.php is exactly the same as that in account_history_info.php and is designed to prevent what you describe. The script checks to see who owns the order and sees if this matches the id of the user currently logged in - if it doesn't, you get bounced. // perform security check to prevent "get" tampering to view other customer's invoices if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'"); $customer_info = tep_db_fetch_array($customer_info_query); if ($customer_info['customers_id'] != $customer_id) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } I cannot replicate what you describe however hard I try! If you alter the query string to another order number not owned by you, you get redirected to the main order history (account_history.php) You can however view your own invoices by changing the order_id in the query string to an order id belonging to you. Are you sure you're not seeing a different order belonging to the same customer? Sorry for my english. Pourquoi - mon Français est vraiment effroyable :D Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 28, 2007 Share Posted July 28, 2007 Salut Jean,This is very strange. It shouldn't happen. The following code in pdfinvoice.php is exactly the same as that in account_history_info.php and is designed to prevent what you describe. The script checks to see who owns the order and sees if this matches the id of the user currently logged in - if it doesn't, you get bounced. // perform security check to prevent "get" tampering to view other customer's invoices if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'"); $customer_info = tep_db_fetch_array($customer_info_query); if ($customer_info['customers_id'] != $customer_id) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } I cannot replicate what you describe however hard I try! If you alter the query string to another order number not owned by you, you get redirected to the main order history (account_history.php) You can however view your own invoices by changing the order_id in the query string to an order id belonging to you. Are you sure you're not seeing a different order belonging to the same customer? Pourquoi - mon Français est vraiment effroyable :D Oh yes you are right, I was using the same account!! :thumbsup: ;) Two other things : 1) Do you think that it's possible to have the invoice which appears in the customer account only if the status order is "shipped"? 2) I have previously installed a contribs to have sequential invoice number (the invoice number is generated only if the order is on status "shipped"). So the invoice numbers are different of the order numbers . Invoice number is stored in table "orders", and in a field called "orders_numero_facture". How to include this invoice number in the pdf invoice. Sorry I'm a noob :blush: Thanks :) Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 28, 2007 Author Share Posted July 28, 2007 Jean, Oh yes you are right, I was using the same account!! :thumbsup: ;) That's a relief! :thumbsup: 1) Do you think that it's possible to have the invoice which appears in the customer account only if the status order is "shipped"? This should be fairly easy - I will have a think and post some code here for you. 2) I have previously installed a contribs to have sequential invoice number (the invoice number is generated only if the order is on status "shipped"). So the invoice numbers are different of the order numbers . Invoice number is stored in table "orders", and in a field called "orders_numero_facture". How to include this invoice number in the pdf invoice. Can you post the link to the contribution here - I'm not familiar with it. I'll have a look and see if this is possible Sorry I'm a noob Hier nous étions tous les noobs. :lol: Regards, Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 28, 2007 Share Posted July 28, 2007 This should be fairly easy - I will have a think and post some code here for you. Thank you very much chris you are great :thumbsup: . I wait it impatiently :P Can you post the link to the contribution here - I'm not familiar with it. I'll have a look and see if this is possible Here is the code : CREATE TABLE `invoice_counter` ( `invoice_id` int(11) NOT NULL default '0', `invoice_counter` int(11) NOT NULL default '0', KEY `invoice_id` (`invoice_id`) ) TYPE=MyISAM; # # Contenu de la table `invoice_counter` # INSERT INTO `invoice_counter` VALUES (1, 1); INSERT INTO `configuration_group` VALUES (421, 'Options Facture', 'Options pour les factures', 421, 1); INSERT INTO `configuration` VALUES ('', 'Calcul d un numéro de facture différent du numéro de commande', 'AUTORISE_NUMERO_FACTURE', 'true', 'Calcule un numéro de facture à chaque vente effective', 421, 2, '2004-06-20 18:16:28', '2003-07-17 10:29:22', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),'); INSERT INTO `configuration` VALUES ('', 'Statut générant une facture', 'STATUT_GENERANT_FACTURE', '3', 'Statut d\\\'une commande permettant l\\\'attribution d\\\'un numéro de facture unique', 421, 1, '2004-06-12 22:53:27', '2003-07-17 10:29:22', NULL, NULL); ALTER TABLE `orders` ADD `orders_numero_facture` INT( 11 ) NOT NULL; ALTER TABLE `orders` ADD `orders_date_facture` DATETIME NULL; in catalog/admin/includes/classes/order.php change Line 27 : $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); to $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified, orders_numero_facture, orders_date_facture from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); change Line 45 : 'last_modified' => $order['last_modified']); to 'last_modified' => $order['last_modified'], 'orders_numero_facture' => $order['orders_numero_facture'], 'orders_date_facture' => $order['orders_date_facture']); in catalog/admin/invoice.php change Line 19 : $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); To $orders_query = tep_db_query("select orders_id, orders_numero_facture, orders_date_facture from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); change Line 35 : <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce', '204', '50'); ?></td> </tr> </table></td> </tr> to <tr> <td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" align="center" width="75%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce', '204', '50'); ?></td> </tr> <tr align="left"> <td colspan="2" class="titleHeading"><?php echo tep_draw_separator('pixel_trans.gif', '1', '30'); ?></td> </tr> <tr> <?php if (AUTORISE_NUMERO_FACTURE == 'true') { if ($order->info['orders_numero_facture'] == 0) { ?> <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_ORDER . $oID; ?></b></td> <?php } else { ?> <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_INVOICE . $order->info['orders_numero_facture']; ?></b></td> <?php } } else { ?> <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_ORDER . $oID; ?></b></td> <?php } ?> </tr> <tr> <?php if (AUTORISE_NUMERO_FACTURE == 'true') { if ($order->info['orders_date_facture'] == 0) { ?> <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_DATEINVOICE . "pas attribué"; ?></b></td> <?php } else { ?> <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_DATEINVOICE . tep_datetime_short($order->info['orders_date_facture']); ?></b></td> <?php } } else { ?> <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_DATEINVOICE . "pas attribué"; ?></b></td> <?php } ?> </tr> <tr align="left"> <td colspan="2" class="titleHeading"><?php echo tep_draw_separator('pixel_trans.gif', '1', '30'); ?></td> </tr> </table></td> </tr> </table></td> </tr> in catalog/admin/orders.php Line 37 change : $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); to $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased, orders_numero_facture, orders_numero_facture from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); Line 41 change : tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'"); To tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'"); if (AUTORISE_NUMERO_FACTURE == 'true') { if (tep_db_input($status) == STATUT_GENERANT_FACTURE) { $check_invoice_counter_query = tep_db_query("select invoice_counter from " . TABLE_INVOICE_COUNTER . " where invoice_id = '1'"); $check_invoice_counter = tep_db_fetch_array($check_invoice_counter_query); $numero_facture = $check_invoice_counter['invoice_counter'] + 1; if ($check_status['orders_numero_facture'] == 0) { tep_db_query("update " . TABLE_INVOICE_COUNTER . " set invoice_counter = '" . $numero_facture . "' where invoice_id = '1'"); tep_db_query("update " . TABLE_ORDERS . " set orders_numero_facture = '" . $numero_facture . "', last_modified = now() where orders_id = '" . (int)$oID . "'"); tep_db_query("update " . TABLE_ORDERS . " set orders_date_facture = now() where orders_id = '" . (int)$oID . "'"); } else { $messageStack->add_session(WARNING_ORDER_WITH_NUMERO, 'warning'); } } } in catalog/admin/languages/xxxx/orders.php ADD define('WARNING_ORDER_WITH_NUMERO', 'Attention : Un nouveau numéro de facture n\'a pas été généré, car la commande avait déjà fait l\'objet d\'une facture.'); in catalog/admin/includes/database_tables.php ADD : define('TABLE_INVOICE_COUNTER', 'invoice_counter'); in catalog/admin/includes/languages/xxxx/invoice.php ADD : define('TITLE_PRINT_ORDER', 'Commande N° '); define('TITLE_PRINT_INVOICE', 'Facture N° '); define('TITLE_PRINT_DATEINVOICE', 'Date de facture : '); Hier nous étions tous les noobs. :lol: You are right :thumbsup: :) Thanks ;) Quote Link to comment Share on other sites More sharing options...
Guest Posted July 29, 2007 Share Posted July 29, 2007 (edited) Hi, The customer details are not included in the generated pdf invoice! Or the date or payment method for that matter. Any solution as to why? Cheers Endre Edited July 29, 2007 by ahost Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 29, 2007 Author Share Posted July 29, 2007 Jean, I have the code to ensure that the pdf link is only shown if an order's latest status is set to "delivered". Edit account_history_info.php Find the code block: <!-- start pdf //--> <tr> <td class="main"><b><?php echo PDF_INVOICE; ?></b></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'pdf.gif', 'PDF invoice','','','style="vertical-align:middle"') . sprintf(PDF_DOWNLOAD_LINK, tep_href_link(FILENAME_CUSTOMER_PDF, 'order_id=' . $HTTP_GET_VARS['order_id'] , 'SSL')); ?></td> </tr> </table> </td> </tr> <!-- end pdf //--> and replace completely with: <!-- start pdf //--> <?php // only display pdf invoice link if * latest * order status is 3 (delivered) $delivered_query = tep_db_query("select max(osh.date_added) as los, osh.orders_status_id from " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' group by osh.orders_status_id order by los desc limit 1"); $delivered_status = tep_db_fetch_array($delivered_query); if ($delivered_status['orders_status_id'] == 3){ ?> <tr> <td class="main"><b><?php echo PDF_INVOICE; ?></b></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'pdf.gif', 'PDF invoice','','','style="vertical-align:middle"') . sprintf(PDF_DOWNLOAD_LINK, tep_href_link(FILENAME_CUSTOMER_PDF, 'order_id=' . $HTTP_GET_VARS['order_id'] , 'SSL')); ?></td> </tr> </table> </td> </tr> <?php } ?> <!-- end pdf //--> I think I'll add this as a configuration option in the next release as I can see it makes sense to restrict when a customer can see the invoice. As for your second query, I haven't installed the contribution so I haven't tested the following, but it should be sufficient to: edit pdfinvoice.php FIND (line 132) (int)$HTTP_GET_VARS['order_id'] and REPLACE with $order->info['orders_numero_facture'] Hope this helps Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted July 29, 2007 Author Share Posted July 29, 2007 Hi Endre, Looking at your screenshot, can you confirm whether you're getting the order lines and prices showing or not? I have recently discovered an issue with the original PDF invoice code on which I based this contribution. The invoice address uses the customer address, rather than the chosen billing address and the delivery address doesn't handle virtual (download) products properly. I am working on a fix for these issues. This * may * be related to your issue. Is order 286 for a standard or download item , i.e. should it have a delivery address. Also, looking at the order history info on account_history_info.php, is the information showing here correctly or is it missing here too? Regards Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 29, 2007 Share Posted July 29, 2007 I have the code to ensure that the pdf link is only shown if an order's latest status is set to "delivered". It's work congratulation :thumbsup: As for your second query, I haven't installed the contribution so I haven't tested the following, but it should be sufficient to: edit pdfinvoice.php FIND (line 132) (int)$HTTP_GET_VARS['order_id'] and REPLACE with $order->info['orders_numero_facture'] Hope this helps Chris It doesn't work, I still have the "order ID" on the invoice and not the "orders_numero_facture" :( So how to select "orders_numero_facture" where "orders_id=xxxx" (xxxx is the order number which is in the pdf) Thanks a lot for your help ;) Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 29, 2007 Author Share Posted July 29, 2007 I have recently discovered an issue with the original PDF invoice code on which I based this contribution. The invoice address uses the customer address, rather than the chosen billing address and the delivery address doesn't handle virtual (download) products properly. I am working on a fix for these issues. This * may * be related to your issue. Ignore this rubbish - been staring at the screen too long. The orig code is fine .... Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted July 29, 2007 Author Share Posted July 29, 2007 It doesn't work, I still have the "order ID" on the invoice and not the "orders_numero_facture" :( Hi Jean, There are two numbers on the invoice - one "Invoice number" and one "Order number". The order number I have left unchanged, but the "Invoice number" should no longer be set as the order_id but should be the "orders_numero_facture" property of the order object. Have you tried clearing your browser cache between reloads? When I was testing the contrib and refreshing the pdf, it didn't always reload the new version of pdfinvoice.pdf Regards Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 29, 2007 Share Posted July 29, 2007 Hi Jean, There are two numbers on the invoice - one "Invoice number" and one "Order number". The order number I have left unchanged, but the "Invoice number" should no longer be set as the order_id but should be the "orders_numero_facture" property of the order object. Have you tried clearing your browser cache between reloads? When I was testing the contrib and refreshing the pdf, it didn't always reload the new version of pdfinvoice.pdf Regards Chris No actually, I have the order_id for "invoice number" and "order number" but in my database, they are different. It's strange!! I refresh my browser but nothing change. I must change the line like this are we ok? : $this->MultiCell(100,6, PRINT_INVOICE_TITLE . $order->info['orders_numero_facture'] . "\n" . $date ,0,'L'); Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 30, 2007 Author Share Posted July 30, 2007 Jean, $this->MultiCell(100,6, PRINT_INVOICE_TITLE . $order->info['orders_numero_facture'] . "\n" . $date ,0,'L'); This is correct. This should bring out the invoice number generated by the contibution, not the order number .... ??? If you generate an invoice from admin for the same order you are generating a pdf, do you have different order and invoice numbers showing here, or are they the same here too? Regards, Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 30, 2007 Share Posted July 30, 2007 Jean,This is correct. This should bring out the invoice number generated by the contibution, not the order number .... ??? If you generate an invoice from admin for the same order you are generating a pdf, do you have different order and invoice numbers showing here, or are they the same here too? Regards, Chris Chris I give you some screenshots that can help to solve my problem. :) This is the code : This is the invoice in the admin : And this is the pdf invoice in catalog for the same order: This is the Database : What is the problem :blink: Thanks :) Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 30, 2007 Author Share Posted July 30, 2007 Jean, Fixed - I've been a bit dumb here - should have seen this hours ago :angry: You need to bring the $order object into the header function as a global: EDIT pdfinvoice.php FIND (line 121): global $HTTP_GET_VARS, $highlight_color; and change to: global $HTTP_GET_VARS, $highlight_color, $order; Also, if you want to have the invoice date match up to $order['orders_date_facture']) rather than today's date, your line 132 should now be $this->MultiCell(100,6, PRINT_INVOICE_TITLE . $order->info['orders_numero_facture'] . "\n" . $order->info['orders_date_facture'] ,0,'L'); You should be fine now Regards, Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 30, 2007 Share Posted July 30, 2007 Jean, Fixed - I've been a bit dumb here - should have seen this hours ago :angry: You need to bring the $order object into the header function as a global: EDIT pdfinvoice.php FIND (line 121): global $HTTP_GET_VARS, $highlight_color; and change to: global $HTTP_GET_VARS, $highlight_color, $order; Also, if you want to have the invoice date match up to $order['orders_date_facture']) rather than today's date, your line 132 should now be $this->MultiCell(100,6, PRINT_INVOICE_TITLE . $order->info['orders_numero_facture'] . "\n" . $order->info['orders_date_facture'] ,0,'L'); You should be fine now Regards, Chris I do that : And the result : :( Quote Link to comment Share on other sites More sharing options...
Guest Posted July 30, 2007 Share Posted July 30, 2007 Hi Endre, Looking at your screenshot, can you confirm whether you're getting the order lines and prices showing or not? I have recently discovered an issue with the original PDF invoice code on which I based this contribution. The invoice address uses the customer address, rather than the chosen billing address and the delivery address doesn't handle virtual (download) products properly. I am working on a fix for these issues. This * may * be related to your issue. Is order 286 for a standard or download item , i.e. should it have a delivery address. Also, looking at the order history info on account_history_info.php, is the information showing here correctly or is it missing here too? Regards Chris Hi Chris, I'm getting the order lines and prices, what I don't get is the address nor the order date and payment method. My customers are only allowed one address. I don't sell virtual products, so that's not the problem. Everything is fine on the account_history_info.php as far as I can see. The link to the invoice is there. Cheers Endre Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 30, 2007 Author Share Posted July 30, 2007 Hi Jean, Maybe I was too confident last time! I think I have finally tracked this down. pdfinvoice.php brings in catalog/includes/classes/orders.php. This is the class that allows access to all the order history for an order number passed to it. Unfortunately, your invoice contribution has amended catalog/admin/classes/orders.php so the $order->info['orders_numero_facture'] $order->info['orders_date_facture'] properties are missing in pdfinvoice.php What you need to do is duplicate the amendments you made to catalog/admin/includes/classes/order.php and apply them to catalog/includes/classes/orders.php Fingers crossed Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted July 30, 2007 Author Share Posted July 30, 2007 Everything is fine on the account_history_info.php as far as I can see. Hi Endre, This is the the bit that's got me stumped - the code in pdfinvoice.php creates a standard order object using the order number passed to it. The same code is used in account_history_info.php (from where it was taken!) If account_history_info.php is accessing the data, so should pdfinvoice.php Do you know if you (or a contrib) have made any amendments to catalog/includes/classes/order.php? Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 30, 2007 Share Posted July 30, 2007 Hi Jean, Maybe I was too confident last time! I think I have finally tracked this down. pdfinvoice.php brings in catalog/includes/classes/orders.php. This is the class that allows access to all the order history for an order number passed to it. Unfortunately, your invoice contribution has amended catalog/admin/classes/orders.php so the $order->info['orders_numero_facture'] $order->info['orders_date_facture'] properties are missing in pdfinvoice.php What you need to do is duplicate the amendments you made to catalog/admin/includes/classes/order.php and apply them to catalog/includes/classes/orders.php Fingers crossed I transfer the "admin" file in "catalog" file. Now my admin is in : catalog/admin But nothing change in the pdfinvoice.php (no invoice number et no date-time) :( Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 30, 2007 Author Share Posted July 30, 2007 Jean, Can you confirm that you applied the following to catalog/includes/classes/order.php? change : $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); to $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified, orders_numero_facture, orders_date_facture from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); change: 'last_modified' => $order['last_modified']); to 'last_modified' => $order['last_modified'], 'orders_numero_facture' => $order['orders_numero_facture'], 'orders_date_facture' => $order['orders_date_facture']); Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 30, 2007 Share Posted July 30, 2007 I just change it and now I have : Parse error: parse error in c:\program files\easyphp1-8\www\catalog\includes\classes\order.php on line 65 Here is the code : $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order_status['orders_status_name'], 'last_modified' => $order['last_modified'], 'orders_numero_facture' => $order['orders_numero_facture'], 'orders_date_facture' => $order['orders_date_facture']); 'total' => strip_tags($order_total['text']), 'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title']))); $this->customer = array('id' => $order['customers_id'], 'name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']); Line 65 is : 'total' => strip_tags($order_total['text']), Quote Link to comment Share on other sites More sharing options...
chris23 Posted July 30, 2007 Author Share Posted July 30, 2007 'orders_date_facture' => $order['orders_date_facture']); should be 'orders_date_facture' => $order['orders_date_facture']), note the comma at the end, not a semi-colon Keep going - we'll get this fixed :thumbsup: Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
royal38 Posted July 30, 2007 Share Posted July 30, 2007 'orders_date_facture' => $order['orders_date_facture']); should be 'orders_date_facture' => $order['orders_date_facture']), note the comma at the end, not a semi-colon Keep going - we'll get this fixed :thumbsup: I change it and now I have this : Parse error: parse error in c:\program files\easyphp1-8\www\catalog\includes\classes\order.php on line 64 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.