Hi there,
I get this message on all pages of my site and can't log into wordpress:
Fatal error: Cannot redeclare class ASHXML in /home1/badabin1/public_html/wp-content/plugins/wp-e-commerce/wpsc-includes/shipping.helper.php on line 3
Can someone please help me fix this. I only updated my wrdpress shopping cart plugin (getshopped.org) and now the whole site is broken.
Thank you
Kelli
Bogdan answers:
Let me an adress in private and I`ll help you :)
Kelli Anderson comments:
Hi - please email me-- [email protected]
Bogdan comments:
I did that, Keli :)
Kelli Anderson comments:
Thank you - let me know if you don't get the money-- I'm not sure how to award it to you. I chose "40" from a pulldown menu for a vote-- Hopefully that works
jevusi answers:
I know this problem
You have a problem because the class class ASHXML is redeclared.
To resolve this problem, go to settings and deactivate the plugin wp-e-commerce.
re-activate this plugin. If the problem is not resolved, go to your FTP
go here : /home1/badabin1/public_html/wp-content/plugins/
delete the folder wp-e-commerce
and re-install this plugin
the class ASHXML is
class ASHXML{
/**
* This function iterates over the keys from an array, if there is any
* non-numeric keys, it is associative, else it is a "list"
* @author Greg Gullett ([email protected])
* @since 0.0.1
* @param array $data
* @return boolean
*/
function _is_list($data){
$is_num = TRUE;
if (!is_array($data)){ return FALSE; }
foreach((array)$data as $key=>$value){
if (!is_numeric($key)){
$is_num = FALSE;
}
}
return $is_num;
}
/**
* Helper function that parses xml attributes from an array into a string
* @author Greg Gullett ([email protected])
* @since 0.0.1
* @param array $attrs
* @return string
*/
function _parse_attrs($attrs){
$attrString = "";
foreach($attrs as $key=>$value){
$attrString .= sprintf(" %s=\"%s\" ",$key, $value);
}
return $attrString;
}
/**
* Accepts an associative array and produces an XML document
* Attributes are supported by this function, see example.
* @author Greg Gullett ([email protected])
* @since 0.0.1
* @param array $data Associative array, can be multi-dimensional
* @return string The resulting XML document
*
* Example: (Not a valid USPS Request)
* $test = array("RateRequestV4"=>array("@attr"=>array("ID"=>"This is my ID", "PASSWORD"=>"this is my pass")
* "Package"=>array(array("Weight"=>1.0, "Service"=>"First Class"),
* array("Weight"=>1.0, "Service"=>"PRIORITY"))
* )
* );
* $xml_doc = $this->build_message($test);
* -- Result --
* <RateRequestV4 ID="This is my ID" PASSWORD="this is my pass">
* <Package>
* <Weight>1.0</Weight>
* <Service>First Class</Service>
* </Package>
* <Package>
* <Weight>1.0</Weight>
* <Service>PRIORITY</Service>
* </Package>
* </RateRequestV4>
*/
function build_message(array $data){
$xmlString = "";
foreach($data as $node=>$value){
if ($node == "@attr") { continue; }
$value_is_list = $this->_is_list($value);
if (is_array($value) && !$value_is_list){
$attrs = "";
if (array_key_exists("@attr",$value)){
$attrs = $this->_parse_attrs($value["@attr"]);
unset($value["@attr"]);
}
$xmlString .= "<".$node." ".$attrs.">\n";
$xmlString .= $this->build_message($value);
$xmlString .= "</".$node.">\n";
}elseif(is_array($value) && $value_is_list){
foreach($value as $iter_node){
$temp = array($node=>$iter_node);
$xmlString .= $this->build_message($temp);
}
}else{
if (trim($value) != ""){
$xmlString .= "<".$node.">".$value."</".$node.">\n";
}else{
$xmlString .= "<".$node."/>\n";
}
}
}
return $xmlString;
}
/**
* Sets the header content type to text/xml and displays a given XML doc
* @author Greg Gullett ([email protected])
* @since 0.0.1
* @param string $xml_doc
*/
function show_xml($xml_doc){
header("content-type: text/xml");
print $xml_doc;
}
/**
* This is a helper function that retrieves an XML element from the
* provided document. Since we are trying to keep PHP4 support
* I cannot use simpleXML
* @author Greg Gullett ([email protected])
* @since 0.0.1
* @param string $element The element to find in document
* @param string $document The XML Document to search
*/
function get($element, $document){
preg_match_all('/<'.$element.'.*?>(.*?)<\/'.$element.'>/', $document, $matches);
if (count($matches) > 1){
return $matches[1];
}
return FALSE;
}
}
Lee Willis answers:
Sounds like the upgrade hasn't completed cleanly. I'd uninstall, and re-install WP e-Commerce.
[If you can't log into WordPress to uninstall, then you'll have to FTP in and remove the plugin from wp-content/plugins/wp-e-commerce/, then log in and re-install it.]
Kelli Anderson comments:
But will that delete all of my inventory?
Lee Willis comments:
Your inventory is stored in the database - so removing the plugin code shouldn't affect that. I'd always recommend taking a backup first but that depends how practical that is for you I guess ...
Luis Abarca answers:
Connect by FTP or by Cpanel file manager, rename the plugin and try to upload again