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 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.
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.
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.
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.
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'));
Re: Fatal error in credit_cards.php
Update - after clearing ALL cookies in BOTH IE6 and Firefox the problem went away again. Hmm.
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.
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
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...
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.
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 :(
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?
Re: Fatal error in credit_cards.php
Quote:
Originally Posted by
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.
Re: Fatal error in credit_cards.php
Is there a way i can try and solve this problem?
Re: Fatal error in credit_cards.php
yes ... re-translate the admin portuguese.php file using the original english version of it
Re: Fatal error in credit_cards.php
Quote:
Originally Posted by
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.
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.
Re: Fatal error in credit_cards.php
Quote:
Originally Posted by
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.
Code:
<?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
Re: Fatal error in credit_cards.php
Clearing browser cookies and restarting the browser typically disconnects the browser from any open sessions as well.
Re: Fatal error in credit_cards.php
In my case I am getting an error message:
Code:
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
Re: Fatal error in credit_cards.php
It would seem the problem you're describing is directly related to the WOZ addon you're using.
Re: Fatal error in credit_cards.php
Quote:
Originally Posted by
Fragha
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...
I had the same error (in Romanian for me, instead of Portuguese). I deleted
Code:
// cc enabled image
define('IMAGE_CC_ENABLED_VISA', zen_image($template->get_template_dir('cc1.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc1.gif'));
define('IMAGE_CC_ENABLED_MC', zen_image($template->get_template_dir('cc2.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc2.gif'));
define('IMAGE_CC_ENABLED_AMEX', zen_image($template->get_template_dir('cc3.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc3.gif'));
define('IMAGE_CC_ENABLED_DINERS_CLUB', zen_image($template->get_template_dir('cc4.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc4.gif'));
define('IMAGE_CC_ENABLED_DISCOVER', zen_image($template->get_template_dir('cc5.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc5.gif'));
define('IMAGE_CC_ENABLED_JCB', zen_image($template->get_template_dir('cc6.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc6.gif'));
define('IMAGE_CC_ENABLED_AUSTRALIAN_BANKCARD', zen_image($template->get_template_dir('cc7.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc7.gif'));
define('IMAGE_CC_ENABLED_SOLO', zen_image($template->get_template_dir('cc8.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc8.gif'));
define('IMAGE_CC_ENABLED_SWITCH', zen_image($template->get_template_dir('cc9.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc9.gif'));
define('IMAGE_CC_ENABLED_MAESTRO', zen_image($template->get_template_dir('cc10.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . 'cc10.gif'));
and now I can see the admin login page and actually log in.