WordPress.org

Ready to get started?Download WordPress

Forums

Magento WordPress Integration
[resolved] [closed] Fatal error: Cannot redeclare __() (previously declared in /home/credimal/public (26 posts)

  1. Studios Web C.A
    Member
    Posted 1 year ago #

    I´ve got this error:
    Fatal error: Cannot redeclare __() (previously declared in /home/credimal/public_html/wp-includes/l10n.php:96) in /home/credimal/public_html/magento/app/code/core/Mage/Core/functions.php on line 97

    I´ve install and uninstal the pluggin and nothing, the error stills.... (sorry for my english I speak spanish).

    I don´t know what to do....

    http://wordpress.org/extend/plugins/magento-wordpress-integration/

  2. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Please follow the installation instructions: http://magentowp.com/documentation/installation/

  3. viccie85
    Member
    Posted 1 year ago #

    Same here, followed instructions, entered the url to the Mage.php file, broke the entire website. Managed to get it working by changing the line of code in functions.php to

    if(!function_exists('__')) { function __() { return Mage::app()->getTranslator()->translate(func_get_args()); } }

  4. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Steps 1 - 6 of the instructions outline the steps to do exactly that...

  5. viccie85
    Member
    Posted 1 year ago #

    Look again, code is a bit different. :)

  6. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Can't see a difference! What is it?

  7. viccie85
    Member
    Posted 1 year ago #

    if(!function_exists('__'))
    {
    function __()
    {
       return Mage::app()->getTranslator()->translate(func_get_args()); }
    }
    if(!function_exists('__'))
    {
    function __()
    {
       function __() { return Mage::app()->getTranslator()->translate(func_get_args()); }
    }
    }
  8. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Where are you seeing this? That's not what it says on the instructions: http://magentowp.com/documentation/installation/

  9. viccie85
    Member
    Posted 1 year ago #

    I know I had to change it

  10. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    You changed it to the second block of code you pasted? Because that code is invalid.

  11. viccie85
    Member
    Posted 1 year ago #

    Yes I did, I dunno what else to do because it broke the entire site and the plugin page. Right now the plugin works, I get a green Mage.php found message and I just purchased the Shortcodes & Widgets and activated it.

    The line of code on the instructions didn't work, maybe you have a solution for me?

  12. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Can you email me your functions.php file?

  13. viccie85
    Member
    Posted 1 year ago #

    Of course, what's your e-mail address?

  14. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Send it to sales@magentowp.com - Cheers.

  15. viccie85
    Member
    Posted 1 year ago #

    Done

  16. ontherocks
    Member
    Posted 1 year ago #

    I am having the same problem, and I would be interested to know if this change is okay to use.

  17. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    I fixed Viccie's issue by following the steps outlined in the instructions. I'm not sure where he was going wrong. Perhaps you could outline the steps you've taken so far.

    If the instructions aren't clear enough I'll be happy to update them, I just need to find out where people are going wrong!

  18. ontherocks
    Member
    Posted 1 year ago #

    Being the holidays, I went ahead and tried viccie's version of the php code and everthing has been working perfectly ever since. Killer plug-in, btw.

    Don't know why putting a function in a function would make any difference, but it did. I'll email you the steps I took to install, I believe I followed everything verbatim (many times), maybe you can shed some light.

    Thanks -

  19. crodesign
    Member
    Posted 1 year ago #

    I have followed your installation directions exactly (for a local install) and am still having the same issue. I thought I had already done it so made the change to the file after the initial install.

    When that didn't work, I removed the plugin and tried again. And still get the following response:
    Fatal error: Cannot redeclare __() (previously declared in C:\server\htdocs\wordpress\default\wp-includes\l10n.php:96) in C:\server\htdocs\magento\default\app\code\local\Mage\Core\functions.php on line 96

    As you can see it is pulling from the correct file location.

    Thank you in advance.

  20. crodesign
    Member
    Posted 1 year ago #

    I have purchased the shortcodes & widgets add-on, does it need to be deactivated?

  21. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Could you screen shot the code you added to the functions.php file?

  22. crodesign
    Member
    Posted 1 year ago #

    Silly me, I responded to the system email from your response... Here's a link to the screenshot:
    Link to image

    Also, I have tried this a fresh install of both Magento and WordPress. Getting the very same error.

    Thank you.

  23. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    You should be replacing the whole function with the code provided here, not the contents within the function: http://magentowp.com/documentation/installation/

    if(!function_exists('__')) {
        function __() { return Mage::app()->getTranslator()->translate(func_get_args()); }
    }

    Not:

    function __() {
        if(!function_exists('__')) {
            function __() { return Mage::app()->getTranslator()->translate(func_get_args()); }
        }
    }
  24. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Can you confirm whether this was the solution?

  25. crodesign
    Member
    Posted 1 year ago #

    This was indeed the proper solution. Turns out the issue was not with the Magento or WordPress. But rather with my template file for Magento. It was loading an independent functions.php. Once I added your script mod to it, everything worked out just fine.

    Thank you

  26. jamesckemp
    Member
    Plugin Author

    Posted 1 year ago #

    Marking as resolved...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.