Jump to content

Invalid Supplier id:0


EcoPets

Recommended Posts

Oops... looks like an unexpected error occurred.

Invalid Supplier id: 0

[PrestaShop\PrestaShop\Core\Domain\Supplier\Exception\SupplierException 0]

Prestashop 8.1.2 after upgrade from 1.7.8.10  This occurs on 1 site but not on another using the same Pshop version and PHP8.1 settings and same hosting, but on different shared servers.  Site 1 was working fine with Pshop 1.7.8.10 and PHP 7.4  Both installations are identical.  one is live and one is for testing.  Test site works with no problem the live site has this error

Error occurs in the BO on EVERY product.  Turning Debug mode on seems to indicate a problem with Supplierid.php but there is no such file in either installation.  This makes it impossible to edit any products on the live site.

Link to comment
Share on other sites

On 11/9/2023 at 9:02 PM, EcoPets said:

Well now I am locked out of the back office.  see attached. 

I looked in the ps_supplier table and there was only 1 supplier there and it was correct.

Screenshot 2023-11-09 at 12-58-48 The option dsn with value https __###.ingest.sentry.io_### is invalid. (500 Internal Server Error).png

Note that the DSN refers to the domain "sentry.io". Maybe your company is using some services from that company.

Link to comment
Share on other sites

I have no idea what "sentry.io" is.  I have no relationship with that entity that I am aware of.  But this link seems to indicate it could be some part of Prestashop?

It seems to follow much of what I was experiencing.  There is nothing on my hosting server regarding SENTRY.IO, so maybe it is something within Prestashop?

 

Link to comment
Share on other sites

28 minutes ago, EcoPets said:

I have no idea what "sentry.io" is.  I have no relationship with that entity that I am aware of.  But this link seems to indicate it could be some part of Prestashop?

It seems to follow much of what I was experiencing.  There is nothing on my hosting server regarding SENTRY.IO, so maybe it is something within Prestashop?

 

You are right. It is Prestashop that is using it. Try disabling the ps_mbo module. it has "https://###.ingest.sentry.io/###" in its settings.

Link to comment
Share on other sites

but doesn't that remove the Prestashop Marketplace?  Currently that module is not working at all and can't be reset.  it gives the error "Cannot Reset module ps_mbo. Property Tab->class_name is empty."

It seems that ps_mbo has always caused problems

 

Link to comment
Share on other sites

10 hours ago, EcoPets said:

but doesn't that remove the Prestashop Marketplace?  Currently that module is not working at all and can't be reset.  it gives the error "Cannot Reset module ps_mbo. Property Tab->class_name is empty."

It seems that ps_mbo has always caused problems

Who cares about the "Prestashop marketplace"? I have never used that menu option. Whenever I need a module I go straight to Addons.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I've also add this issue when migrating from 1.7.8.10 to 8.1.2
It appears because there is one or several rows for the edited product in table product_supplier, and in this row a value of 0 is provided for the column id_supplier.
 2 possibilities :
 - Your product is not related with any supplier, so you can safely remove this line.
 - Your product is not related with the good supplier, you need to patch this line to provide the good supplier id.

Regards,

Link to comment
Share on other sites

  • 9 months later...
  • 1 year later...

Pourquoi ça plante ?

Dans PrestaShop (surtout avec la Product Page v2), certaines parties passent par la couche “Domain” et un fournisseur doit avoir un id > 0.

Or, ton produit (ou ses associations) contient quelque part un id_supplier = 0 (valeur historique/legacy), et la page v2 n’aime plus ça → exception.

Le diagnostic rapide (SQL)

⚠️ Fais une sauvegarde DB avant.

1) Vérifier le fournisseur “par défaut” du produit

SELECT id_product, id_supplier FROM ps_product WHERE id_product = 11347;

Et aussi côté shop (important en multiboutique) :

SELECT id_product, id_shop, id_supplier FROM ps_product_shop WHERE id_product = 11347;

2) Vérifier les associations fournisseur du produit

SELECT * FROM ps_product_supplier WHERE id_product = 11347 ORDER BY id_product_attribute, id_supplier;

➡️ Si tu vois des lignes avec id_supplier = 0, tu as trouvé le coupable.

3) Vérifier que le supplier “défaut” existe vraiment

Si ps_product.id_supplier vaut X :

SELECT id_supplier, name, active FROM ps_supplier WHERE id_supplier = X;

Fix le plus simple (côté Back-Office)

Va sur le produit 11347 → onglet/section Fournisseurs (ou “Options” selon version) :

Ajoute au moins 1 fournisseur valide

Coche fournisseur par défaut

Enregistre

Si tu ne vois pas la section “Fournisseurs” :

Vérifie que la gestion des fournisseurs est activée dans les paramètres produits (selon version : Paramètres de la boutique > Paramètres produits / Catalog).

Fix direct en SQL (rapide si tu es bloqué)

Cas A — tu as des lignes ps_product_supplier avec supplier = 0

Supprime-les :

DELETE FROM ps_product_supplier WHERE id_product = 11347 AND id_supplier = 0;

Ensuite assure-toi que ps_product.id_supplier et ps_product_shop.id_supplier ne sont pas à 0 (voir cas B).

Cas B — le produit a id_supplier = 0

Tu as 2 options :

Option 1 (recommandée) : mettre un vrai fournisseur

Choisis un fournisseur existant :

SELECT id_supplier, name FROM ps_supplier ORDER BY id_supplier;

Mets-le en fournisseur par défaut :

UPDATE ps_product SET id_supplier = 1 WHERE id_product = 11347; UPDATE ps_product_shop SET id_supplier = 1 WHERE id_product = 11347;

Assure une ligne dans ps_product_supplier (au minimum pour id_product_attribute = 0) :

INSERT INTO ps_product_supplier (id_product, id_product_attribute, id_supplier, product_supplier_reference, product_supplier_price_te, id_currency) SELECT 11347, 0, 1, '', 0, 1 WHERE NOT EXISTS ( SELECT 1 FROM ps_product_supplier WHERE id_product=11347 AND id_product_attribute=0 AND id_supplier=1 );

⚠️ id_currency = 1 chez beaucoup de shops, mais vérifie ton ID devise si besoin.

Option 2 : désactiver la feature v2 (contournement)

Si tu dois juste débloquer vite et que tu sais que c’est lié à la page produit v2, tu peux désactiver le feature flag product_page_v2 (tu as une requête dessus dans le log).
Mais c’est un contournement : le bon fix reste de corriger les données fournisseur.

D’où ça vient, en général ?

Les causes les plus fréquentes :

Produit importé/migré avec id_supplier=0

Module d’import qui écrit des associations fournisseur incohérentes (ps_product_supplier avec supplier 0)

Multi-boutique : ps_product OK mais ps_product_shop resté à 0 (ou l’inverse)

Link to comment
Share on other sites

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