Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using Magento (directory example.com/app) and WordPress (directory example.com/blog/wp-blog-header.php).

When I set up a WP_Query in Magento's template\catalog\product\view.phtml it shows the following error:

Fatal error: Cannot redeclare __() (previously declared in \app\code\core\Mage\Core\functions.php:93) in wordpress\wp-includes\l10n.php on line 98

Is there a way to get this to work?

share|improve this question
3  
what is the error? –  Milo Nov 14 '12 at 1:09
    
i added the error. thank you –  250091017 Nov 14 '12 at 5:17
    
Milo,do you know how to correct it? –  250091017 Nov 14 '12 at 6:04
    
Seems like magento is declaring functions using same names as WordPress. __ is a localization function in WP. interested if someone got a solution. –  Zlatev Nov 14 '12 at 7:35
    
This is in app/functions.php now. –  toscho Feb 2 at 17:54

1 Answer 1

__() is deprecated in magento. You may either manually delete it from the magento core files (& repeat this process again everytime you have a new install or you upgrade) or wait for magento developers to remove this.

For wordpress, in the future when php 5.3 is much more common & wordpress breaks their backward compatibility & push all their code to namespaces then only this will be solved. I think this won't be anytime soon(maybe never?).

BOTTOM LINE: Since wordpress relies on this function for some functionality & it's deprecated in magento, go for deleting it from core files in magento. You already have the path & line number (\app\code\core\Mage\Core\functions.php:93)

If this doesn't work for you, you can't do what you asked for in the question. My suggestion for an alternative is to create a wordpress script which could dump the required information to some database then create a magento script to read it from there & run them individually (maybe setup a cron)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.