Magento: Error - SimpleXMLElement::addAttribute() Attribute already exists
Warning: SimpleXMLElement::addAttribute() [simplexmlelement.addattribute]: Attribute already exists.
This Magento Error Message was giving me the hardest time. It seems to occur when you have a mis-match in your layout files.
What happend to me was I hard coded the newsletter into a page. In the newsletter layour file It was instructed to put the newsletter in the page also. This meant that it was included in the page more than once. That is why the error is thrown. Check your layout files to get a better grip on the problem.
I need to give thanks to Branko Ajzele for his post. It helped me realize what the problem was.

3 Responses to “ Magento: Error - SimpleXMLElement::addAttribute() Attribute already exists ”
July 17th, 2009 at 5:51 pm
can you tell me in detail how to fix this please im new to magento and this is driving me insane. This is suppose to be a great product but no support any place your help would be greatly thanked
July 17th, 2009 at 7:54 pm
Its hard to say what exactly is causing the problem. My problem was that I had added the newsletter block to a page using a custom layout file, but the newsletter block was already being included by the newsletter.xml layout file. This meant that I was trying to add it the the same area twice, and that is why this error message got displayed. I would retrace any changes you made to the files in the layout folder. If you are using SVN or CVS try rolling back till you get to a point where this error no longer shows up. To sum things up it is very hard to impossible to say why you are getting this error thrown. You just need to identify when it started and look at what you changed.
December 8th, 2009 at 8:58 am
This helped me out. Inside catalogsearch.xml I was removing breadcrumbs from the default layout (which is global, bad idea). Inside checkout.xml I was removing it again from the “checkout_cart_index” layout, which caused the error.
Once I changed catalogsearch.xml to use the appropriate sub-layout instead of “default” everything was fine. Avoid placing things in default if you can. Literally every page loads them, even if the page code is from another layout entirely.