Jump to content

Can't create new order, error thrown


Recommended Posts

Hi Everyone, I hope there is someone here who could shed some light on the issue I am having.

 

PrestaShop Version: 1.5.6.1

 

I have recently installed PrestaShop and have basically completed the project nearing ready for launch, except I can't create any orders, when I press the button create order I get an error:

 

"Property Order->id_customer is empty" (screenshot attached)

 

I originally installed version 1.5.6.0 as the first base and during the development time an update was released which I used the 1 click upgrade, the upgrade appeared to go smoothly with no errors.

 

I have checked the database and the cart in question has a valid customer id, I disabled all modules that hook into the order creation process, still the error persists.

 

This is also affecting the payment modules, PayPal and a custom payment module, they work fine show on the cart etc.. and re-direct to the payment pages, but again is the order creation that fails, I have found the function validateOrder in the payment module class, maybe the error lies here when obtaining the id form the cart?

 

This is my first experience with PrestaShop and can't believe it is failing to create an order, a main aspect of an eCommerce platform.

 

I hope someone could shed a little light or direct me where the issue could be.

 

Thank you in advance!

 

Seth

post-732569-0-31969900-1385899526_thumb.png

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

You'll need to trace the code and see where it breaks.

 

I would start in PaymentModule class, in the validateOrder function.  One of the first few lines of code takes the customer id from the cart, and uses it to create a Customer object. 

$this->context->customer = new Customer($this->context->cart->id_customer);

Then further below that same customer id is used to create the order.

$order->id_customer = (int)$this->context->cart->id_customer;

You should also confirm you have no override classes, and ensure your caches are cleared.  You could have an old object in cache that is messing things up.

Link to comment
Share on other sites

Hi bellini13,

 

Thank you for your reply, much appreciated, this issue is driving me nuts, did not expect this as every single other aspect of the store and it's development has been and works lovely, except the creation of the order.

 

Didn't think to clear the cache, I have now done that and still the same issue.

 

I did turn on the debug feature which showed nothing either, I also disabled the modules that I could see were hooked into the order/payment area and still the problem persists.

 

Yes I had already traced back to the PaymentModule, I now need to spend time, like you said to see where it is breaking and how it's losing the customer id.

 

I am getting the feeling it maybe linked to a module, I expect that this is not a problem with the initial PrestaShop installation, which I am doing on a another server with identical setup to rule that out.

 

Any other ideas or thoughts would be much welcomed :)

Link to comment
Share on other sites

Just a another note, every time I try to create an order in the BO, I obviously select the customer, who already has a cart.

 

When I click 'CreateOrder' and it fails with that notice, I see another empty cart has been created, even though I told it to use a current cart.

This happen every time, on different customer accounts also.

 

Thanks

Link to comment
Share on other sites

Another update, there are no overriding classes being used, I disabled all non PrestaShop modules, I reverted the theme back to the original one and all caching has been cleared and turned off and still the error persists.

 

I have made no modifications to the core code in any areas, debugging reveals nothing about the error.

 

I am no certain it must be a problem with the order/cart code, but why, has anyone had this issue with the newest version of PrestaShop 1.5.6.1?

 

Please, I am really need help here!

 

thank you

Link to comment
Share on other sites

Please can someone help here, I am having major problems with PrestShop and it's looking more and more like the core code itself is the issue.

 

