mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
fixed 3.8 error
This commit is contained in:
parent
6abb14dfb5
commit
2e03040c95
@ -1049,4 +1049,26 @@ class AdvsController extends PublicController
|
||||
$advModel->find($id)->update(['status' => 'approved']);
|
||||
}
|
||||
}
|
||||
|
||||
public function addCart(Request $request)
|
||||
{
|
||||
if (\auth()->check()) {
|
||||
$id = $request->id;
|
||||
$quantity = $request->quantity;
|
||||
$name = $request->name;
|
||||
$thisModel = new AdvModel();
|
||||
$adv = $thisModel->isAdv($id);
|
||||
$response = array();
|
||||
if ($adv) {
|
||||
$cart = $thisModel->addCart($adv, $quantity, $name);
|
||||
$response['status'] = "success";
|
||||
} else {
|
||||
$response['status'] = "error";
|
||||
$response['msg'] = trans('visiosoft.module.advs::message.error_added_cart');
|
||||
}
|
||||
} else {
|
||||
$response['status'] = "guest";
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@ -51,7 +51,7 @@ class CatsModulePlugin extends Plugin
|
||||
), new \Twig_SimpleFunction(
|
||||
'getParentsCount',
|
||||
function ($id) {
|
||||
return $this->categoryRepository->getParentCategoryById($id) - 1;
|
||||
return count($this->categoryRepository->getParentCategoryById($id)) - 1;
|
||||
}
|
||||
), new \Twig_SimpleFunction(
|
||||
'catIcon',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user