Catalog Invoice allows your customers to create their own invoices from past orders on their My Account page.
https://www.zen-cart.com/downloads.php?do=file&id=2111
Printable View
Catalog Invoice allows your customers to create their own invoices from past orders on their My Account page.
https://www.zen-cart.com/downloads.php?do=file&id=2111
Scott... the FUNCTIONS file... invoice_functions.php
... is configured to return MM/DD/YY
Here in the UK, we read the date as DD/MM/YY
What changes need to happen with this code to render date as DD/MM/YY ?
Additionally - and for interest's sake, I added a JS print function to the end of the main invoice.php filePHP Code:
<?php
// Functions for catalog side invoice
if (!function_exists('zen_datetime_short')) {
function zen_datetime_short($raw_datetime) {
if ( ($raw_datetime == '0001-01-01 00:00:00') || ($raw_datetime == '') ) return false;
$year = (int)substr($raw_datetime, 0, 4);
$month = (int)substr($raw_datetime, 5, 2);
$day = (int)substr($raw_datetime, 8, 2);
$hour = (int)substr($raw_datetime, 11, 2);
$minute = (int)substr($raw_datetime, 14, 2);
$second = (int)substr($raw_datetime, 17, 2);
return strftime(DATE_TIME_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
}
}
At the bottom:
PHP Code:
<!-- body_text_eof //-->
<br>
... allows customers to PRINT by clicking the button.PHP Code:
<!-- body_text_eof //-->
<br /><p><button onclick="printFunction()">Print This Page</button><script>function printFunction(){window.print();}</script></p>
PS: The <br> tag needs closing, surely? <br />
First of all thank you for this add-on. I've installed the add-on as instructed but I get a file not found message when I click on the invoice button. Any ideas why?
Check each of the files in includes and make sure they have in fact uploaded correctly.
Version 1.1 has been uploaded, adding the invoice to the account history page (previously it was just on the my account page).
Version 1.2 has been added for Zen Cart 1.5.6 support.
Hi Scott,
In your latest version it seems that the following file is from ZC V1.5.1Last time I uploaded your great plugin to my site I assumed I'd mucked something up but I've just downloaded a fresh copy so I can update my site to V1.5.7 and I don't think it is me.Quote:
\includes\templates\custom\templates\tpl_account_default.php
Feel free to tell me I'm an idiot if it is me :)
Brent
Yes, you'll want to merge the latest and greatest template updates. Most people have their own customizations so sometimes I don't bother pulling in all those changes - just look at my tweaks and put those in your template. Glad you're benefiting from my stuff!
Thanks Scott. The problem with that file, for anyone who can't code, is that it has no comments which make it clear what your modifications are. I figured it out by downloading Zen Cart V1.5.1 and comparing it to the V1.5.7 so I could see which changes were down to Zen Cart and which were yours. The file in your mod seems to have a version GIT of 1.5.1 but contents from 1.5.5
To make it easier for others coming after me I've sent you a donation so hopefully you can add comments and upload a new 1.5.7 version for the community :)
Much obliged. Catalog invoice has been updated; the template changes are now clearly marked (and the provided template files are from 1.5.7, but it's easy to compare so you can backport.)
Thank you. That has made things much better
:cheers:
I installed this the other day in a store that had 1.5.7 and it was functioning, I upgraded the store to 1.5.7b and it functioned.
Today, on a fresh install of 1.5.7b, when I installed, it causes the client side "My Account" orders to dissappear.
Here is the corresponding log file. I have triple checked to make sure all files uploaded and the template folder named correctly. Please advise any help would be appreciated.
----
[16-Dec-2020 05:17:03 UTC] PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/feadmin/public_html/******/includes/templates/ntobs20/templates/tpl_account_default.php:16
Stack trace:
#0 /home/feadmin/public_html/*****/includes/templates/ntobs20/common/tpl_main_page.php(195): require()
#1 /home/feadmin/public_html/*****/index.php(94): require('/home/feadmin/p...')
#2 {main}
thrown in /home/feadmin/public_html/*****/includes/templates/ntobs20/templates/tpl_account_default.php on line 16
[16-Dec-2020 05:17:03 UTC] Request URI: /index.php?main_page=account, IP address: *****
--> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/feadmin/public_html/*****/includes/templates/ntobs20/templates/tpl_account_default.php:16
Stack trace:
#0 /home/feadmin/public_html/n*****/includes/templates/ntobs20/common/tpl_main_page.php(195): require()
#1 /home/feadmin/public_html/*****/index.php(94): require('/home/feadmin/p...')
#2 {main}
thrown in /home/feadmin/public_html/*****/includes/templates/ntobs20/templates/tpl_account_default.php on line 16.
Seems like your template is looking for "isMobile" functions, but the code providing that feature is not active for your template?
In responsive_classic, the common/main_template_vars.php file provides that.
I’m using the Zca responsive template!
Well, somehow your tpl_account_default.php file is NOT the same as the ZCA template. Where did the "isMobile" stuff on line 16 come from?
Your guess is as good as mine! I did a fresh install of 1.5.7b, added the zca bootstrap 4 template, added the clone mod. Thats it!
What should it be?
I'll also copy the file from the original zca template and replace... I'll report when I do.
I don't use the clone mod, so I'm only guessing that it copied over stuff it shouldn't have.
I downloaded the Catalog Invoice mod, opened the tpl_account_default.php file in the packaged contents.
The "isMobile" content is coming from that file in the catalog invoice tpl file that it replaces.
<?php
/**
* Page Template
*
* Loaded automatically by index.php?main_page=account.<br />
* Displays previous orders and options to change various Customer Account settings
*
* @package templateSystem
* @copyright Copyright 2003-2019 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Scott C Wilson 2019 Jan 14 Modified in v1.5.6b $
*/
?>
<?php
if (!isset($display_as_mobile)) $display_as_mobile = ($detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' or $detect->isTablet() || $_SESSION['layoutType'] == 'tablet');
-----
I removed this from the file, and the mod works as its suppose to:
"if (!isset($display_as_mobile)) $display_as_mobile = ($detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' or $detect->isTablet() || $_SESSION['layoutType'] == 'tablet');"
Better would be to apply just the mod's changes into your own actual template.
Given the mod was made for 156, comparing the mod's template files against 156's template files, it's easy to see exactly what was added .... and then you can simply add those changes to your own template.
That's better than copying the old 156 template into your 157 site, especially into a template that has a lot of other customizations already.
https://share.getcloudapp.com/wbuKzAZ6
https://share.getcloudapp.com/xQuYql4m
how to use logo from admin on invoice instead of logo from shop front end
just installed catalog invoice
zencart 56
php 7.2
Copy the admin logo to the images folder under your template. (call it, say, includes/templates/YOUR_TEMPLATE/images/admin_logo.png or whatever the filetype is).
In invoice.php on line 96, change HEADER_LOGO_IMAGE to the filename you used above ("admin_logo.png").
You don't want to directly link to the image logo- that would reveal the name of your admin.
thank you so much for quick reply
replace code like that
<td class="pageHeading" align="right"><?php echo zen_image($template->get_template_dir(admin_logo.png, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT); ?></td>
</tr>
very strange it is not show up admin_logo.pnp which i just made it . instead of showing zencart logo dont know where is it from this is link
https://www.xxxx.com/shop56c/include...JTEz3omf5M.png
it worked sorry my mistake browser cache problem thanks again
the 1.5.7c upgrade removed the invoice option from the customer side. Anyone know of a fix?
Reinstall my plugin. :)
I reinstalled and along with a blank "My Account" page, I get the following error:
[25-Jun-2021 23:05:12 UTC] PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /includes/templates/ntobs20/templates/tpl_account_default.php:16
Stack trace:
#0 /includes/templates/ntobs20/common/tpl_main_page.php(195): require()
#1 /index.php(94): require('/home/feadmin/p...')
#2 {main}
thrown in /includes/templates/ntobs20/templates/tpl_account_default.php on line 16
[25-Jun-2021 23:05:12 UTC] Request URI: /index.php?main_page=account, IP address: xxxxxx
--> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /includes/templates/ntobs20/templates/tpl_account_default.php:16
Stack trace:
#0 /includes/templates/ntobs20/common/tpl_main_page.php(195): require()
#1 /index.php(94): require('/home/...')
#2 {main}
thrown in /includes/templates/ntobs20/templates/tpl_account_default.php on line 16.
The template file provided was based on responsive_classic. If you don't use responsive_classic, make the relevant changes to your own template file.
- Compare what I gave you to what's in responsive classic.
- Apply those changes to your template file.
Thank you. So the only element I moved from your file to my template file was this line
<!-- Invoice -->
<td class="accountOrderViewButton alignRight"><?php echo '<a href="' . FILENAME_INVOICE . '.php?oID=' . $orders['orders_id'] . '" target="_blank">' . zen_image_button(BUTTON_IMAGE_INVOICE_SMALL, BUTTON_INVOICE_SMALL_ALT) . '</a>' . ' '; ?></td>
and it enabled the mod to function correctly.
Is there a way to change the invoice link in the email sent out to the customer so that it uses this new invoice page?
At present it goes to the entirely unsatisfactory account history page.
I think the change has to go into classes/order.php somewhere a bit after line 1000 but I'm not sure what or where
In includes/classes/order.php look for the line saying
EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
it's on line 1069 in 1.5.7c. Just adjust that to point to FILENAME_INVOICE instead.
Yep, you're right.
Instead of
zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false)
use something like
HTTPS_SERVER . DIR_WS_CATALOG . 'invoice.php?order_id='.$zf_insert_id
There was a bug in file inclusion in invoice.php that has been fixed.
Great plug-in, essential for my daughter's (very) small wholesale business where all her stockists pay by invoice.
Zencart v 1.5.7c
Minor bug, I noticed that invoice "date added" was showing DATE_TIME_FORMAT instead of date added.
This has apparently affected some other plugins.
The lines below have been removed from includes/languages/english.php in 1.5.7
define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
Adding them cured it.
Thanks. Will update next time.
Has anyone yet ported the changes from the new 1.5.8 version ofover toHTML Code:/admin/invoice.php
The latest version in the plugin is based onHTML Code:/invoice.php
and the version in 1.5.8 has changed substantiallyCode:@version $Id: DrByte 2020 May 20 Modified in v1.5.7 $
I tried to port the changes over but there have been too many revisions in the area where the revised code needs to be inserted.Code:@version $Id: Scott C Wilson 2022 Sep 17 Modified in v1.5.8 $
Help needed please :)
I will update this mod shortly.
Thank you. I will buy you a cup of coffee.
OK an update has been submitted for 1.5.8.
https://www.zen-cart.com/downloads.php?do=file&id=2111
The CSS needs some tweaking; I'll do that as soon as I can.
Thanks for this Scott. Been testing for you and here is my feedback.
If I want to turn off images should I hard code the setting in \invoice.php? The new override settings that work with admin\invoice.php won't be pulled through.
The latest version works in PHP 7.4 but fails in PHP 8.0
I fixed this by adding entries to my \includes\languages\english\lang.invoice.php file but don't know if this is the best way or if the error was caused by some other issue I have.Code:[05-Feb-2023 14:11:26 Europe/London] PHP Fatal error: Uncaught Error: Undefined constant "TABLE_HEADING_PRICE_EXCLUDING_TAX" in /invoice.php:214
Stack trace:
#0 {main}
thrown in /invoice.php on line 214
[05-Feb-2023 14:11:26 Europe/London] Request URI: /store158/invoice.php?oID=31848, IP address: 77.108.141.0
--> PHP Fatal error: Uncaught Error: Undefined constant "TABLE_HEADING_PRICE_EXCLUDING_TAX" in /invoice.php:214
Stack trace:
#0 {main}
thrown in /invoice.php on line 214.
You also have two old files in your latest update. I have ported the changes across my end but so this is just for other users.Code:'TABLE_HEADING_PRICE_EXCLUDING_TAX' => 'Price (excl)',
'TABLE_HEADING_PRICE_INCLUDING_TAX' => 'Price (incl)',
'TABLE_HEADING_TOTAL_EXCLUDING_TAX' => 'Total (excl)',
'TABLE_HEADING_TOTAL_INCLUDING_TAX' => 'Total (incl)',
Firstly
This is usingQuote:
\includes\templates\custom\templates\tpl_account_default.php
and the latest version isQuote:
@version $Id: Scott C Wilson 2019 Jan 14 Modified in v1.5.6b $
SecondlyQuote:
@version $Id: lat9 2022 May 26 Modified in v1.5.8-alpha $
Is based onQuote:
\includes\templates\custom\templates\tpl_account_history_default.php
but the latest version isQuote:
@version $Id: Author: DrByte Sat Jan 9 13:13:41 2016 -0500 Modified in v1.5.5 $
Quote:
@version $Id: lat9 2022 Jul 23 Modified in v1.5.8-alpha2 $
Language file changes are correct - I'll add on the next update.
The template changes are really just an example - you have to merge the changes into your own template files.
I understand that. It was more a notification for other users as they will see 1.5.8 ready and make assumptions. I got caught out by this when I started on this journey. Hard for someone who reads and writes code to understand :smile:
For anyone trying to remove images changing line 44 in /invoice.php did the trick for me.
Code:$show_product_images = $show_product_images ?? false;
css was referencing files that weren't included; this has been fixed in the latest update.
When I click on the invoice button and the customer has purchased 1 item, the invoice is mixed up. If multiple items have been purchased, everything will work fine.
How is this possible, bug?
Using zen cart version 1.5.8a
Dirk
Can you be more specific about what you mean when you say everything is mixed up? Screenshot perhaps?
Attachment 20793Attachment 20794
First is one item ordered and second one is two items.
As you can see the layout is different (not everything is mixed up).
This seems to be related to the order, not the number of items. No idea; does the regular admin orders page have the same layout?
I'm not a programmer or anything so I don't know how to solve this. Any help is welcome. I have already restored a backup of invoice.php to the admin folder with no results.
> Yes it does.
Then the issue maybe fixed by upgrading.
?
Upgrading to version 2.0.x?
Hello,
I wanted a print button to print the invoice. There were a number of conditions I wanted to meet. 1) The print button was not allowed to be printed. 2) no header and footer of the (html) page were allowed to be printed.
Below is the solution:
Place the following code in the invoice.php file (under line 89), or just before </head>:
Then insert on line 118, just before </table> the next line:Code:<style type="text/css">
@media print {
.noPrint{
display:none;
}
}
@page {
margin-left: 0.5in;
margin-right: 0.5in;
margin-top: 0;
margin-bottom: 0;
}
</style>
Save the file and open the file includes\languages\english\lang.meta_tags.php (or your language file) and add:Code:<div class"noPrint"><button onclick="window.print();" class="noPrint"><?php echo TEXT_INVOICE_PRINT_BUTTON; ?></button></div>
There is now a button in the invoice that allows you to print the invoice directly.Code:'TEXT_INVOICE_PRINT_BUTTON' => 'Print invoice',
Dirk
HI, just tried installing this in 2.1.0. (bootstrap template) an a Ubuntu 24.04 VM PHP v8.3
I get a blank page when clicking on "My account".
No big deal, although I found this plug-in useful, I can live without it.
Not good enough a programmer to figure out why.
Blank page can ALWAYS be resolved quite easily. Follow the tips here and help us guide you on how to resolve it - it's usually a very simple file change needed that you may have missed or skipped.
Removing line 16 in tpl_account_default.php fixes it, but of course that stops it being responsive.
This actually makes perfect sense... You should NEVER simply overwrite the existing files, but should instead merge your files with the ones that are provided by any plugin. You can use WinMerge or BeyondCompare or any other software to highlight the differences if you can't spot them manually.
If you're using the Bootstrap template, line 16 is a closing php tag. My guess is you just added the file that comes with the plugin (which is based on responsive_classic template) and that file killed the page because it's just not compatible with the Bootstrap template.
I haven't tested it, but I believe your file (includes/templates/bootstrap/templates/tpl_account_default.php) should look something like this (new code highlighted in red):
Code:<?php
/**
* Page Template
*
* BOOTSTRAP v3.7.1
*
* Loaded automatically by index.php?main_page=account.<br />
* Displays previous orders and options to change various Customer Account settings
*
* @package templateSystem
* @copyright Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Author: DrByte Fri Jan 8 00:33:36 2016 -0500 Modified in v1.5.5 $
*/
?>
<div id="accountDefault" class="centerColumn">
<h1 id="accountDefault-pageHeading" class="pageHeading"><?= HEADING_TITLE ?></h1>
<?php
if ($messageStack->size('account') > 0) {
echo $messageStack->output('account');
}
?>
<div class="card-deck mb-3">
<!--bof my account card links-->
<div id="myAccount-card" class="card">
<h4 id="myAccount-card-header" class="card-header"><?= MY_ACCOUNT_TITLE ?></h4>
<div id="myAccount-card-body" class="card-body p-3">
<ul id="myAccount-list-group" class="list-group list-group-flush">
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'), MY_ACCOUNT_INFORMATION) ?>
</li>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'), MY_ACCOUNT_ADDRESS_BOOK) ?>
</li>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_PASSWORD, '', 'SSL'), MY_ACCOUNT_PASSWORD) ?>
</li>
</ul>
</div>
</div>
<!--eof my account card links-->
<?php
if ((int)ACCOUNT_NEWSLETTER_STATUS > 0 || CUSTOMERS_PRODUCTS_NOTIFICATION_STATUS !== '0') {
?>
<!--bof email notifications card links-->
<div id="emailNotifications-card" class="card">
<h4 id="emailNotifications-card-header" class="card-header"><?= EMAIL_NOTIFICATIONS_TITLE ?></h4>
<div id="emailNotifications-card-body" class="card-body p-3">
<ul id="emailNotifications-list-group" class="list-group list-group-flush">
<?php
if ((int)ACCOUNT_NEWSLETTER_STATUS > 0) {
?>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL'), EMAIL_NOTIFICATIONS_NEWSLETTERS) ?>
</li>
<?php
} //endif newsletter unsubscribe
if (CUSTOMERS_PRODUCTS_NOTIFICATION_STATUS === '1') {
?>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'), EMAIL_NOTIFICATIONS_PRODUCTS) ?>
</li>
<?php
} //endif product notification
?>
</ul>
</div>
</div>
<!--bof email notifications card links-->
<?php
} // endif don't show unsubscribe or notification
?>
</div>
<?php
// only show when there is a GV balance
if ($customer_has_gv_balance) {
require $template->get_template_dir('tpl_modules_send_or_spend.php', DIR_WS_TEMPLATE, $current_page_base, 'templates') . '/tpl_modules_send_or_spend.php';
}
if (count($ordersArray) !== 0) {
?>
<!--bof previous orders card -->
<div id="previousOrders-card" class="card mb-3">
<h4 id="previousOrders-card-header" class="card-header"><?= OVERVIEW_PREVIOUS_ORDERS ?></h4>
<div id="previousOrders-card-body" class="card-body p-3">
<div id="previousOrders-helpLink" class="helpLink text-right p-3">
<a href="<?= zen_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') ?>"><?= OVERVIEW_SHOW_ALL_ORDERS ?></a>
</div>
<div class="card-deck">
<?php
foreach ($ordersArray as $orders) {
$order_link = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL');
?>
<div class="card">
<div class="card-header text-center">
<a class="orderIdCell" href="<?= $order_link ?>"><?= TEXT_NUMBER_SYMBOL . $orders['orders_id'] ?></a>
</div>
<div class="card-body text-center">
<ul class="list-group list-group-flush">
<li class="list-group-item dateCell border-0 p-1"><?= zen_date_short($orders['date_purchased']) ?></li>
<li class="list-group-item shipToCell border-0 p-1"><?= zen_output_string_protected($orders['order_name']) . '<br>' . $orders['order_country'] ?></li>
<li class="list-group-item statusCell border-0 p-1"><?= $orders['orders_status_name'] ?></li>
<li class="list-group-item border-0 p-1"><?= $orders['order_total'] ?></li>
</ul>
</div>
<div class="card-footer text-center">
<?= zca_button_link($order_link, BUTTON_VIEW_SMALL_ALT, 'button_view') ?>
<br>
<?= '<a href="' . FILENAME_INVOICE . '.php?oID=' . $orders['orders_id'] . '" target="_blank">' . zen_image_button(BUTTON_IMAGE_INVOICE_SMALL, BUTTON_INVOICE_SMALL_ALT) . '</a>' . ' '; ?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<!--eof previous orders card -->
<?php
}
?>
</div>
Thanks again..
I didn't realise that the file would be overwritten, should have read the doc more carefully.
I used meld to compare files when upgrading from 1.5.7c after removing any add-ons, but then I decided to do a fresh installation of 2.1.0 in a VM and apply bootstrap before importing data, images and text to the pages I had changed, then apply add-ons one at a time, taking snapshots before each, to see if there were any problems.
I had not actually made many changes, and the only add-ons I wanted to add were invoice payment and catalog invoice. (I had installed edit orders and zx-slideshow but I deemed them no longer needed). These days I tend to avoid coding, as my ageing brain struggles with it.:)
That change seems to work fine, should I make changes to the tpl_account_history_default.php file as well?
Comparing them in meld they look very different, although the overwritten one seems to work OK.
Yes, you should definitely restore the file from the Bootstrap template and add the one line of code for the invoice plugin, just make sure you place it in an appropriate location.
Thank you so much for your help.
I have added this at line 30, it seems to be working fine.
<!-- Invoice -->
<div class="content forward"><?php echo '<a href="' . FILENAME_INVOICE . '.php?oID=' . $history['orders_id'] . '">' . zen_image_button(BUTTON_IMAGE_INVOICE_SMALL, BUTTON_INVOICE_SMALL_ALT) . '</a>'; ?></div>
A few more minor tweaks to the site and it will be ready to go live.
oops. line 54
Set up my new site, but the invoices generated have no products or prices information between the header and the customer details.
Ubuntu server 24.04.2, php8.3, zencart 2.1.0.
Log file shows:
log [22-Feb-2025 11:22:42 UTC] Request URI: /invoice.php?oID=273, IP address: 192.168.0.254, Language id 1
#0 /var/www/html/xxxx.co.uk/invoice.php(72): zen_debug_error_handler()
--> PHP Warning: Trying to access array offset on false in /var/www/html/xxxx/invoice.php on line 72.
Plus: (xxxx replacing domain id)
[22-Feb-2025 11:11:10 UTC] PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, false given in /var/www/html/xxxx.co.uk/includes/functions/functions_addresses.php:309
Stack trace:
#0 /var/www/html/xxxx.co.uk/includes/functions/functions_addresses.php(309): array_merge()
#1 /var/www/html/xxxx.co.uk/invoice.php(151): zen_address_format()
#2 {main}
thrown in /var/www/html/xxxx.co.uk/includes/functions/functions_addresses.php on line 309
Should I wait until this is updated to 2.1?
I reckon so.
Thanks for the reply.
Sorry that I don't know enough to help.
Just tested on Zen Cart 2.1.0; looks fine to me. Not sure what the issue on your site is.
Thanks for letting me know.
Not sure either, it generates an invoice, but only the header and footer show, the products are not listed.
I will try it again on my test VM.
I am using the bootstrap template, only other add-on is your invoice payment one.
It seems to be a problem with this statement in invoice.php:
I assume that is comparing billing and shipping addressesCode:$show_customer = false;
if ($order->billing['name'] != $order->delivery['name']) {
$show_customer = true;
}
logs show multiple errors in includes/functions/functions_addresses.php
I have store pickup enabled, could that be causing the problem?
Could be - I will try that.
Fixed. Thanks for providing these details.
Thank you! now working fine.
I try to keep things simple as my daughter's business is a very small one person enterprise, based in Cornwall and supplying small independent shops in the county.
Zencart makes things a lot easier for her.
I am retired, and at 72, things don't come quite as easily as they used to. Glad I could contribute.
Actually I inserted that line at line 60.
Summary for anyone else wanting to use this plug-in with 2.1.0 and bootstrap:
(the blank invoice was down to my own misunderstanding, but the new version doesn't throw errors)
edit for includes/templates/bootstrap/templates/tpl_account_default.php
Edit for includes/templates/bootstrap/templates/tpl_account_history_default.phpCode:<?php
/**
* Page Template
*
* BOOTSTRAP v3.7.1
*
* Loaded automatically by index.php?main_page=account.<br />
* Displays previous orders and options to change various Customer Account settings
*
* @package templateSystem
* @copyright Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Author: DrByte Fri Jan 8 00:33:36 2016 -0500 Modified in v1.5.5 $
*/
?>
<div id="accountDefault" class="centerColumn">
<h1 id="accountDefault-pageHeading" class="pageHeading"><?= HEADING_TITLE ?></h1>
<?php
if ($messageStack->size('account') > 0) {
echo $messageStack->output('account');
}
?>
<div class="card-deck mb-3">
<!--bof my account card links-->
<div id="myAccount-card" class="card">
<h4 id="myAccount-card-header" class="card-header"><?= MY_ACCOUNT_TITLE ?></h4>
<div id="myAccount-card-body" class="card-body p-3">
<ul id="myAccount-list-group" class="list-group list-group-flush">
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'), MY_ACCOUNT_INFORMATION) ?>
</li>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'), MY_ACCOUNT_ADDRESS_BOOK) ?>
</li>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_PASSWORD, '', 'SSL'), MY_ACCOUNT_PASSWORD) ?>
</li>
</ul>
</div>
</div>
<!--eof my account card links-->
<?php
if ((int)ACCOUNT_NEWSLETTER_STATUS > 0 || CUSTOMERS_PRODUCTS_NOTIFICATION_STATUS !== '0') {
?>
<!--bof email notifications card links-->
<div id="emailNotifications-card" class="card">
<h4 id="emailNotifications-card-header" class="card-header"><?= EMAIL_NOTIFICATIONS_TITLE ?></h4>
<div id="emailNotifications-card-body" class="card-body p-3">
<ul id="emailNotifications-list-group" class="list-group list-group-flush">
<?php
if ((int)ACCOUNT_NEWSLETTER_STATUS > 0) {
?>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL'), EMAIL_NOTIFICATIONS_NEWSLETTERS) ?>
</li>
<?php
} //endif newsletter unsubscribe
if (CUSTOMERS_PRODUCTS_NOTIFICATION_STATUS === '1') {
?>
<li class="list-group-item">
<?= zca_button_link(zen_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'), EMAIL_NOTIFICATIONS_PRODUCTS) ?>
</li>
<?php
} //endif product notification
?>
</ul>
</div>
</div>
<!--bof email notifications card links-->
<?php
} // endif don't show unsubscribe or notification
?>
</div>
<?php
// only show when there is a GV balance
if ($customer_has_gv_balance) {
require $template->get_template_dir('tpl_modules_send_or_spend.php', DIR_WS_TEMPLATE, $current_page_base, 'templates') . '/tpl_modules_send_or_spend.php';
}
if (count($ordersArray) !== 0) {
?>
<!--bof previous orders card -->
<div id="previousOrders-card" class="card mb-3">
<h4 id="previousOrders-card-header" class="card-header"><?= OVERVIEW_PREVIOUS_ORDERS ?></h4>
<div id="previousOrders-card-body" class="card-body p-3">
<div id="previousOrders-helpLink" class="helpLink text-right p-3">
<a href="<?= zen_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') ?>"><?= OVERVIEW_SHOW_ALL_ORDERS ?></a>
</div>
<div class="card-deck">
<?php
foreach ($ordersArray as $orders) {
$order_link = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL');
?>
<div class="card">
<div class="card-header text-center">
<a class="orderIdCell" href="<?= $order_link ?>"><?= TEXT_NUMBER_SYMBOL . $orders['orders_id'] ?></a>
</div>
<div class="card-body text-center">
<ul class="list-group list-group-flush">
<li class="list-group-item dateCell border-0 p-1"><?= zen_date_short($orders['date_purchased']) ?></li>
<li class="list-group-item shipToCell border-0 p-1"><?= zen_output_string_protected($orders['order_name']) . '<br>' . $orders['order_country'] ?></li>
<li class="list-group-item statusCell border-0 p-1"><?= $orders['orders_status_name'] ?></li>
<li class="list-group-item border-0 p-1"><?= $orders['order_total'] ?></li>
</ul>
</div>
<div class="card-footer text-center">
<?= zca_button_link($order_link, BUTTON_VIEW_SMALL_ALT, 'button_view') ?>
<br>
<?= '<a href="' . FILENAME_INVOICE . '.php?oID=' . $orders['orders_id'] . '" target="_blank">' . zen_image_button(BUTTON_IMAGE_INVOICE_SMALL, BUTTON_INVOICE_SMALL_ALT) . '</a>' . ' '; ?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<!--eof previous orders card -->
<?php
}
?>
</div>
Code:<?php
/**
* Page Template
*
* BOOTSTRAP v3.5.0
*
* Loaded automatically by index.php?main_page=account_history.<br />
* Displays all customers previous orders
*
* @package templateSystem
* @copyright Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Author: DrByte Sat Jan 9 13:13:41 2016 -0500 Modified in v1.5.5 $
*/
?>
<div id="accountHistoryDefault" class="centerColumn">
<h1 id="accountHistoryDefault-pageHeading" class="pageHeading"><?php echo HEADING_TITLE; ?></h1>
<?php
if ($accountHasHistory === true) {
$page_parameter = (isset($_GET['page'])) ? ('page=' . (int)$_GET['page'] . '&') : '';
foreach ($accountHistory as $history) {
?>
<!--bof order history card-->
<div id="order<?php echo $history['orders_id']; ?>-card" class="card mb-3">
<h4 id="order<?php echo $history['orders_id']; ?>-card-header" class="card-header"><?php echo TEXT_ORDER_NUMBER . $history['orders_id']; ?></h4>
<div id="order<?php echo $history['orders_id']; ?>-card-body" class="card-body p-3">
<div class="row">
<div class="col-sm text-right">
<?php echo TEXT_ORDER_STATUS . $history['orders_status_name']; ?>
</div>
</div>
<div class="row">
<div class="col-sm">
<?php echo '<strong>' . TEXT_ORDER_DATE . '</strong> ' . zen_date_long($history['date_purchased']); ?>
</div>
<div class="col-sm">
<?php echo '<strong>' . TEXT_ORDER_PRODUCTS . '</strong> ' . $history['product_count']; ?>
</div>
</div>
<div class="row">
<div class="col-sm">
<?php echo '<strong>' . $history['order_type'] . '</strong> ' . zen_output_string_protected($history['order_name']); ?>
</div>
<div class="col-sm">
<?php echo '<strong>' . TEXT_ORDER_COST . '</strong> ' . strip_tags($history['order_total']); ?>
</div>
</div>
<div id="order<?php echo $history['orders_id']; ?>-btn-toolbar" class="btn-toolbar justify-content-end my-3" role="toolbar">
<?php echo zca_button_link(zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, $page_parameter . 'order_id=' . $history['orders_id'], 'SSL'), BUTTON_VIEW_SMALL_ALT, 'button_view'); ?>
</div>
</div>
</div>
<!--eof order history card-->
<!-- Invoice -->
<div class="content forward"><?php echo '<a href="' . FILENAME_INVOICE . '.php?oID=' . $history['orders_id'] . '">' . zen_image_button(BUTTON_IMAGE_INVOICE_SMALL, BUTTON_INVOICE_SMALL_ALT) . '</a>'; ?></div>
<?php
}
?>
<div id="accountHistoryDefault-bottomRow" class="row">
<div id="accountHistoryDefault-bottomNumber" class="bottomNumber col-sm">
<?php echo $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS); ?>
</div>
<div id="accountHistoryDefault-bottomLinks" class="bottomLinks col-sm">
<?php echo TEXT_RESULT_PAGE . $history_split->display_links($max_display_page_links, zen_get_all_get_params(['page', 'info', 'x', 'y', 'main_page']), $paginateAsUL); ?>
</div>
</div>
<?php
} else {
?>
<div id="noAccountHistoryDefault" class="centerColumn">
<div id="noAccountHistoryDefault-content" class="content">
<?php echo TEXT_NO_PURCHASES; ?>
</div>
</div>
<?php
}
?>
<div id="accountHistoryDefault-btn-toolbar" class="btn-toolbar my-3" role="toolbar">
<?php echo zca_button_link(zen_href_link(FILENAME_ACCOUNT, '', 'SSL'), BUTTON_BACK_ALT, 'button_back'); ?>
</div>
</div>