I have ruled out the following and the problem still persists

  1. Caching (All caching has been cleared and disable)
  2. Modules (I uninstalled every single module and still can't create order)
  3. Override Classes (None are used in this setup)
  4. Theme (I removed the theme and set back to original)
  5. PaymentModule -> vaildateOrder() (When creating an order in admin, the process is not reaching the validateOrder method)

No I have ruled out all of the above when trying to create an order in the BO, I am now certain there is a problem in the core code.

 

I have the PayPal module installed, version 3.6.1 and was able to check out fine, but on the success return, PayPal through the following error, seems a different one to the above issue I am also having.

Notice: Undefined index: PAYMENTREQUEST_0_SHIPPINGAMT in /var/www/vhosts/wizardfancydress.co.uk/httpdocs/modules/paypal/paypal_orders.php on line 70 Fatal error: 
Uncaught exception 'PrestaShopException' with message 'Can't load Order state status' in /var/www/vhosts/wizardfancydress.co.uk/httpdocs/classes/PaymentModule.php:147 
Stack trace: 
#0 /var/www/vhosts/wizardfancydress.co.uk/httpdocs/modules/paypal/paypal.php(1236): PaymentModuleCore->validateOrder(38, 2, 0.98, 'PayPal', 'Payment accepte...', Array, 3, false, '77ad899f9e81e8d...', Object(Shop)) 
#1 /var/www/vhosts/wizardfancydress.co.uk/httpdocs/modules/paypal/express_checkout/payment.php(267): PayPal->validateOrder(38, 2, 0.98, 'PayPal', 'Payment accepte...', Array, 3, false, '77ad899f9e81e8d...', Object(Shop)) 
#2 /var/www/vhosts/wizardfancydress.co.uk/httpdocs/modules/paypal/express_checkout/payment.php(283): validateOrder(Object(Customer), Object(Cart), Object(PaypalExpressCheckout)) 
#3 {main} thrown in /var/www/vhosts/wizardfancydress.co.uk/httpdocs/classes/PaymentModule.php on line 147

PaymentModule Line

if (!Validate::isLoadedObject($order_status))
			throw new PrestaShopException('Can\'t load Order state status');

The previous issue raised is id_customer is empty, see this in the PaymentModule

$order->id_customer = (int)$this->context->cart->id_customer;

But I have ruled out validateOrder() when creating an order in BO, as it seems not to get that far.

 

Does anyone know if id_customer is fetched anywhere else before reaching the validateOrder() method?

 

I have been developing eCommerce sites for many years and have done countless osCommerce, ZenCart, Magento and various ASP based carts.

 

This is the first time a client has requested PrestaShop, I am shocked I am having these issues with it, never in all the countless different carts I have done over the years has the order creation process failed.

 

I feel I am getting closer to the problem, I am ruling many things out now, this is driving me crazy!

Link to comment
Share on other sites

  • 6 months later...
  • 1 month later...

Hi All,

 

Sorry been a while since being back on the Forums here.. since the issue I had above, everything has gone very smoothly with the store and do like the Prestashop Platform, find it much easier to develop with than Magento and osCommerce!

 

The issue above was nothing to do with the PayPal module or any module, I traced it to a fault in the database itself.

 

When I checked the table for order status', I found the table to be empty, not sure why as run the standard install, so I simply restored the status' table with the default values, re-activated the PayPal module and the issue disappeared.

 

I hope this can help someone else.

 

Kind regards

 

Seth

Link to comment
Share on other sites

Hi

 

Hi All,

 

Sorry been a while since being back on the Forums here.. since the issue I had above, everything has gone very smoothly with the store and do like the Prestashop Platform, find it much easier to develop with than Magento and osCommerce!

 

The issue above was nothing to do with the PayPal module or any module, I traced it to a fault in the database itself.

 

When I checked the table for order status', I found the table to be empty, not sure why as run the standard install, so I simply restored the status' table with the default values, re-activated the PayPal module and the issue disappeared.

 

I hope this can help someone else.

 

Kind regards

 

Seth

 

Hi, 

 

I have same problem, please, can you tell me mysql table name ?

 

In my presta are all this with "order"

 

orders.jpg

 

Best Regards

Carlos

Link to comment
Share on other sites

Hi

 

 

Hi, 

 

I have same problem, please, can you tell me mysql table name ?

 

In my presta are all this with "order"

 

orders.jpg

 

Best Regards

Carlos

 

Hi Carlos,

 

The 2 tables I found that were empty, preventing new orders to be created were..

 

ps_order_state

ps_order_state_lang

 

For some reason when I installed and was developing PrestaShop, both these tables were empty, once I inserted the default records, the orders started to go through.

 

Might not be the same issue you are having, but it was definitely the fix for the issue described above.

 

Personally if missing order status' were the reason the order creation was failing, this should be stated in the error message or at least logged.

 

I hope this helps.

 

Kind regards

 

Seth

Link to comment
Share on other sites

  • 2 months later...

Hi there ! 

 

I have the same issue, while trying to create a new order in the Prestashop BO this error pop-up on my screen 'Property Order->id_customer is empty' !

My installation was a 1.5.5 Prestashop before i update it to 1.6.0.9 with the 1 Click-upgrade module, exactly like you @wizardfancydress  ! But when i checked in my DB the order_state and order state_lang tables, they weren't empty ! :/ So i'm just lost right now, it's my first time on Prestashop and i'm approaching the deadline fixed by my boss. If you can help me to resolve this error, it will be really cool ! :)

 

Sorry for my rough english, i'm just a french student of 19y old who need a little bit of help ;)

 

 

Have a good day !

 

Anthony

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

Little update: I was thinking about this error and i wanna try to create a command on the originale version of the shop.

 

Same error here (the same, but with 1.5.5 error message, look at the screenshot).

So i think the problem was during the DB export. It was made by the web agency working on the project before me, so i'm gonna tell them that their export is causing some problems in the new shop.

 

I don't know why the export has failed :/

Do you have any ideas ?

 

 

Anthony

post-813313-0-15451500-1412761017_thumb.png

Link to comment
Share on other sites

Hi AnthonyCH,

 

Not sure how i can help you if you have the same problem but it's not related to the empty Status' tables...

 

Still you mention in the last post about problems exporting your database, well maybe your issue is database related as well, just like my issue was.

 

Have you turned on the debugging feature to start? The output will show in the footer area, have you checked the logs, see if they're any exceptions when accessing the database?

 

