fishordog Posted December 11, 2013 Share Posted December 11, 2013 (edited) I installed Database Optimize Moodule by mypresta.eu and deleted abandoned carts. My store is on 1.4.6.2 version and after i deleted carts i'm getting Fatal Error every time i generate invoice. I can generate any invoice for new orders though. Is there any way to fix this? I have a db backup, but don't want to restore it because i already have new orders/registrations. Thanks Edited December 11, 2013 by SeVi (see edit history) Link to comment Share on other sites More sharing options...
Radu Posted December 11, 2013 Share Posted December 11, 2013 what kind of fatal error do you get? Link to comment Share on other sites More sharing options...
vekia Posted December 11, 2013 Share Posted December 11, 2013 hello turn on error reporting: open config/defines.inc.php find this line define('_PS_MODE_DEV_', false); change to look like this: define('_PS_MODE_DEV_', true); then please share full error code Link to comment Share on other sites More sharing options...
fishordog Posted December 11, 2013 Author Share Posted December 11, 2013 (edited) i just enabled error reporting. What part of it should i post here? I don't think i can share all of it, because its a live store what kind of fatal error do you get? hello turn on error reporting: open config/defines.inc.php find this line define('_PS_MODE_DEV_', false); change to look like this: define('_PS_MODE_DEV_', true); then please share full error code Edited December 11, 2013 by SeVi (see edit history) Link to comment Share on other sites More sharing options...
fishordog Posted December 11, 2013 Author Share Posted December 11, 2013 i edited some stuff so i can post it Array( [0] => Array ( [file] => /home/storename/public_html/store/classes/Cart.php [line] => 215 [function] => displayError [class] => ToolsCore [type] => :: [args] => Array ( ) ) [1] => Array ( [file] => /home/storename/public_html/store/classes/Order.php [line] => 509 [function] => getTaxesAverageUsed [class] => CartCore [type] => :: [args] => Array ( [0] => 809141 ) ) [2] => Array ( [file] => /home/storename/public_html/store/classes/PDF.php [line] => 671 [function] => getTaxesAverageUsed [class] => OrderCore [object] => Order Object ( [id_address_delivery] => 75547 [id_address_invoice] => 75547 [id_cart] => 809141 [id_currency] => 2 [id_lang] => 1 [id_customer] => 440971 [id_carrier] => 56 [secure_key] => securekey [payment] => Authorize.net AIM (Advanced Integration Method) [module] => authorizeaim [conversion_rate] => 1.000000 [recyclable] => 0 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => 0.00 [total_paid] => 15.93 [total_paid_real] => 15.93 [total_products] => 11.98 [total_products_wt] => 11.98 [total_shipping] => 3.95 [carrier_tax_rate] => 0.000 [total_wrapping] => 0.00 [invoice_number] => 50391 [delivery_number] => 38029 [invoice_date] => 2013-12-06 17:06:54 [delivery_date] => 2013-12-10 22:22:50 [valid] => 1 [date_add] => 2013-12-06 17:06:54 [date_upd] => 2013-12-10 22:22:50 [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => conversion_rate [1] => id_address_delivery [2] => id_address_invoice [3] => id_cart [4] => id_currency [5] => id_lang [6] => id_customer [7] => id_carrier [8] => payment [9] => total_paid [10] => total_paid_real [11] => total_products [12] => total_products_wt ) [fieldsValidate:protected] => Array ( [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_cart] => isUnsignedId [id_currency] => isUnsignedId [id_lang] => isUnsignedId [id_customer] => isUnsignedId [id_carrier] => isUnsignedId [secure_key] => isMd5 [payment] => isGenericName [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [total_discounts] => isPrice [total_paid] => isPrice [total_paid_real] => isPrice [total_products] => isPrice [total_products_wt] => isPrice [total_shipping] => isPrice [carrier_tax_rate] => isFloat [total_wrapping] => isPrice [shipping_number] => isUrl [conversion_rate] => isFloat ) [webserviceParameters:protected] => Array ( [objectMethods] => Array ( [add] => addWs ) [objectNodeName] => order [objectsNodeName] => orders [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_cart] => Array ( [xlink_resource] => carts ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_lang] => Array ( [xlink_resource] => languages ) [id_customer] => Array ( [xlink_resource] => customers ) [id_carrier] => Array ( [xlink_resource] => carriers ) [module] => Array ( [required] => 1 ) [invoice_number] => Array ( ) [invoice_date] => Array ( ) [delivery_number] => Array ( ) [delivery_date] => Array ( ) [valid] => Array ( ) [current_state] => Array ( [getter] => getCurrentState [setter] => setCurrentState [xlink_resource] => order_states ) [date_add] => Array ( ) [date_upd] => Array ( ) ) [associations] => Array ( [order_rows] => Array ( [resource] => order_row [setter] => [virtual_entity] => 1 [fields] => Array ( [id] => Array ( ) [product_id] => Array ( [required] => 1 ) [product_attribute_id] => Array ( [required] => 1 ) [product_quantity] => Array ( [required] => 1 ) [product_name] => Array ( [setter] => ) [product_price] => Array ( [setter] => ) ) ) ) ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:protected] => 0 [id] => 70520 [fieldsSize:protected] => Array ( ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg ) [type] => -> [args] => Array ( ) ) [3] => Array ( [file] => /home/storename/public_html/store/admin/pdf.php [line] => 61 [function] => invoice [class] => PDFCore [type] => :: [args] => Array ( [0] => Order Object ( [id_address_delivery] => 75547 [id_address_invoice] => 75547 [id_cart] => 809141 [id_currency] => 2 [id_lang] => 1 [id_customer] => 440971 [id_carrier] => 56 [secure_key] => securekey [payment] => Authorize.net AIM (Advanced Integration Method) [module] => authorizeaim [conversion_rate] => 1.000000 [recyclable] => 0 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => 0.00 [total_paid] => 15.93 [total_paid_real] => 15.93 [total_products] => 11.98 [total_products_wt] => 11.98 [total_shipping] => 3.95 [carrier_tax_rate] => 0.000 [total_wrapping] => 0.00 [invoice_number] => 50391 [delivery_number] => 38029 [invoice_date] => 2013-12-06 17:06:54 [delivery_date] => 2013-12-10 22:22:50 [valid] => 1 [date_add] => 2013-12-06 17:06:54 [date_upd] => 2013-12-10 22:22:50 [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => conversion_rate [1] => id_address_delivery [2] => id_address_invoice [3] => id_cart [4] => id_currency [5] => id_lang [6] => id_customer [7] => id_carrier [8] => payment [9] => total_paid [10] => total_paid_real [11] => total_products [12] => total_products_wt ) [fieldsValidate:protected] => Array ( [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_cart] => isUnsignedId [id_currency] => isUnsignedId [id_lang] => isUnsignedId [id_customer] => isUnsignedId [id_carrier] => isUnsignedId [secure_key] => isMd5 [payment] => isGenericName [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [total_discounts] => isPrice [total_paid] => isPrice [total_paid_real] => isPrice [total_products] => isPrice [total_products_wt] => isPrice [total_shipping] => isPrice [carrier_tax_rate] => isFloat [total_wrapping] => isPrice [shipping_number] => isUrl [conversion_rate] => isFloat ) [webserviceParameters:protected] => Array ( [objectMethods] => Array ( [add] => addWs ) [objectNodeName] => order [objectsNodeName] => orders [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_cart] => Array ( [xlink_resource] => carts ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_lang] => Array ( [xlink_resource] => languages ) [id_customer] => Array ( [xlink_resource] => customers ) [id_carrier] => Array ( [xlink_resource] => carriers ) [module] => Array ( [required] => 1 ) [invoice_number] => Array ( ) [invoice_date] => Array ( ) [delivery_number] => Array ( ) [delivery_date] => Array ( ) [valid] => Array ( ) [current_state] => Array ( [getter] => getCurrentState [setter] => setCurrentState [xlink_resource] => order_states ) [date_add] => Array ( ) [date_upd] => Array ( ) ) [associations] => Array ( [order_rows] => Array ( [resource] => order_row [setter] => [virtual_entity] => 1 [fields] => Array ( [id] => Array ( ) [product_id] => Array ( [required] => 1 ) [product_attribute_id] => Array ( [required] => 1 ) [product_quantity] => Array ( [required] => 1 ) [product_name] => Array ( [setter] => ) [product_price] => Array ( [setter] => ) ) ) ) ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:protected] => 0 [id] => 70520 [fieldsSize:protected] => Array ( ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg ) ) ) [4] => Array ( [function] => generateInvoicePDF [args] => Array ( ) ) [5] => Array ( [file] => /home/storename/public_html/store/admin/pdf.php [line] => 50 [function] => call_user_func [args] => Array ( [0] => generateInvoicePDF ) ) ) Link to comment Share on other sites More sharing options...
fishordog Posted December 11, 2013 Author Share Posted December 11, 2013 (edited) I tried to fix it by running a mysql query 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_updFROM ps_orders WHERE id_carrier NOT IN(SELECT id_carrier FROM ps_cart) It created carts for older orders from 2010-2012 but for some reason not for this year Edited December 11, 2013 by SeVi (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted December 11, 2013 Share Posted December 11, 2013 please share error code, especially fatal errors Link to comment Share on other sites More sharing options...
fishordog Posted December 11, 2013 Author Share Posted December 11, 2013 (edited) i posted it 2 posts above. This is what i get when i turn error reporting on Array ( [0] => Array ( [file] => /home/storename/public_html/store/classes/Cart.php [line] => 215 [function] => displayError [class] => ToolsCore [type] => :: [args] => Array ( ) ) [1] => Array ( [file] => /home/storename/public_html/store/classes/Order.php [line] => 509 [function] => getTaxesAverageUsed [class] => CartCore [type] => :: [args] => Array ( [0] => 809141 ) ) [2] => Array ( [file] => /home/storename/public_html/store/classes/PDF.php [line] => 671 [function] => getTaxesAverageUsed [class] => OrderCore [object] => Order Object ( [id_address_delivery] => 75547 [id_address_invoice] => 75547 [id_cart] => 809141 [id_currency] => 2 [id_lang] => 1 [id_customer] => 440971 [id_carrier] => 56 [secure_key] => securekey [payment] => Authorize.net AIM (Advanced Integration Method) [module] => authorizeaim [conversion_rate] => 1.000000 [recyclable] => 0 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => 0.00 [total_paid] => 15.93 [total_paid_real] => 15.93 [total_products] => 11.98 [total_products_wt] => 11.98 [total_shipping] => 3.95 [carrier_tax_rate] => 0.000 [total_wrapping] => 0.00 [invoice_number] => 50391 [delivery_number] => 38029 [invoice_date] => 2013-12-06 17:06:54 [delivery_date] => 2013-12-10 22:22:50 [valid] => 1 [date_add] => 2013-12-06 17:06:54 [date_upd] => 2013-12-10 22:22:50 [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => conversion_rate [1] => id_address_delivery [2] => id_address_invoice [3] => id_cart [4] => id_currency [5] => id_lang [6] => id_customer [7] => id_carrier [8] => payment [9] => total_paid [10] => total_paid_real [11] => total_products [12] => total_products_wt ) [fieldsValidate:protected] => Array ( [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_cart] => isUnsignedId [id_currency] => isUnsignedId [id_lang] => isUnsignedId [id_customer] => isUnsignedId [id_carrier] => isUnsignedId [secure_key] => isMd5 [payment] => isGenericName [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [total_discounts] => isPrice [total_paid] => isPrice [total_paid_real] => isPrice [total_products] => isPrice [total_products_wt] => isPrice [total_shipping] => isPrice [carrier_tax_rate] => isFloat [total_wrapping] => isPrice [shipping_number] => isUrl [conversion_rate] => isFloat ) [webserviceParameters:protected] => Array ( [objectMethods] => Array ( [add] => addWs ) [objectNodeName] => order [objectsNodeName] => orders [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_cart] => Array ( [xlink_resource] => carts ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_lang] => Array ( [xlink_resource] => languages ) [id_customer] => Array ( [xlink_resource] => customers ) [id_carrier] => Array ( [xlink_resource] => carriers ) [module] => Array ( [required] => 1 ) [invoice_number] => Array ( ) [invoice_date] => Array ( ) [delivery_number] => Array ( ) [delivery_date] => Array ( ) [valid] => Array ( ) [current_state] => Array ( [getter] => getCurrentState [setter] => setCurrentState [xlink_resource] => order_states ) [date_add] => Array ( ) [date_upd] => Array ( ) ) [associations] => Array ( [order_rows] => Array ( [resource] => order_row [setter] => [virtual_entity] => 1 [fields] => Array ( [id] => Array ( ) [product_id] => Array ( [required] => 1 ) [product_attribute_id] => Array ( [required] => 1 ) [product_quantity] => Array ( [required] => 1 ) [product_name] => Array ( [setter] => ) [product_price] => Array ( [setter] => ) ) ) ) ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:protected] => 0 [id] => 70520 [fieldsSize:protected] => Array ( ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg ) [type] => -> [args] => Array ( ) ) [3] => Array ( [file] => /home/storename/public_html/store/admin/pdf.php [line] => 61 [function] => invoice [class] => PDFCore [type] => :: [args] => Array ( [0] => Order Object ( [id_address_delivery] => 75547 [id_address_invoice] => 75547 [id_cart] => 809141 [id_currency] => 2 [id_lang] => 1 [id_customer] => 440971 [id_carrier] => 56 [secure_key] => securekey [payment] => Authorize.net AIM (Advanced Integration Method) [module] => authorizeaim [conversion_rate] => 1.000000 [recyclable] => 0 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => 0.00 [total_paid] => 15.93 [total_paid_real] => 15.93 [total_products] => 11.98 [total_products_wt] => 11.98 [total_shipping] => 3.95 [carrier_tax_rate] => 0.000 [total_wrapping] => 0.00 [invoice_number] => 50391 [delivery_number] => 38029 [invoice_date] => 2013-12-06 17:06:54 [delivery_date] => 2013-12-10 22:22:50 [valid] => 1 [date_add] => 2013-12-06 17:06:54 [date_upd] => 2013-12-10 22:22:50 [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => conversion_rate [1] => id_address_delivery [2] => id_address_invoice [3] => id_cart [4] => id_currency [5] => id_lang [6] => id_customer [7] => id_carrier [8] => payment [9] => total_paid [10] => total_paid_real [11] => total_products [12] => total_products_wt ) [fieldsValidate:protected] => Array ( [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_cart] => isUnsignedId [id_currency] => isUnsignedId [id_lang] => isUnsignedId [id_customer] => isUnsignedId [id_carrier] => isUnsignedId [secure_key] => isMd5 [payment] => isGenericName [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [total_discounts] => isPrice [total_paid] => isPrice [total_paid_real] => isPrice [total_products] => isPrice [total_products_wt] => isPrice [total_shipping] => isPrice [carrier_tax_rate] => isFloat [total_wrapping] => isPrice [shipping_number] => isUrl [conversion_rate] => isFloat ) [webserviceParameters:protected] => Array ( [objectMethods] => Array ( [add] => addWs ) [objectNodeName] => order [objectsNodeName] => orders [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_cart] => Array ( [xlink_resource] => carts ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_lang] => Array ( [xlink_resource] => languages ) [id_customer] => Array ( [xlink_resource] => customers ) [id_carrier] => Array ( [xlink_resource] => carriers ) [module] => Array ( [required] => 1 ) [invoice_number] => Array ( ) [invoice_date] => Array ( ) [delivery_number] => Array ( ) [delivery_date] => Array ( ) [valid] => Array ( ) [current_state] => Array ( [getter] => getCurrentState [setter] => setCurrentState [xlink_resource] => order_states ) [date_add] => Array ( ) [date_upd] => Array ( ) ) [associations] => Array ( [order_rows] => Array ( [resource] => order_row [setter] => [virtual_entity] => 1 [fields] => Array ( [id] => Array ( ) [product_id] => Array ( [required] => 1 ) [product_attribute_id] => Array ( [required] => 1 ) [product_quantity] => Array ( [required] => 1 ) [product_name] => Array ( [setter] => ) [product_price] => Array ( [setter] => ) ) ) ) ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:protected] => 0 [id] => 70520 [fieldsSize:protected] => Array ( ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg ) ) ) [4] => Array ( [function] => generateInvoicePDF [args] => Array ( ) ) [5] => Array ( [file] => /home/storename/public_html/store/admin/pdf.php [line] => 50 [function] => call_user_func [args] => Array ( [0] => generateInvoicePDF ) ) ) Edited December 11, 2013 by SeVi (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted December 11, 2013 Share Posted December 11, 2013 this is error code? it doesn't look like php error log code. im going to analyse this arrays. Link to comment Share on other sites More sharing options...
fishordog Posted December 11, 2013 Author Share Posted December 11, 2013 Yep. If error reporting is off i just get Fatal Error, when its on i get the code i posted Link to comment Share on other sites More sharing options...
tuk66 Posted December 12, 2013 Share Posted December 12, 2013 You can't delete old carts (tables ps_cart, ps_cart_product, ps_cart_discount). They are connected to the orders and you can't create invoice if some record in database is missing. I think the only solution can be to restore database from the last backup. Link to comment Share on other sites More sharing options...
fishordog Posted December 12, 2013 Author Share Posted December 12, 2013 (edited) You can't delete old carts (tables ps_cart, ps_cart_product, ps_cart_discount). They are connected to the orders and you can't create invoice if some record in database is missing. I think the only solution can be to restore database from the last backup. Is there a way to create carts from existing orders? Or it's not gonna fix the problem? Edited December 12, 2013 by SeVi (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted December 13, 2013 Share Posted December 13, 2013 You have the backup so why create deleted records from orders? Link to comment Share on other sites More sharing options...
fishordog Posted December 13, 2013 Author Share Posted December 13, 2013 I already have alot of new customer registrations/orders Link to comment Share on other sites More sharing options...
tuk66 Posted December 16, 2013 Share Posted December 16, 2013 I see. My opinion is that the only way is to take the backup and the live database and prepare SQL queries to merge both. Link to comment Share on other sites More sharing options...
fishordog Posted December 19, 2013 Author Share Posted December 19, 2013 I see. My opinion is that the only way is to take the backup and the live database and prepare SQL queries to merge both. Ok thanks, i will try to do that. Do you have any idea why following query created some carts, and skipped others? 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 ) Link to comment Share on other sites More sharing options...
tuk66 Posted December 20, 2013 Share Posted December 20, 2013 The cart consist of the ps_cart, ps_cart_product and other tables (according to PrestaShop version). I can't say more without knowing your data. Link to comment Share on other sites More sharing options...
Recommended Posts