Zen Cart Logo
Forums / All Other Contributions/Addons / Catalog Invoice Support Thread

Catalog Invoice Support Thread

Views: 18,566

Results 1 to 20 of 77
3 Dec 2016, 11:45 AM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Catalog Invoice Support Thread

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

30 Dec 2016, 10:30 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

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 ?

<?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));
  }
}

Additionally - and for interest's sake, I added a JS print function to the end of the main invoice.php file

At the bottom:

<!-- body_text_eof //-->

<br>
<!-- body_text_eof //-->

<br /><p><button onclick="printFunction()">Print This Page</button><script>function printFunction(){window.print();}</script></p>

... allows customers to PRINT by clicking the button.

PS: The <br> tag needs closing, surely? <br />

30 Dec 2016, 10:43 PM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Catalog Invoice Support Thread

schoolboy:

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 ?

Modify DATE_TIME_FORMAT in includes/languages/<YOUR_TEMPLATE>/english.php

13 Jul 2017, 8:03 AM
#4
beto_pu avatar

beto_pu

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

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?

13 Jul 2017, 3:18 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Catalog Invoice Support Thread

Check each of the files in includes and make sure they have in fact uploaded correctly.

1 Jan 2018, 4:32 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Catalog Invoice Support Thread

Version 1.1 has been uploaded, adding the invoice to the account history page (previously it was just on the my account page).

28 Jan 2019, 9:46 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Catalog Invoice Support Thread

Version 1.2 has been added for Zen Cart 1.5.6 support.

5 Sep 2020, 3:28 PM
#8
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Location:
United Kingdom
Posts:
606
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

Hi Scott,

In your latest version it seems that the following file is from ZC V1.5.1 > \includes\templates\custom\templates\tpl_account_default.php Last 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.

Feel free to tell me I'm an idiot if it is me :)

Brent

5 Sep 2020, 6:06 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Catalog Invoice Support Thread

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!

6 Sep 2020, 7:41 AM
#10
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Location:
United Kingdom
Posts:
606
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

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 :)

6 Sep 2020, 12:42 PM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: Catalog Invoice Support Thread

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.)

6 Sep 2020, 1:09 PM
#12
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Location:
United Kingdom
Posts:
606
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

Thank you. That has made things much better
:cheers:

16 Dec 2020, 5:24 AM
#13
carbonless avatar

carbonless

Zen Follower

Join Date:
Jan 2007
Location:
Illinois, USA
Posts:
329
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

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.

16 Dec 2020, 6:23 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Catalog Invoice Support Thread

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.

16 Dec 2020, 5:05 PM
#15
carbonless avatar

carbonless

Zen Follower

Join Date:
Jan 2007
Location:
Illinois, USA
Posts:
329
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

I’m using the Zca responsive template!

16 Dec 2020, 6:45 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Catalog Invoice Support Thread

Carbonless:

[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

Carbonless:

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?

16 Dec 2020, 11:26 PM
#17
carbonless avatar

carbonless

Zen Follower

Join Date:
Jan 2007
Location:
Illinois, USA
Posts:
329
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

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.

17 Dec 2020, 12:28 AM
#18
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Catalog Invoice Support Thread

I don't use the clone mod, so I'm only guessing that it copied over stuff it shouldn't have.

17 Dec 2020, 8:45 AM
#19
carbonless avatar

carbonless

Zen Follower

Join Date:
Jan 2007
Location:
Illinois, USA
Posts:
329
Plugin Contributions:
0

Re: Catalog Invoice Support Thread

DrByte:

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?

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');"
17 Dec 2020, 8:22 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Catalog Invoice Support Thread

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