Help! I get a fatal error message on shopping cart


#1

I get a fatal error message when I click on my shopping cart link. It worked fine mid december and now it doesn’t. The entire site is ok except the shopping cart link.

The error begins like this an gives a location following this error message

Fatal error : Uncaught Error: Call to undefined method LanguageDAO::connect()…


#2

The most likely cause, especially if all errors are being reported and there are no other errors, is your php installation was updated and the short open tag setting is now disabled and code either having to do with the class definition or dealing with the instance of that class is using short opening tags. If the relevant code is using short opening tags, the simplest permanent fix is to change them to full opening tags.

Some other possibilities - the code is dependent on the include_path or has a class autoloader that is no longer referring to the correct path; someone/something has gained access to your files and has modified the code or deleted file(s); the php version was updated and the code is dependent on old language features that are no longer present.

If the shopping cart code was written by a 3rd party, perhaps they have an update.

Beyond these things, if you cannot determine the cause of the problem, you will need to post the relevant code that would be needed to reproduce the problem.


#3

Thank you for replying. Do you know of anyone that might help do this? I bought the software many years ago and is likely php 5.3. I suspect the php was updated since it was in December and likely an end of the year update.
I do not know how to fix this myself. Thank you for your kind help.


#4

PS- my current webhost supports php 5.4. I don’t know if this was recently changed or not but as of December the cart is no longer working or accessible.


#5

Yes, the active forum members here on phphelp.com where you have posted this thread. But we cannot even identify what’s causing the problem without seeing the relevant code. It would probably only take 5 minutes after seeing the relevant code to identify what’s causing the problem. The correction may take longer depending on what’s causing the problem, up to and including rewriting a substantial portion of the code…

The only information that the error message provides is that an expected class method is being called that doesn’t exist. Per the reply you already got, the most likely cause is there is something either having to do with the class definition or dealing with the instance of that class that’s causing the problem.

If you are expecting someone to be able to tell you exactly what keys to press to fix the problem based on the error message, you are mistaken. Programming is the act of taking a general purpose computer and getting it to do something specific, in your case a shopping cart. There are multiple different ways of accomplishing any task. A dozen different people could have implemented a shopping cart, could be getting the exact same type of error you are getting, and the problem causing the error could be different in each case. It takes knowing the exact implementation details of your code to even be able to eliminate any of the possibilities in order to concentrate on the things that the code is doing that could be causing the problem. There could be anything in any of the files listed in the back-trace information you posted in the other thread, before or even after the line numbers being listed, since php is a parsed language and function/class definitions can be anywhere in the source.

When you post the code, xxxxx out any web site, database, or payment gateway specific information that you don’t want to show up on the forum and post it as preformatted text (see the < / > menu button) or using bbcode code tags so that the forum software won’t mangle its display.


#6

Thank you, phdr for replying and offering your knowledge. I would like to be able to share any and all of the problematic code, but actually, I don’t even know where to find it in my webhost server files. I am not a programmer or developer, but have dabbled in html and some javascript, but even at that, I don’t code my own but know where to find it or apply code I do find.
I would basically need someone that can help me do it or, most likely, do the actual fixing on my webhost file. I hope it can be fixed.
Any help on what to do next is appreciated. Thank you.


#7

Note: I have a wordpress theme and am using wordpress, but purchased a shopping cart software around 2009 or so. It is likely Php 5.3. My webhost upgraded to Php 5.3 and other Php versions so my shopping cart no longer works. I am assuming the upgrade caused this to stop, but I am not positive. I was told that an update to Php was made that same month and time as when it stopped, so that is my suspicion.
To recap:
The error I get on my shopping cart link is:

Fatal error : Uncaught Error: Call to undefined method LanguageDAO::connect() in /home1/xxxxxxxx/public_html/lib/framework/LanguageDAO.class.php:25 Stack trace: #0 /home1/xxxxxxxx/public_html/lib/framework/Language.class.php(25): LanguageDAO->_getDefault() #1 /home1/xxxxxxxx/public_html/lib/framework/Language.class.php(45): Language->Language(NULL, ‘’) #2 /home1/xxxxxxxx/public_html/conf/paths.inc.php(71): Language::getInstance(NULL, ‘’) #3 /home1/xxxxxxxx/public_html/cart.php(3): require_once(’/home1/xxxxxxxx…’) #4 {main} thrown in /home1/xxxxxxxx/public_html/lib/framework/LanguageDAO.class.php on line 25

