Jump to content

Hoe een custom PrestaShop php functie aan te roepen?


MarcoPas

Recommended Posts

Hoi, ik heb voor mijn shop eigenlijk een aparte login-pagina nodig of html form welke ik kan submitten en na succesvol in te loggen me deze doorstuurt naar een andere pagina. Nu heb ik in het engelstalige forum een functie gevonden die dat zou moeten doen, echter heb ik geen idee hoe ik deze functie moet inbedden in PrestaShop zodat ik deze ook kan gebruiken en aanroepen vanuit een aparte pagina of formulier.. Iemand een hint?

De functie is deze:

function psLogin($email, $password) {
       global $cookie;
       $customer = new Customer();
       $authentication = $customer->getByEmail(trim($email), trim($password));
       if ( $authentication and $customer->id ) {
           $cookie->logged = 1;
           $cookie->id_customer = intval($customer->id);
           $cookie->customer_lastname = $customer->lastname;
           $cookie->customer_firstname = $customer->firstname;
           $cookie->passwd = $customer->passwd;
           $cookie->email = $customer->email;
           Module::hookExec('authentication');
           return true;
       } else {
           return false;
       }
   }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...