Prestashop: Delivery slips fails when upgrading to 1.7.5

Created on 13 Feb 2019  路  9Comments  路  Source: PrestaShop/PrestaShop

There is an issue when upgrading to 1.7.5.0 if you have only one language.
Here is a tutorial from @Matt75 to fix the issue:

If you have an error 500 on Orders > Delivery Slips with this error

Symfony\Component\Form\Exception\UnexpectedTypeException:
Expected argument of type "object, array or empty", "string" given

Execute this query

SELECT * FROM `ps_configuration_lang` WHERE `id_configuration` = (SELECT `id_configuration` FROM `ps_configuration` WHERE `name` LIKE 'PS_DELIVERY_PREFIX')

If no result, here is the issue.

So you can execute this query to create the language entry in ps_configuration_lang to solve the issue.

INSERT INTO `ps_configuration_lang` (`id_configuration`, `id_lang`, `value`) VALUES
(
  (SELECT `id_configuration` FROM `ps_configuration` WHERE `name` = 'PS_DELIVERY_PREFIX'),
  (SELECT `value` FROM `ps_configuration` WHERE `name` = 'PS_LANG_DEFAULT'),
  (SELECT `value` FROM `ps_configuration` WHERE `name` = 'PS_DELIVERY_PREFIX')
)

Of course you have to check if you use ps_ as table prefix before

In my opinion, something like the following code should be added to SQL upgrade script for 1.7.5.0:

INSERT INTO `ps_configuration_lang` (`id_configuration`, `id_lang`, `value`) VALUES
(
    SELECT
        `id_configuration`,
        (SELECT `value` FROM `ps_configuration` WHERE `name` = 'PS_LANG_DEFAULT'),
        `value`
    FROM `ps_configuration` c WHERE `name` = 'PS_DELIVERY_PREFIX'
    AND NOT EXISTS (SELECT 1 FROM `ps_configuration_lang` WHERE `id_configuration` = c.`id_configuration`)
)

Thanks in advance

1.7.5.0 Autoupgrade BO Delivery slip Fixed

Most helpful comment

It can be fixed in the autoupgrade module

All 9 comments

This issue could be fixed with some changes added in the SQL files, that's why I moved it from the autoupgrade repository.

Hi @rblaurin,

Could you please provide me the exact language/country did you used during the installation of your previous PrestaShop.
Because as I said in my previous issue: #12535, I installed fresh PrestaShop 1.7.4.4 French language/ France country, I created a delivery slips => make an upgrade with the 1-click upgrade v4.5.1. => OK => I checked the Orders > Delivery Slips" page & it is OK.
Thanks!

Hi @khouloudbelguith,

I used Brazil / Brazilian Portuguese in my previous PrestaShop. I made a lot of updates since the first instalation (version 1.2, I think), so I don't know if this issue occurs for something remaining from a previous update, but it crashes only when updating to 1.7.5.
The way to reproduce this error is having a system with no "PS_DELIVERY_PREFIX" key in ps_configuration_lang table. But I don't know what version of Prestashop generated this deficiency.

@rblaurin, I tried to install PS1.7.0.0. with Brazil / Brazilian, I checked the table "ps_configuration"
image
And the ps_configuration_lang table, the "PS_DELIVERY_PREFIX" key exists
image
Thanks!

@Matt75 says in the issue #12535 that it seems to be related to upgrades from previous versions of Prestashop (1.6 he said).
As I mentioned before, I am not sure about what version introduced this deficiency in database. Looking at the SQL upgrade scripts, the only upgrade that seems to change the "PS_DELIVERY_PREFIX" key is to 1.1.0.1.
* update: The sql upgrade script to 1.6.1.0 changes this key too. I am not sure if the bug could be related to this change.

Hi @rblaurin,

I tried with an old version 1.6.1.4, before the upgrade I checked the table "ps_configuration" and the ps_configuration_lang table, the "PS_DELIVERY_PREFIX" key exists.
I made an upgrade to PS1.7.5.0 & it is OK.
I attached a video record.
https://drive.google.com/file/d/1MfmIv3OnU2LTHyec8OeHFK5avatxmYQq/view
Despite our several trials, we could not reproduce your issue with the provided information.
It seems that your issue is not a PrestaShop's core bug but most likely a server configuration or customization problem.

Thanks!

@khouloudbelguith In fact this problem occurs when you have a shop with only one language and your PrestaShop come from very old version. Maybe from < 1.5 but I'm not sure
So it seems to be an issue from PrestaShop previous version who impact database and not fixed with upgrade

There are many merchants with similar issue :

Hi @Matt75,

Thanks for your feedback.
@marionf what do you think?
Thanks!

It can be fixed in the autoupgrade module

Was this page helpful?
0 / 5 - 0 ratings