The php script in the noted folder (…lib/framework/LanguageDAO.class.php** on line 25 is:

<?php require_once(dirname(__FILE__) . '/BaseDAO.class.php'); require_once(dirname(__FILE__) . '/BeanMapper.class.php'); class LanguageDAO extends BaseDao { function LanguageDAO(){ } function exists($lang){ } function _getDefault(){ $sql = 'select ' . ' id ' . 'from ' . ' ds_languages ' . 'where ' . ' customer_default = ? ' . ''; $params[] = 'Y'; $this->connect(); $this->prepare($sql, $params); $queryResult = $this->conn->query($sql, true); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); return $row['id']; } } function _populate(&$lang){ $sql = 'select ' . ' code as langCode, ' . ' name as langName, ' . ' charset, ' . ' active as langActive, ' . ' customer_default as customerDefault ' . 'from ' . ' ds_languages ' . 'where ' . ' id = ? ' . ''; $params[] = $lang->getId(); $this->connect(); $this->prepare($sql, $params); $queryResult = $this->conn->query($sql, true); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); BeanMapper::populateBean($lang, $row); } } function update($lang){ $sql = 'update ds_languages set ' . ' code = ?, ' . ' name = ?, ' . ' active = ?, ' . ' customer_default = ? ' . 'where ' . ' id = ? ' . ''; $params[] = $lang->getLangCode(); $params[] = $lang->getLangName(); $params[] = $lang->getLangActive(); $params[] = $lang->getCustomerDefault(); $params[] = $lang->getId(); $this->connect(); $this->prepare($sql, $params); $this->conn->query($sql); } function getNextId($lang){ $sql = 'select ' . ' max(id)+1 as retval ' . 'from ' . ' ds_languages ' . ''; $this->connect(); $this->prepare($sql, $params); $queryResult = $this->conn->query($sql); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); return $row['retval']; } } function saveNew($lang){ $sql = 'insert into ds_languages ' . ' (code, ' . ' name, ' . ' charset, ' . ' active) ' . 'values ' . ' (?, ' . ' ?, ' . ' ?, ' . ' ?) ' . ''; $params[] = $lang->getLangCode(); $params[] = $lang->getLangName(); $params[] = $lang->getCharset(); $params[] = 'Y'; $this->connect(); $this->prepare($sql, $params); $this->conn->query($sql); } function getLanguageList(){ $sql = 'select ' . ' id, ' . ' code, ' . ' name as label, ' . ' active as active, ' . ' customer_default as xdefault ' . 'from ' . ' ds_languages ' . 'order by ' . ' name ' . ''; $this->connect(); $queryResult = $this->conn->query($sql, true); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); $id = $row['id']; $array[$id]['id'] = $row['id']; $array[$id]['code'] = $row['code']; $array[$id]['name'] = $row['label']; $array[$id]['active'] = $row['active']; $array[$id]['default'] = $row['xdefault']; } return $array; } function getMultipleLanguageDropDown($value=null){ $sql = 'select ' . ' code, ' . ' name as label, ' . ' active ' . 'from ' . ' ds_languages ' . 'order by ' . ' label ' . ''; $this->connect(); $queryResult = $this->conn->query($sql, true); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); $array[$row['code']] = $row['label']; if($row['active']){ $avalue[] = $row['code']; } } Util::associativeArrayDropDown2($array, $value ? $value : $avalue); } function getActiveLanguages(){ $sql = 'select ' . ' id ' . 'from ' . ' ds_languages ' . 'where ' . ' active = ? ' . 'order by ' . ' customer_default desc, name ' . ''; $params[] = 'Y'; $this->connect(); $this->prepare($sql, $params); $queryResult = $this->conn->query($sql, true); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); $array[] = new Language($row['id']); } return $array; } function getLanguageDropDown($value=null){ if($actives = $this->getActiveLanguages()){ foreach($actives as $active) { $ndx = $active->getId(); $label = $active->getLangName(); $array[$ndx] = $label; } Util::associativeArrayDropDown($array, $value); } } function delete($lang){ $sql = 'delete from ' . ' ds_languages ' . 'where ' . ' id = ? ' . ''; $params[] = $lang->getId(); $this->connect(); $this->prepare($sql, $params); $this->conn->query($sql); } function getLanguageName(&$lang){ $sql = 'select ' . ' name as langName ' . 'from ' . ' ds_languages ' . 'where ' . ' code = ? ' . ''; $params[] = $lang->getLangCode(); $this->connect(); $this->prepare($sql, $params); $queryResult = $this->conn->query($sql, true); $it = new QueryIterator($queryResult); while ($it->hasNext()) { $row = $it->next(); BeanMapper::populateBean($lang, $row); } } /* * @param object $lang * @return boolean * @author Matt R. */ function existsByName($lang){ $sql = 'select ' . ' count(id) as total ' . 'from ' . ' ds_languages ' . 'where ' . ' name = ? ' . ''; $params = array(); $params[] = $lang->getLangName(); $this->connect(); $this->prepare3($sql, $params); $queryResult = $this->conn->query($sql); $it = new QueryIterator($queryResult); while($it->hasNext()){ $row = $it->next(); return ($row['total'] > 0); } return false; } } ?>

#8

Is this is long and arduous process or does it involve minimal changes? The only reason I ask is I have another shopping cart coming down the pike and wondered if it is complicated then if it is worth salvaging my old shopping cart. I do need to access my customer list and hope it is accessible in a file somewhere on my site server.