Did you have previous products, customers and orders you have imported to the new PrestaShop store?

 

As mentioned above by bellini13 have you tried tracing the code until it breaks?

 

Seth

Link to comment
Share on other sites

Hi !

 

I turned on the Dev mode on the defines files, but nothing more. The only log i see are the BO Log in the Admin Menus, you want me to check the prestashop error log ? I don't where i can find it on the BO, i'm working on a local installation for the moment, so i have the Wamp Logs for php errors and the prestashp log in the log folder.

But there's no error log for the moment.

 

 

Yeah the DB was exported with all the customers, products, orders and whatever you want of the previous shop.

 

I wanna tracing the code but for the moment i was too busy to check where the code breaks. If you have some ideas for files i can check tell me ;)

 

 

Anthony

Link to comment
Share on other sites

Hey !

 

After my last post, i recreate the shop with all the files, and the DB from de original extract i get from the web agency(in 1.5.5).

And after turning on the Dev Mode, i caught this error (screenshot) on my php errors log when i'm trying to create a command in BO.

 

Hope you can help me to understand this one ^^ !

 

 

Anthony

post-813313-0-65248500-1412771392_thumb.png

Link to comment
Share on other sites

Hi AnthonyCH,

 

Obviously this is very hard to help you with this, I am fairly new to PrestaShop also...

 

The error log messages are relating to a problem with Smarty, PrestaShop uses Smarty as it's template engine.

 

Have you tried setting up the store and doing everything, except importing the customer and order data?

 

Then try to create a new customer and a new order and see the results?

 

With little information and not actually looking at the store you have myself, it does seem related to this import, but then again it could be something completely different.

 

Seth

Link to comment
Share on other sites

Hi,

 

 

You mean setting up the shop with a new DB ? Or just remove the customers and orders informations from the DB and keep all the others tables ?

 

I'm pretty sure that the problem is from the DB and not an override or a module, cause i try to set my DB on a new clean shop without the files of my actual shop.

i wait my boss to give me his access on the production shop to make a new extract of the DB. We will see if the problems is from the DB or not ^^ !

 

I know it's really hard for you but thanks for trying to help :) !

 

 

 Anthony

Link to comment
Share on other sites

Hi Anthony,
 
Yes, set up a whole new shop on a new database, i.e. install from scratch.
 
Basically do everything to set up your new store except the part from importing the previous stores data.
 
If you're able to create a new customer and create an order for them, then it looks like a problem with the import.
 
Have you disabled all modules and any overrides you have set?
 
I mentioned about checking for any exceptions, in the root of your store installation there should be a log folder... 
 
If there are any exceptions being thrown, you should find them logged here as text files.
 
Also you asked about a place to start to look at where the code is breaking, the previous user bellini13 mentioned this, I have quoted it below.

 

 

You would start in PaymentModule class, in the validateOrder function.  One of the first few lines of code takes the customer id from the cart, and uses it to create a Customer object. 

$this->context->customer = new Customer($this->context->cart->id_customer);

Then further below that same customer id is used to create the order.

$order->id_customer = (int)$this->context->cart->id_customer;

You should also confirm you have no override classes, and ensure your caches are cleared.  You could have an old object in cache that is messing things up.

 

 

 

Regards

 

Seth

Link to comment
Share on other sites

Hi,

 

I have made a new shop totally clean, from new DB with a new installation of Prestashop. Nothing to report. With importation of my themes, and modules. Nothing to report too.

So i think it's the DB. The actual shop in production (in 1.5.5) has no problems with order creation so i think the DB export has failed cause nothing change change from the production installation to mine. I will try another export to be sure.

 

Do you think it's possible that the web agency made the export from phpmyadmin instead of using Prestashop BO to do this ? Or vice versa ?

 

 

Anthony

Link to comment
Share on other sites

Hi AnthonyCH,

 

It is looking very likely to be a problem with the import files, and yes they could have very well exported from the database using phpMyAdmin.

 

Did you check the log folder for any exceptions?

 

If you're able to, you should export a new fresh set yourself from the current web store and go from there.

 

Seth

Link to comment
Share on other sites

Hi,

 

For the log exception, nothing to report. 

 

So for the moment i will wait for my boss's access to make an export by myself !

 

 

Thank for helping me today ! Hope my problems will be solved !

If i find something new i will come back here ! Maybe some new users will have the same problem !

 

Have a good day !

 

 

Anthony

Link to comment
Share on other sites

  • 3 months later...

I had a problem with the OP error too. My programmer did not see it on his computer. I found using a different browser did not help. However When I went to the guest user of my computer with nothing much installed for that user .. no extra programs etc.. it worked!!!! So I went back to my user and Force Quit dropbox, flash and few other things so now I can not pinpoint the solution but it works fine now! So strange . 

Link to comment
Share on other sites

×
×
  • Create New...