Skip to content

Commit 90b395a

Browse files
authored
Merge pull request #133 from kadricaabuk/out-of-stock-case-implemented
out of stock case implemented
2 parents 0f9b1d7 + ac8e5d3 commit 90b395a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

resources/lang/en/message.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@
4545
'error_operations_author' => "You cannot perform operations a post that do not belong to you!",
4646
'error_general' => 'An error was encountered. Contact the admin!',
4747

48-
'adv_create_success' => 'The ad has been successfully created'
48+
'adv_create_success' => 'The ad has been successfully created',
49+
'out_of_stock' => 'The product is out of stock.',
4950
];

resources/lang/tr/message.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
'error_general' => 'Bir hatayla karşılaşıldı. Yöneticiyle iletişime geçin!',
4747

4848

49-
'adv_create_success' => 'Ürün başarıyla oluşturuldu'
49+
'adv_create_success' => 'Ürün başarıyla oluşturuldu',
50+
'out_of_stock' => 'Stoklarımız tükenmiştir.'
5051
];

src/Http/Controller/AdvsController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,11 @@ public function addCart(Request $request)
14221422
$thisModel = new AdvModel();
14231423
$adv = $thisModel->isAdv($id);
14241424
$response = array();
1425+
if(!$adv->inStock()) {
1426+
$response['status'] = "error";
1427+
$response['msg'] = trans('visiosoft.module.advs::message.out_of_stock');
1428+
return $response;
1429+
}
14251430
if ($adv and $adv->getStatus() == "approved") {
14261431
$cart = $thisModel->addCart($adv, $quantity, $name);
14271432
$response['status'] = "success";

0 commit comments

Comments
 (0)