Error on purchase of Gift Certificate


  • Default avatar
    barbara4    
     11 years ago
    0

    I just purchase AwoCoupon, and have been getting it setup. I have Joomla 1.5.26 and HikaShop 1.5.8. I have the Gift Certificate all setup in both HikaShop and AwoCoupon. When completing a test purchase, I get the following error:

    Fatal error: Cannot redeclare class PHPMailer in /home/xxxxxxx/public_html/website/libraries/phpmailer/phpmailer.php on line 34

    I receive the gift certificate email, but not the order emails. I know that phpmailer is referenced in awomail.php. Beyond that I don't know how to fix this.

    Anyone have any thoughts?
  • Your avatar
    seyi    
     11 years ago
    0

    Hello,

    Yes in awomail it is called as such:

    <?php
    require_once JPATH_ROOT.'/libraries/phpmailer/phpmailer.php';
    require_once 
    JPATH_ROOT.'/libraries/joomla/mail/helper.php';
    ?>


    What might be happening is it is called in awomail, and something else you are using also tries to forcibly include phpmailer.php without first checking to see if it is included.

    Is there any other plugins you are using that would trigger the mail function?
  • Default avatar
    barbara4    
     11 years ago
    0

    Not that I am aware of. Especially that would trigger during checkout. HikaShop out fo the box standard besides language and styling changes. Any thoughts of what would be causing this issue within AwoCoupon or HikaShop? I really can't think of anything else on the website causing the issue.
  • Your avatar
    seyi    
     11 years ago
    0

    I am not sure what it could be then. The only other suggestion would be to debug the code to find out exactly what is causing this. I can do it but would need temporary admin and ftp access, which you can send over private message.
  • Your avatar
    seyi    
     11 years ago
    0

    Ok, after alot of testing, think I found the problem. It has to do with not calling the file through jimport. In joomla 1.5 an 'include' is used in jimport, which can lead to errors if the file has already been loaded. in joomla 2.5 an 'include_once' is used, which would not cause an error if the file has been previously included. In order to work with both here is the code change:

    in www/administrator/components/com_awocoupon/helpers/awomail.php, around line 13 is this
    <?php
    require_once JPATH_ROOT.'/libraries/phpmailer/phpmailer.php';
    require_once 
    JPATH_ROOT.'/libraries/joomla/mail/helper.php';
    ?>


    change it to this
    <?php
    if(!class_exists'PHPMailer' )) jimport('phpmailer.phpmailer');
    if(!
    class_exists'JMailHelper' )) jimport('joomla.mail.helper');
    ?>


    That should fix this problem.