0
I am getting "500 internal server error" when checkout or transfer.
attached screenshot for your reference.
log:
production.ERROR: Attempt to read property "name" on null {"userId":1,"exception":"[object] (ErrorException(code: 0): Attempt to read property "name" on null at /var/www/html/mydomain.com/app/Helpers/CheckOverSelling.php:48)
0
Hello,
Please use item unit or you can edit the file pp/Helpers/CheckOverSelling.php
to replace ->name
with ?->name
Thank you
0
I have replaced ->name with ?->name but still showing stock 0 on checkout.
class CheckOverSelling
{
public function check($order_items, $warehouse_id)
{
$error = [];
$items = Item::whereIn('id', collect($order_items)->pluck('item_id'))->with(['unit.subunits', 'stock' => fn ($q) => $q->ofWarehouse($warehouse_id)])->get();
foreach ($order_items as $key => $order_item) {
$old_quantity = 0;
$base_quantity = 0;
$unit = null;
$item = $items->where('id', $order_item['item_id'])->first();
if (isset($order_item['selected']) && isset($order_item['selected']['variations']) && ! empty($order_item['selected']['variations'])) {
foreach ($order_item['selected']['variations'] as $order_variation) {
$quantity = $order_variation['quantity'] + 0;
$old_quantity = isset($order_variation['old_quantity']) ? (float) $order_variation['old_quantity'] : 0;
$quantity = $old_quantity ? $quantity - $old_quantity : $quantity;
$variation = Variation::with(['stock' => fn ($q) => $q->ofWarehouse($warehouse_id)])->find($order_variation['variation_id']);
$unit = $order_variation['unit_id'] ? $item->unit->subunits->where('id', $order_variation['unit_id'])->first() : null;
$variationStock = $variation->stock->where('warehouse_id', $warehouse_id)->first();
$base_quantity = $unit ? convert_to_base_quantity($quantity, $unit) : $quantity;
$meta = [];
foreach ($variation->meta as $variant => $option) {
$meta[] = $variant . ': ' . $option;
}
if (! $variationStock) {
$error["items.{$key}.quantity"] = __choice('{name} ({variant}) do not have {quantity} in stock, available quantity {available}.', ['name' => $order_item['name'], 'quantity' => $quantity . ' ' . ($unit ? $unit?->name : $item->unit?->name), 'available' => '0 ' . $item->unit?->name, 'variant' => implode(', ', $meta)]);
} elseif ($base_quantity && $variationStock->quantity < $base_quantity) {
$error["items.{$key}.quantity"] = __choice('{name} ({variant}) do not have {quantity} in stock, available quantity {available}.', ['name' => $order_item['name'], 'quantity' => $quantity . ' ' . ($unit ? $unit?->name : $item->unit?->name), 'available' => ((float) $variationStock->quantity) . ' ' . $item->unit?->name, 'variant' => implode(', ', $meta)]);
}
}
} else {
$quantity = $order_item['quantity'] + 0;
$old_quantity = isset($order_item['old_quantity']) ? (float) $order_item['old_quantity'] : 0;
$quantity = $old_quantity ? $quantity - $old_quantity : $quantity;
$unit = $order_item['unit_id'] ? $item->unit->subunits->where('id', $order_item['unit_id'])->first() : null;
$stock = $item->stock->where('warehouse_id', $warehouse_id)->first();
$base_quantity = $unit ? convert_to_base_quantity($quantity, $unit) : $quantity;
if (! $stock) {
$error["items.{$key}.quantity"] = __choice('{name} do not have {quantity} in stock, available quantity {available}.', ['name' => $order_item['name'], 'quantity' => $quantity . ' ' . ($unit ? $unit?->name : $item->unit?->name), 'available' => '0 ' . $item->unit?->name]);
} elseif ($base_quantity && $stock->quantity < $base_quantity) {
$error["items.{$key}.quantity"] = __choice('{name} do not have {quantity} in stock, available quantity {available}.', ['name' => $order_item['name'], 'quantity' => $quantity . ' ' . ($unit ? $unit?->name : $item->unit?->name), 'available' => ((float) $stock->quantity) . ' ' . $item->unit?->name]);
}
}
}
return $error;
}
}
0
Hello dear any update?
0
Hello,
Yes, you add stock by checkin. You can check the list items page for current stock. If the items page shows the 6 pc quantity and you can't add checkout. Please let me know your installation url with login details in private reply so that I can check.
Thank you
0
Thanks. The stock has started showing up. but I have another question regarding the "Rack" field on the item page. usually, an item may be stored in different warehouses and kept in different Racks. in that case, I think the Rack number fields should be along with the warehouse field on the Check-In page.
1
Hello,
In current version rack is for item and same rack used for warehouses. I will add option to set different rank for warehouses.
Thank you
0
Thank you!
NB: Adding a rack at the check-in page is good because when creating an item it does not physically keep the Item on the rack. usually, at check-in time only it decides where to store the item.
We use Cookies
We use cookies to ensure that we give you the best experience on our website. By continuing to browse the site you are agreeing to our use of cookies.