Jump to content

[Résolu] Fatal error dans le menu factures


Recommended Posts

Bonjour à tous,<br/><br/><br/>Lorsque j'utilise le menu commandes / factures et que je clique sur "générer un fichier pdf" , j'ai une page blanche qui s'affiche quasiment instantanément avec seulement "Fatal error", pas d'autre message malgré l'activation du debug.<br/><br/>Ce message apparait quelque soit la période sélectionnée.<br/><br/>Par contre les BL marchent sans souci.<br/><br/><br/>Merci d'avance si vous avez une idée pour m'aider.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Bonjour,

 

Suite à une migration de 1.3 vers 1.4 je rencontre le même problème car dans les anciennes version on pouvait éditer la facture même si le panier était supprimé (modification du BO pour activer cette option).

 

La politique prestashop impose maintenant de conserver les paniers des commandes ;-(

 

J'ai fait ces requêtes, afin de pouvoir régénérer les paniers manquants à partir des commandes, à partir de phpMyAdmin ou de votre console MySQL

 

Je vous conseille quand même de faire une sauvegarde de votre BDD avant de les exécuter

 

 

Ajout des paniers manquants a partir des commandes (ps_orders -> ps_cart)

INSERT INTO ps_cart  ( id_cart,id_carrier, id_lang, id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd)
SELECT	id_cart,id_carrier,id_lang,id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd
 FROM ps_orders  WHERE id_carrier NOT IN
 (
  SELECT id_carrier FROM ps_cart
  )

 

Ajout des produits manquant au panier existant (ps_order_detail -> ps_cart_product)

INSERT INTO ps_cart_product ( id_cart,id_product,id_product_attribute,quantity,date_add )
SELECT ps_cart.id_cart,ps_order_detail.product_id,ps_order_detail.product_attribute_id,ps_order_detail.product_quantity,ps_cart.date_add
 FROM ps_cart LEFT JOIN ps_orders c ON (ps_cart.id_cart=c.id_cart)
 LEFT JOIN ps_order_detail ON (c.id_order=ps_order_detail.id_order)
 WHERE ps_cart.id_cart NOT IN
 (
  SELECT id_cart FROM ps_cart_product
  )

 

Si cela peut aider quelqu'un

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
  • 2 weeks later...
  • 6 months later...

Bonjour,

 

pour ma part j'ai essayé cette insertion en base de données mais l'exécution de la requête ne génère aucun enrigistrement.

 

le problème se pose après une migration vers prestashop et le rappartriement des commandes de l'ancien site internet.

j'uilise la version 1.4.7.3 de prestashop et MySQL: 5.0.51a

 

quelqu'un aurait-il une idée de la raison pour laquelle cela ne fonctionne pas, voir une solution à mon problème

 

par avance merci de votre aide

Link to comment
Share on other sites

  • 2 months later...

Bonjour Erotikat,

 

quand je fais l'ajout des paniers manquants mysql me répond :

#1062 - Duplicate entry '11' for key 'PRIMARY'

 

Ajout des paniers manquants a partir des commandes (ps_orders -> ps_cart)

INSERT INTO ps_cart  ( id_cart,id_carrier, id_lang, id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd)
SELECT	id_cart,id_carrier,id_lang,id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd
 FROM ps_orders  WHERE id_carrier NOT IN
 (
  SELECT id_carrier FROM ps_cart
  )

 

Je n'arrive pas a m'en sortir :(

 

Savez vous comment je peux faire ? je suis en 1.4.7 !

 

Merci de votre aide précieuse...

 

SebM

Link to comment
Share on other sites

  • 2 weeks later...

Bonjour,

 

Si vous avez cette erreur

#1062 - Duplicate entry '11' for key 'PRIMARY'

, cela veut dire que vous avez des paniers déjà existant.

Soit vous dropper votre table, en ayant fait une sauvegarde avant, soit vous rajouter une ligne en amont pour ignorer les erreurs.

 

Cdt

Link to comment
Share on other sites

  • 1 year later...

Is anyone subscribed to this topic?

I have same issue as OP and when i run query

#1062 - Duplicate entry '234574' for key 'PRIMARY'

 

I tried to translate the post above mine but not sure i understand what to do

Hi,

 

On which version of prestashop are you working ?

Because after 1.5.0.0, they have a new column in cart table (delivery_option) and they don't have a default value for it.....

 

So, i the case of version < 1.5, you just need to add IGNORE in front of INTO

INSERT IGNORE INTO ps_cart  ( id_cart,id_carrier, id_lang, id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd)
SELECT	id_cart,id_carrier,id_lang,id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd
  FROM ps_orders  WHERE id_carrier NOT IN
  (
   SELECT id_carrier FROM ps_cart
   )

But you can try another one request, same idear but a different way of condition

INSERT IGNORE INTO ps_cart  ( id_cart,id_carrier, id_lang, id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd)
SELECT	id_cart,id_carrier,id_lang,id_address_delivery,id_address_invoice,id_currency,id_customer,recyclable,gift,gift_message,date_add,date_upd
  FROM ps_orders
WHERE   NOT EXISTS
        (
        SELECT  NULL
        FROM    ps_cart c
        WHERE   c.id_carrier = ps_orders.id_carrier
        )

i hope is usefull

Erotikat

Link to comment
Share on other sites

I use prestashop 1.4.6.2

Tried to run first query you posted and it created carts, but only from 2010-2012. I deleted all carts on December 7 so all carts for 2013 until December 7 are missing

 

So it's resolved a part of your issue. (it's not complety bad)

This SQL request restore the cart of order only to be able to generated the invoice.

 

Have you got order since the last cart  restored ?

 

regards

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

Not sure if i understand your question. It only restored old carts, for some reason it skipped all carts for year 2013. I had orders after deleting carts and i can generate invoices for them, but i need to generate some from orders before i deleted carts. Any idea why it skipped them? 

Thanks

 

So it's resolved a part of your issue. (it's not complety bad)

This SQL request restore the cart of order only to be able to generated the invoice.

 

Have you got order since the last cart  restored ?

 

regards

Link to comment
Share on other sites

without your data it's to be difficult....

 

So help you in your resolve search :

 

1) Check the structure of the ps_cart table (To get columns description)

2) Found a order without cart (AA)

3) Check if AA.id_cart exist in ps_cart 

 

If id_cart exist : tried to change INSERT with UPDATE (need to modify the SQL request with a where condition or more)

If not, try INSERT in ps_cart with AA cloumns value and check the error

 

PS : I try to help you but i'm only a sailer, not a developer  :(

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