Jump to content

[SOLVED] PS 8.2 Error in checkout after upgrading from 8.1.7


nestor44

Recommended Posts

Hi,

I have upgraded PS from 8.17 to 8.2 yesterday. Upgrade went without any problems. While I was testing the shop in Debug mode before turning it on I have noticed that in the checkout I have a following error: "Warning: Trying to access array offset on value of type null in /var/cache/dev/smarty/compile/16/c0/d8/16c0d8e416c0532a397d973c9b7320f765b61789_2.file.order-confirmation-table.tpl.php on line 223"

The line in this file is

<?php if ($_smarty_tpl->tpl_vars['subtotals']->value['tax']['label'] !== null) {?>

<?php if ($_smarty_tpl->tpl_vars['subtotals']->value['tax']['label'] !== null) {?>

I have cleared cache in the Performance section and also manually on the server but this message does not disappear. It is not shown when I turn off Debug mode. My website works with no problems. Customers place orders and make payments without errors. I am using SuperCheckout 9.0.2 by Knowband. When the SuperCheckout is activated I have "TECHNICAL ERROR- Request Failed" in the shopping cart area even when the Debug mode is turned off, and there is no item displayed is the SuperCheckout's cart. Before upgrade I did not have such problems.

The first screenshot is from original checkout. The second screenshot from the SuperCheckout. 

image.thumb.png.780dde71d8600bf8b7bbd5e4f7fbdf2c.png

 

image.png.ea565d4c523a5429524b4e7444e8c022.png

Edited by nestor44
problem solved (see edit history)
Link to comment
Share on other sites

  On 12/21/2024 at 9:07 PM, PMShop said:

Please go to Modules and Look for Super Checkout Module & Make Reset the module

Expand  

Unfortunately, this did not help. I still have "Warning: Trying to access array offset on value of type null" on the original checkout. On the SuperCheckout now shopping cart is visible but Technical Error is present in the sections with Shipping Methods and Payment Methods. Cache have been cleared after Reset. I have also tried unistalling the SuperCheckout but the problem in the original checkout is still present while activating the Debug Mode.

Link to comment
Share on other sites

@PMShop, my original line is 

<?php if ($_smarty_tpl->tpl_vars['subtotals']->value['tax']['label'] !== null) {?>

I have changed it to

<?php if (isset($_smarty_tpl->tpl_vars['subtotals']->value['tax']) && $_smarty_tpl->tpl_vars['subtotals']->value['tax'] !== null && isset($_smarty_tpl->tpl_vars['subtotals']->value['tax']['label'])) { ?>

 

Now the error is gone on the original checkout but I assume that it will return after I clean cache in the future or something like that. Unfortanately I still have 'TECHNICAL ERROR- Request Failed' errors in the SuperCheckout even with Debug being turned off. Do you know what might cause that problem? During upgrade I have also updated the original theme.

@ST-THEMES, I have checked your solution first but I still had the problem on the original checkout after clearing cache. The solution I have mentioned above worked but the change was made in the var/cache file so I assume that the problem will return after clearing the cache in the future.

Link to comment
Share on other sites

@ST-THEMES, yes, I use another theme. I have the setting that you mentioned. But to be honest, I am not sure what exactly I need to change in the theme I am using bcause it is a bit different than what you showed me in the previous message. Here's the code of my tpl file with the code that indicates subtotal and tax. I do not know why this problem appeared now and did not appear in the previous PS versions. 

 

     <table>
        {foreach $subtotals as $subtotal}
          {if $subtotal !== null && $subtotal.type !== 'tax' && $subtotal.label !== null}
            <tr>
              <td>{$subtotal.label}</td>
              <td>{$subtotal.value}</td>
            </tr>
          {/if}
        {/foreach}
        {if $subtotals.tax.label !== null}
          <tr class="sub">
            <td>{$subtotals.tax.label}</td>
            <td>{$subtotals.tax.value}</td>
          </tr>
        {/if}

	{if $smarty.const._PS_VERSION_ >= '1.7.7.0'}
        {if !$configuration.display_prices_tax_incl && $configuration.taxes_enabled}
		  <tr><td></td><td></td></tr>
          <tr>
            <td><span class="text-uppercase">{$totals.total.label}&nbsp;{$labels.tax_short}</span></td>
            <td>{$totals.total.value}</td>
          </tr>
		  <tr><td></td><td></td></tr>
          <tr class="total-value font-weight-bold">
            <td><span class="text-uppercase">{$totals.total_including_tax.label}</span></td>
            <td>{$totals.total_including_tax.value}</td>
          </tr>
        {else}
		  <tr><td></td><td></td></tr>
          <tr class="total-value font-weight-bold">
            <td><span class="text-uppercase">{$totals.total.label}&nbsp;{if $configuration.taxes_enabled}{$labels.tax_short}{/if}</span></td>
            <td>{$totals.total.value}</td>
          </tr>
        {/if}
	{else}
		<tr><td></td><td></td></tr>
        <tr class="font-weight-bold">
          <td><span class="text-uppercase">{$totals.total.label}</span> <span class="price_tax_label">{$labels.tax_short}</span></td>
          <td>{$totals.total.value}</td>
        </tr>
	{/if}

      </table>

 

Link to comment
Share on other sites

@ST-THEMES, thank you. This helped and I no longer have the problem on the original checkout and SuperCheckout. But now when I make a test order I have 500 error with following description. What is wrong with PS 8.2? I did not have any problems with previous version.

[PrestaShopException]
Invalid new order status
at line 365 in file classes/order/OrderHistory.php

360. 
361.         $this->id_order_state = (int) $new_order_state;
362. 
363.         // changes invoice number of order ?
364.         if (!Validate::isLoadedObject($new_os) || !Validate::isLoadedObject($order)) {
365.             throw new PrestaShopException($this->trans('Invalid new order status', [], 'Admin.Orderscustomers.Notification'));
366.         }
367. 
368.         // the order is valid if and only if the invoice is available and the order is not cancelled
369.         $order->current_state = $this->id_order_state;
370.         $order->valid = $new_os->logable;
OrderHistoryCore->changeIdOrderState - [line 1742 - classes/order/Order.php] - [3 Arguments]
OrderCore->setCurrentState - [line 67 - modules/stripe_official/controllers/front/orderFailure.php] - [1 Arguments]
stripe_officialOrderFailureModuleFrontController->initContent - [line 319 - classes/controller/Controller.php]
ControllerCore->run - [line 510 - classes/Dispatcher.php]
DispatcherCore->dispatch - [line 28 - index.php]

 

Link to comment
Share on other sites

@ST-THEMES, I have checked that and everything is ok. I did some tests and I have noticed that the problem occurs only if I select Stripe as a payment method and use different delivery address and invoice address. If both addresses are the same then there is no problem and order is placed with no errors. I have also noticed that when I select bank wire transfer as a payment method there is a different behaviour. When there is a different address for invoice and delivery then I do not have error. Instead the page refreshes when I try to place the order and the addresses are removed. When I re-tried to insert different address and place the order again then the same situation happens, the page refreshes and the addresses are removed. It is impossible to place the order with different addresses. When the addresess are the same then the order is placed with no problem. I have not idea why this happens. It's like the recent update broke my Prestashop or something.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Supercheckout was working fine and then it happened 🫣😞 and the products are not displayed in the cart

2025-01-07151137.png.74421dd711e9f064ac069cf64a777cb7.png

After Reset the module

image.png.a1b49a319be508b3faa14344f947d65a.png

/modules/supercheckout/controllers/front/SupercheckoutCore.php line 124

            $this->supercheckout_settings['html_value']['header']

/classes/controller/Controller.php line 287

        $this->init();
        if ($this->checkAccess()) {
            // setMedia MUST be called before postProcess
            if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
                $this->setMedia();
            }

            // postProcess handles ajaxProcess
            $this->postProcess();

            if (!empty($this->redirect_after)) {
                $this->redirect();
            }

            if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
                $this->initHeader();
            }

            if ($this->viewAccess()) {
                $this->initContent();
            } else {
                $this->errors[] = $this->trans('Access denied.', [], 'Admin.Notifications.Error');
            }

            if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
                $this->initFooter();
            }

            // Default behavior for ajax process is to use $_POST[action] or $_GET[action]
            // then using displayAjax[action]
            if ($this->ajax) {
                $action = Tools::toCamelCase(Tools::getValue('action'), true);

                if (!empty($action) && method_exists($this, 'displayAjax' . $action)) {
                    $this->{'displayAjax' . $action}();
                } elseif (method_exists($this, 'displayAjax')) {
                    $this->displayAjax();
                }
            } else {
                $this->display();
            }
        } else {
            $this->initCursedPage();
            $this->smartyOutputContent($this->layout);
        }

/classes/Dispatcher.php line 525

            $controller->run();

            // Execute hook dispatcher after
            if (isset($params_hook_action_dispatcher)) {
                Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
            }

 

/public_html/index.php line 31

Dispatcher::getInstance()->dispatch();
//cleantalk-usp/bottom_code/start
	
if(ob_get_contents()){
ob_end_flush();
}
	if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
		die();
	}
//cleantalk-usp/bottom_code/end

 

 

 

 

 

 

Edited by cosmoll (see edit history)
Link to comment
Share on other sites

Posted (edited)

@cosmoll, deactivate SuperCheckout and check if you have problems with the original checkout as well. After upgrade I also had problems with SuperCheckout. After turning it off I also had problems with the original checkout as I mentioned in my first post. The fix from ST-THEMES helped solve the problem with the original checkout but I still had TECHNICAL ERROR in the Supercheckout. Here's what I did to remove it. 

1. I perform Reset of the module and then I unistalled it. 
2. Using PRESTOOLS I went to 'Tools & Stats -> Integrity Checks' and fixed bunch of problems that occured after upgrade. Backup your database before you do anything.
3. Using Prestools again I went to 'Tools & Stats -> Cleanup' and I procced with following options: Empty cache, Delete old connections, Cleanup deleted product info.
4. I also use CloudFlare so I cleared cache in CF as well.
5. After installing SuperCheckout again I have no problem now.

I hope this helps you. Take care :)

Edited by nestor44 (see edit history)
Link to comment
Share on other sites

  • nestor44 changed the title to [SOLVED] PS 8.2 Error in checkout after upgrading from 8.1.7

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...