Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numeric value out of range #20

Open
ubaidillahumar opened this issue Jul 17, 2017 · 7 comments
Open

numeric value out of range #20

ubaidillahumar opened this issue Jul 17, 2017 · 7 comments

Comments

@ubaidillahumar
Copy link

when I order the product, I got error :

SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in '(store.products.product_qty - 1)' (SQL: update products set product_qty = product_qty - 1)

please help me.

@davidtrushkov
Copy link
Owner

Thats saying the value for row 'product_qty' is out of range. 'product_qty' cant be less than the number 0. There is a row in table where 'product_qty' is less than 0

@ubaidillahumar
Copy link
Author

ubaidillahumar commented Jul 17, 2017 via email

@davidtrushkov
Copy link
Owner

Did that solution solve your problem?

@ubaidillahumar
Copy link
Author

ubaidillahumar commented Aug 2, 2017

yes Mr, thanks you a lot for your great application.

@ubaidillahumar
Copy link
Author

was solved after change the code to :
foreach ($cart_products as $order_products) { $order->orderItems()->attach($order_products->product_id, array( 'qty' => $order_products->qty, 'price' => $order_products->products->price, 'reduced_price' => $order_products->products->reduced_price, 'total' => $order_products->products->price * $order_products->qty, 'total_reduced' => $order_products->products->reduced_price * $order_products->qty, )); \DB::table('products') ->where('id', '=', $order_products->product_id) ->decrement('product_qty', $order_products->qty); }

@ubaidillahumar
Copy link
Author

ubaidillahumar commented Aug 2, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants