cancel
Showing results for 
Search instead for 
Did you mean: 

Error page on shopping cart

SOLVED

Error page on shopping cart

Hi

 

We have recently upgraded to Prestashop 1.7.  We have just made a test service and everything work ok except for the final step / confirmation of order.  That is when we are greeted by the following error:

 

Notice: Undefined property: Shop::$theme in /classes/pdf/HTMLTemplate.php on line 199 

Fatal error: Call to a member function getName() on null in /classes/pdf/HTMLTemplate.php on line 199

This is a bit confusing and I am not sure how to resolve this.  The offending code is:

 

protected function getTemplate($template_name)
    {
        $template = false;
        $default_template = rtrim(_PS_PDF_DIR_, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$template_name.'.tpl';
        $overridden_template = _PS_ALL_THEMES_DIR_.$this->shop->theme->getName().DIRECTORY_SEPARATOR.'pdf'.DIRECTORY_SEPARATOR.$template_name.'.tpl';
        if (file_exists($overridden_template)) {
            $template = $overridden_template;
        } elseif (file_exists($default_template)) {
            $template = $default_template;
        }

The order comes through normally (it shows up in the admin panel as a new order). Could anyone help me to resolve this.  I'm still learning Magento but can apply basic PHP (with some guidance).

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Error page on shopping cart

Hi there! I think there may be some confusion as Prestashop is a different ecommerce platform to Magento so there won't be many people around here that can help you with your problem!

 

I don't have any familiarity with Prestashop but from my PHP knowledge I can tell you that the error is saying that: 

$this->shop->theme

is null. So my next step in terms of investigating the problem would be to look at where that gets assigned. It looks like the notice is confirming that that's the problem, even though it doesn't error until the fatal error. 

 

There doesn't look to be anything specific in this file that sets the theme but the shop variable is assigned on this line https://github.com/PrestaShop/PrestaShop/blob/develop/classes/pdf/HTMLTemplate.php#L230. How do you configure the shop ID in prestashop, could there by something wrong there, or perhaps the theme isn't correctly assigned to your shop?

 

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

View solution in original post

3 REPLIES 3

Re: Error page on shopping cart

Hi there! I think there may be some confusion as Prestashop is a different ecommerce platform to Magento so there won't be many people around here that can help you with your problem!

 

I don't have any familiarity with Prestashop but from my PHP knowledge I can tell you that the error is saying that: 

$this->shop->theme

is null. So my next step in terms of investigating the problem would be to look at where that gets assigned. It looks like the notice is confirming that that's the problem, even though it doesn't error until the fatal error. 

 

There doesn't look to be anything specific in this file that sets the theme but the shop variable is assigned on this line https://github.com/PrestaShop/PrestaShop/blob/develop/classes/pdf/HTMLTemplate.php#L230. How do you configure the shop ID in prestashop, could there by something wrong there, or perhaps the theme isn't correctly assigned to your shop?

 

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: Error page on shopping cart

 am sorry I meant Magento.  Yesterday was a bad day Smiley Frustrated

Re: Error page on shopping cart

There error you shared yesterday was a prestashop error! Ha

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!