PrestaShop: overriding a core class Customer example

Trabla: PrestaShop: overriding (extending) a core class Customer example ( not in module )

Solving:

1. Create custom file Customer.php with class Customer and extends core class CustomerCore.
CustomerCore class is define in file Customer.php in /var/www/prestashop/classes/
<?php

class Customer extends CustomerCore{

    public function __construct($id = null)
    {
        parent::__construct($id);
    }

    //Overriding method customerExists
    public static function customerExists($email, $return_id = false, $ignore_guest = true)
    {
             $result = FALSE;          

 
            //Write custom your code here 


            return $result;
    }
   
}
?>


2. Move custom file Customer.php into folder /var/www/prestashop/override/classses/

3. Clear PrestaShop cache in administration panel


No comments:

Post a Comment