Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Override PayPal module v3.7.1 #3

Open
comexpertise opened this issue May 29, 2014 · 2 comments
Open

Override PayPal module v3.7.1 #3

comexpertise opened this issue May 29, 2014 · 2 comments

Comments

@comexpertise
Copy link

Hi,

The current 3.7.1 of PayPal module can be overrided with this check:

if (!class_exists('PayPal')) { class PayPal extends PayPalModule {...} }

But the PayPal class (paypal.php) add some "define" outside the class and cause warnings: PHP Notice: Constant xxx already defined.

@FlYos
Copy link
Owner

FlYos commented Jun 5, 2014

Hi,
I've create a override of Paypal module on my local machine and I've no error.

My implementation of override, copies the original file (no extends) and He don't duplicate the constant defined.

Could youd details your override please

@comexpertise
Copy link
Author

Hi,

Sorry for reply delay. You can try with this ? Here my override of paypal.php in myThemeFolder/modules/paypal/:

    <?php
    if (!defined('_PS_VERSION_')) {
        exit();
    }
    if (!class_exists('PayPal')) {

    class PayPal extends PayPalModule {

        public function install() {
            if (!parent::install() || !$this->registerHook('productActions')) {
                return false;
            }
            return true;
        }

        /**
         * Hooks methods
         */
        public function hookProductActions() {
            $content = (!$this->useMobile()) ? $this->renderExpressCheckoutButton('product') : null;
            return $content . $this->renderExpressCheckoutForm('product');
        }

    }
    }

Try and compare with your and my repo: https://github.com/comexpertise/Prestashop-override-module/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant