Jump to content

JEEGuy

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by JEEGuy

  1. Hy & again thanks for your reply. Well i will study the mentioned PHP files but lets assume this very easy example, wonder if you can get it to run. I call the Script unter https://localhost/prestashop/modules/aaiauth/Test.php First example: <?php //NOTE THE BELOW LINE IS COMMENTED YET! //require_once(dirname(__FILE__).'/../../config/config.inc.php'); if (Customer::customerExists("foo@bar.com")){ echo("Customer exists"); }else{ echo("Customer doesn't exist"); } echo("Reached end"); ?> My result is the following error: Fatal error: Class 'Customer' not found in C:\xampp\htdocs\prestashop\modules\aaiauth\Test.php on line 5 Now we uncomment the line with the PrestaShop config and load the config: Second example: <?php require_once(dirname(__FILE__).'/../../config/config.inc.php'); if (Customer::customerExists("foo@bar.com")){ echo("Customer exists"); }else{ echo("Customer doesn't exist"); } echo("Reached end"); ?> Now there we go again in my case. I get directly relocated to the index page of PrestaShop and the following code wont run. (I know this from debuging). I would love to hear from you if you were able to run this simple example to echo something instead of only redirect to the index page of PrestaShop. Regards Jan Further information: I will debug deeper into the PrestaShop config. As faar as i have seen till now, the following line of code is the last one executed in the config file and thats why we never reach the own code: Context::getContext()->shop = Shop::initialize();
  2. Hy and many thanks for your fast reply. I use require_once now with the same effect that my code wont run but i get directly redirected to the index page of PrestaShop. My PHP Script is based in prestashop/modules/aaiAuth/aaiReturnHandler I also tried to place it in the override/classes folder as well as inside the prestashop/classes folder. Was anyone even able to use a Core class the way i try to? Regards Jan Background information: I implemented a third party authentification service (Switch AAI) to authenticate students. The reason why i need to call PrestaShop core classes from within a own script is because this third party service delivers SAML2 protected information about the successfully authenticated student to my script. After that return i want to register this student and load it to the PrestaShop Context (or in case of a second successful AAI Login just load it to the context). A workaround would mean to copy hundreds of lines of PrestaShop code to my own script context which i belive is not the way to go.
  3. Hy I try to use PrestaShops core functionality from within my own PHP Script. Lets say for example i want to check if "foo@bar.com" is an already registered customer, then i would like to call the Customers core class method the following way: Customer::customerExists("foo@bar.com"); Now if i do so the following error occurs: Fatal error: Class 'ObjectModel' not found in C:\xampp\htdocs\prestashop\classes\Customer.php According to the PrestaShop forum i included the PrestaShop config file to solve this error. I did this the following way: include('config_mod.inc.php'); Good news is: Above error is solved! My Problem: My PHP code doesent even run but the PrestaShop index page gets displayed in the browser. Any suggestions what i am doing wrong? Regards Jan
  4. Hi, I could not include the file with: include(dirname(__FILE__).'/../../config/config.inc.php'); (which should work in general as faar as i have seen after google about it). I instead included it this way: include('../..../../../../config/config.inc.php'); Now my errors dont apear anymore but i always get redirected to the index page of PrestaShop... I will have to further investigate the situation, especially the newly included config file. Many thanks for your help! Regards Jan P.s. if you have a cloue about the redirect to the index page & why it happens i would appreciate any help
  5. Very many thanks for your reply. Indeed my Script gets called by a redirect from the third party authentication service. I will try your solution tomorrow and post about the success. Again many thanks for the fast reply! Regards Jan
  6. Hi, I would like to use some functionality of the core class Customer.php (for example the 'customerExists' function). Now when i include the Customer.php inside my class it gets found correctly but the following error gets thrown: Class 'ObjectModel' not found in C:\xampp\htdocs\prestashop\classes\Customer.php on line 29 Yet any suggestions how to solve this? (ANYTHING could help after hours of reading & trying) I already found a post to the error: http://www.prestasho...__fromsearch__1 According to the post i tried not to include the Customer.php inside my class (located inside the modules folder) but then the Customer.php will not be found. I as well tried to place my class inside the /override/classes folder made it extend from ObjectModel which has thrown basicially the same error. Any suggestions how i can use PrestaShop core classes from within own PHP Scripts/ Classes (located in the modules folder)? Thank you took the time to read this! Regards Jan P.s. Background Information: I implemented a third party authorization service (Switch AAI) to authenticate students from Switzerland, which are not yet known to the PrestaShop DB. After successfull authentication id like to use PrestaShop's existing code located in the core classes to add this user to the database (register it) and load it to the context so it's logged in. Thatfore i need the Customer.php class with its functions add(), cleanGroups(), addGroups(..), updateContext(...).
  7. Hi, i tried myself but could not get this done from within the module folder directly. I copied the according core class to override/classes, changed it there to have new functionality (but the same functions in it) and it was then used automatically.
×
×
  • Create New...