Upgrade from Free to PRO - Getting Parse Error


  • Your avatar
    seyi    
     4 years ago
    0

    After upgrading from Free version to PRO version, I am getting the following Error:

    Parse error: syntax error, unexpected $end in C:\xampp\htdocs\closetbay20\administrator\components\com_virtuemart\classes\ps_coupon.php on line 711

    I installed and tested on my test localhost.

    Under installation Check i have all saying they are installed:
    Installed Core (Required) File: www/administrator/components/com_virtuemart/classes/ps_coupon.php
    Required. This injection is the core of AwoCoupon Pro and no coupon code from within AwoCoupon will work without it.

    I successfully created a new coupon, but when I enter it within my cart and hit Submit, I get:

    Parse error: syntax error, unexpected $end in C:\xampp\htdocs\closetbay20\administrator\components\com_virtuemart\classes\ps_coupon.php on line 711


    The linse between" PRO Version insert started here & PRO Version insert stopped here" are the lines the pro version inserted into ps_coupon.php:

    My ps_coupon code changes are as follows:
      /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
        
        /* function to remove coupon coupon_code from the database */
        function remove_coupon_code( &$d ) {
            
       return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_remove.php");
     PRO Version insert started here  }
        function remove_coupon_code_vm( &$d ) {
            return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_remove.php");  PRO Version insert stopped here
            /* remove the coupon coupon_code */
            /* init the database */
            $coupon_db = new ps_DB;
            if( is_array($d['coupon_id'] )) {
                foreach( $d['coupon_id'] as $coupon ) {
                    $q = 'DELETE FROM #__{vm}_coupons WHERE coupon_id = '.(int)$coupon;
                    $coupon_db->query($q);            
                }
            }
            else {
                $q = 'DELETE FROM #__{vm}_coupons WHERE coupon_id = '.(int)$d['coupon_id'];
                $coupon_db->query($q);
            }
            $_SESSION['coupon_discount'] =    0;
            $_SESSION['coupon_redeemed']   = false;
            
            return true;
        }
        
        
        /* function to process a coupon_code entered by a user */ 
        function process_coupon_code( $d ) {
        PRO Version insert started here    return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_process.php");
        }
        function process_coupon_code_vm( $d ) {     PRO Version insert stopped here
            return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_process.php");
            global $VM_LANG, $vmLogger;
            /* init the database */
            $coupon_db =& new ps_DB; 
  • Your avatar
    seyi    
     4 years ago
    0

    Not sure where some of these text came from, because AwoCoupon does not insert them. Either remove these texts (all 4):

    PRO Version insert started here
    PRO Version insert stopped here

    Or comment them out

    <?php
    /* PRO Version insert started here */
    /* PRO Version insert stopped here */
    ?>


    Right now they are uncommented comments and causing the parsing error.
  • Default avatar
    mowlman    
     4 years ago
    0

    Sorry, I put them in my forum post to indicate what code was inserted into my ps_coupon.php. They are Not within the actual code. I was going to bold the code, but wasn't sure how to do it properly in the forum. sorry for any confusion.

    actual code block:
      /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
        
        /* function to remove coupon coupon_code from the database */
        function remove_coupon_code( &$d ) {
            
       return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_remove.php");
        }
        function remove_coupon_code_vm( &$d ) {
            return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_remove.php");
            /* remove the coupon coupon_code */
            /* init the database */
            $coupon_db = new ps_DB;
            if( is_array($d['coupon_id'] )) {
                foreach( $d['coupon_id'] as $coupon ) {
                    $q = 'DELETE FROM #__{vm}_coupons WHERE coupon_id = '.(int)$coupon;
                    $coupon_db->query($q);            
                }
            }
            else {
                $q = 'DELETE FROM #__{vm}_coupons WHERE coupon_id = '.(int)$d['coupon_id'];
                $coupon_db->query($q);
            }
            $_SESSION['coupon_discount'] =    0;
            $_SESSION['coupon_redeemed']   = false;
            
            return true;
        }
        
        
        /* function to process a coupon_code entered by a user */ 
        function process_coupon_code( $d ) {
            return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_process.php");
        }
        function process_coupon_code_vm( $d ) {
            return require_once (JPATH_ADMINISTRATOR.DS."components".DS."com_awocoupon".DS."assets".DS."virtuemart".DS."ps_coupon_process.php");
            global $VM_LANG, $vmLogger;
            /* init the database */
            $coupon_db =& new ps_DB;
  • Your avatar
    seyi    
     4 years ago
    0

    Ok, that makes more sense. Looking at the codes, I do not see any syntax problems. One thing I noticed is the error you are receiving is complaining about line 711. In a normal default ps_coupon.php file, there are under 300 lines. Do you really have that many lines? If so what is on line 711?