Link to home
Start Free TrialLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Add PHP Page To Prestashop 1.5.6

I have the need to have a php page be embedded into the framework of Prestashop.  I have followed a discussion on how to add a php page but I am still not getting it to work and there is a fatal error.

Here is my php code in /override/controllers/front called Assessment.php

<?php

class AssessmentControllerCore extends FrontController {

/**
 *  Initialize controller
 *  @see FrontController::init()
 */
public function init() {
    parent::init();
}

/**
 *  Assign template vars related to page content
 *  @see FrontController::initContent()
 */
public function initContent() {
    parent::initContent();

    $this->setTemplate(_PS_THEME_DIR_.'assessment.tpl');
}

}
?>

Open in new window


Here is my .tpl file which is located in /themes/warehouse called assessment.tpl
{php}
<?php
echo "sdf";
?>
{/php}

Open in new window


I am calling it in this manner http://www.abc.com/index.php?controller=Assessment and I am getting this error

[Thu Aug 17 18:03:21.105090 2017] [:error] [pid 12287] [client 69.34.35.119:57139] PHP Fatal error:  Class 'Assessment' not found in /data/web/abc.com/classes/controller/Controller.php on line 128

Open in new window


Please help me get my simple php to work so that I then can add in my actual script.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sharingsunshine

ASKER

Unfortunately, that didn't solve the problem.  It seems that I need to pass the variables to Smarty from PHP.  Do you have any experience with that?
Maybe there are multiple problems.  The error you are showing is, "Class 'Assessment' not found ". By changing the name of the file to match, that probably fixed one issue then allowed you to get to the next issue.

Are you still getting the same fatal error when you changed "/override/controllers/front/Assessment.php" to "/overrides/controllers/front/Assessment.php"

If so, close out this question, then lets start a new thread for the next issue.
It seems the instructions I was following don't fit my version of Prestashop.  Because the folder name is override not overrides and it gets even more complicated after that.  So I need to find out from my developer the correct way to proceed.  Thanks for trying to help.
I appreciate all  of your help.
Yes, there were multiple problems.  It seems the theme creators did change it to override (singular.)  However, in my form statement I had included the direct link to the controllers and it should be the same as I am calling it in the browser.  Such as, http://www.abc.com/index.php?controller=Assessment instead of http://www.abc.com//override/controllers/front/Assessment.php