Forums / Addon Language Packs / Fatal error in credit_cards.php

Fatal error in credit_cards.php

Locked

Started by philmck on 30 Jun 2006, 12:50 PM · Views: 9,880

Results 1 to 20 of 22
This thread is locked. New replies are disabled.
30 Jun 2006, 12:50 PM
#1
philmck avatar

philmck

Inactive

Join Date:
Jul 2005
Posts:
33
Plugin Contributions:
0

Fatal error in credit_cards.php

This is a strange one! When I put something in my cart and try to checkout (from a ZenCart installation v1.3.0.2 on https://www.skeptic.org.uk/shop) I get the following error:

Fatal error: Call to a member function on a non-object in [zen cart installation]/includes/languages/english/credit_cards.php on line 57

The strange thing is, I consistently see the error when I do this from a particular location (work) but when I tried to reproduce the problem at home it worked perfectly. This is completely reproducible, not intermittent.

Even more interesting, if I connect from work via a proxy the problem disappears. So it's not simply a problem with the software on my work PC (Win2k, IE6 SP1), nor with the time of day or cookies. It seems it must be a speed or firewall issue.

30 Jun 2006, 12:56 PM
#2
philmck avatar

philmck

Inactive

Join Date:
Jul 2005
Posts:
33
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

More information:

I installed Firefox and tried that and the problem disappeared. So I tried clearing the cache in IE6 and that made no difference. But clearing cookies in IE6 DID apparently fix the problem. So it appears it was a cookie problem after all (maybe I should change the title of this thread?).

So, the question is, how was the bad cookie created, and why wasn't the error recoverable? Sadly I don't think I can recover the offending cookie now but if the problem recurs I will post it.

30 Jun 2006, 8:18 PM
#3
drbyte avatar

drbyte

Sensei

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

Re: Fatal error in credit_cards.php

  1. What addons/contributions do you have installed?
  2. It's likely referring to the $template object, which is not (normally) set based on anything cookie-related, unless you have some sort of multi-template-handling addon etc installed.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Jul 2006, 2:33 PM
#4
philmck avatar

philmck

Inactive

Join Date:
Jul 2005
Posts:
33
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

I don't have any template handling addons installed. The template I use is copied from "classic", with only minor modifications, most notably the charset is changed to utf-8, the width changed to 100%, the colour changed to blue and metric units (kg instead of lbs) used throughout.

I've also modified the e-mail templates to remove links to graphics (because they get blocked by mail clients such as Outlook) but I don't think they're involved in any way here.

The only addon module I have installed is "order_total", for applying discounts based on the total number of items in the cart. I don't think that would have been invoked yet at this stage of the checkout process.

I wonder if the bad cookie was an old one left over from a previous version of Zen Cart? I don't normally access the cart from work so it's possible the cookie was quite old.

5 Nov 2006, 4:24 PM
#5
philmck avatar

philmck

Inactive

Join Date:
Jul 2005
Posts:
33
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

The error is back! And this time none of the solutions I mentioned above work. Help!

(It's happening consistently on three different installations)

The line that produces the error is:
define('IMAGE_CC_ENABLED_VISA', zen_image($template->get_template_dir('cc1.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc1.gif'));

5 Nov 2006, 4:45 PM
#6
philmck avatar

philmck

Inactive

Join Date:
Jul 2005
Posts:
33
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

Update - after clearing ALL cookies in BOTH IE6 and Firefox the problem went away again. Hmm.

13 Aug 2007, 1:35 PM
#7
kalazaar avatar

kalazaar

New Zenner

Join Date:
Jul 2007
Location:
West Aussie Land
Posts:
5
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

I'm getting the same error intermittantly, with the credit_cards.php file listed in the error message. It's not just happening to me, its also happening to a large number of customers. Is there a fix for this, or any idea's on why its happening?

Quite disheartened as I love the zen cart, however, I can't use it if my customers can't access the site.

Of those customers that I know are trying to access the site, I'd say close on 50% of them are unable to and it's not one single network causing the problem, as they are all connecting from various countries. (Previously worked for an ISP so checked that.)

Clearing cookies and cache does solve the problem, however, those that are visiting from a search engine link, I can't tell them that, they believe the site is down, and continue on their way.

the site can be found at http://www.timerealms.net/thyme4you

running ver 1.3.7

I've checked the other thread, with the sessions.php fix in it, and this is already present in the code.

Kara's Kollection http://karaskollection.com.au

2 Oct 2007, 8:46 PM
#8
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

if there is another file calling another template then what can be done?

Fatal error: Call to a member function get_template_dir() on a non-object

12 Feb 2009, 11:25 AM
#9
fragha avatar

fragha

New Zenner

Join Date:
Feb 2009
Posts:
5
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

Hello there.
I just installed the portuguese language pack, and when i choose the portuguese language in the dropdown menu in admin pannel, i get this same error:
Fatal error: Call to a member function get_template_dir() on a non-object in (...)/admin/includes/languages/portugues/credit_cards.php on line 46

The file is there, both in the /admin/includes/languages/portugues and includes/languages/portugues. Any help?

Ps: I can work in the admin panel with no problems in english, but is annoying...

12 Feb 2009, 3:18 PM
#10
drbyte avatar

drbyte

Sensei

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

Re: Fatal error in credit_cards.php

The admin language files should not include a credit_cards.php file, nor any code that tries to load it.
The credit_cards.php file is for the store-front only.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 Feb 2009, 10:06 AM
#11
fragha avatar

fragha

New Zenner

Join Date:
Feb 2009
Posts:
5
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

Thanks for answering.

Still, with or without that file, the error persists. Now i can't even enter the admin panel due to that error... and had to reinstall zencart :(

13 Feb 2009, 10:53 AM
#12
fragha avatar

fragha

New Zenner

Join Date:
Feb 2009
Posts:
5
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

After reinstalling zen-cart, and when I installed the portuguese pack, i got the same error, and was unable to access the admin area.

This is what i did:

  1. Installed zen-cart with fantastico.
  2. Uploaded the portuguese pack via ftp and extracted it in admin/includes/languages and includes/languages
  3. went to admin panel and added portuguese language
  4. the site is ok, i can choose the portuguese language and everything is translated, but afterwards, when i try to enter the admin area, i get this credit card error.

I managed to solve this though, deleting the portuguese pack from admin/includes/languages and duplicating the english language files and renaming the files. Now i have portuguese and english directories, althought they are all english files. It worked, and i don't mind having the admin section in english, but i think it is a serious error that most people can't have.
Can it bebecause the language pack is for version 1.3.7 and i have 1.3.8 installed?

13 Feb 2009, 7:22 PM
#13
drbyte avatar

drbyte

Sensei

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

Re: Fatal error in credit_cards.php

Fragha:

Can it bebecause the language pack is for version 1.3.7 and i have 1.3.8 installed?
No. It sounds like a bad language pack, where the admin portuguese.php file is not actually the admin version of the file, but is really the catalog/storefront version.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Feb 2009, 12:45 PM
#14
fragha avatar

fragha

New Zenner

Join Date:
Feb 2009
Posts:
5
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

Is there a way i can try and solve this problem?

16 Feb 2009, 12:47 PM
#15
drbyte avatar

drbyte

Sensei

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

Re: Fatal error in credit_cards.php

yes ... re-translate the admin portuguese.php file using the original english version of it

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 Mar 2009, 8:34 PM
#16
zola avatar

zola

New Zenner

Join Date:
Mar 2009
Posts:
7
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

DrByte:

yes ... re-translate the admin portuguese.php file using the original english version of it

That isn't the actual problem, there is indeed a bug (I ran into myself today.) Mine is English language, but if the portuguese core files are the same, it's going to be the same. I originally wasn't too concerned since I'm adding some personalized functions to my installation, but even after I reverted, the problem remained so I came looking.

The choke occurs here:

Fatal error: Call to a member function on a non-object in /home/content/z/o/l/zolaweb/html/zencart/includes/languages/english/credit_cards.php on line 46

The issue is that the object $template doesn't exist

That being said, $template should have been created, it gets called earlier in the code without puking, so I'm digging through to see where it gets unset/lost whatever.

I will report back later today with more details and hopefully a fix.

7 Mar 2009, 9:13 PM
#17
drbyte avatar

drbyte

Sensei

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

Re: Fatal error in credit_cards.php

If you're referring to an error message occurring in the admin, then you have the wrong language file in your admin folder. THAT is what the last poster was dealing with.

If YOU are getting an error on the storefront side then yes, you've got a problem somewhere that's preventing the $template object from being created properly. However, a clean new install of v1.3.8 with just english language, properly instantiates the $template object.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Mar 2009, 6:35 PM
#18
zola avatar

zola

New Zenner

Join Date:
Mar 2009
Posts:
7
Plugin Contributions:
0

Re: Fatal error in credit_cards.php

DrByte:

If you're referring to an error message occurring in the admin, then you have the wrong language file in your admin folder. THAT is what the last poster was dealing with.

If YOU are getting an error on the storefront side then yes, you've got a problem somewhere that's preventing the $template object from being created properly. However, a clean new install of v1.3.8 with just english language, properly instantiates the $template object.

The original template is untouched, I was doing overrides. I removed the overrides and was still getting the error.

I tracked it back to some kind of issue with the session. Apparently my old session was held despite my removing the questionable page, and the error was being produced in some fashion by the old session. So the solution is actually to clear your session, which you can do with php--copy the following code, put it into a page (name it something like kill_session.php) and upload it to the same domain, and visit it in your browser.

<?php
session_destroy();
?>

Hopefully this will at least avoid someone having to reinstall the entire app.

As an aside, oddly enough, there turned out to be nothing wrong with the page I wrote, either--I put it back up and it worked perfectly, so it may just have been session corruption or a bad db upload.

As I work with the installation, I will see if I can reliably reproduce it in such a way that it becomes clearer as to exactly when it happens--it's obviously one of those esoteric type bugs that only occur when the moon is full, the temperature is about 70 degrees and the current day has an "s" in it... :D

9 Mar 2009, 6:24 AM
#19
drbyte avatar

drbyte

Sensei

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

Re: Fatal error in credit_cards.php

Clearing browser cookies and restarting the browser typically disconnects the browser from any open sessions as well.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 May 2009, 10:14 AM
#20
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Fatal error in credit_cards.php

In my case I am getting an error message:

Fatal error: Call to a member function get_template_dir() on a non-object in /home/16602/adseddon/www.starlessriver.com/public_html/shop/includes/languages/english/starlessriver/credit_cards.php on line 46

I installed 'Wordpress on Zen'. I get the error message when I attempt to change the wordpress theme in the wordpress wp-admin area. As you know when you change theme you get a preview of the theme. Instead of the preview I get a white screen and the error message.

Functionality of changing the theme seems unaffected.

I have not really checked the credit card functions on the shop itself because the store is not live yet. But will have a rummage around and see what is and isn't playing the game.

Any ideas? Perhaps this is a WOZ thing and I am in the wrong bit of the forum. If so sorry and I'll move the post.

Nick

Nick
iszent.com