fix on customer auth, fix filters on shelves, refactor for article_nature, add slug

This commit is contained in:
ludo
2023-10-17 17:20:30 +02:00
parent 50d5d6944d
commit f3b9db1a6f
30 changed files with 1205 additions and 177 deletions

View File

@@ -19,25 +19,17 @@ class CategoryController extends Controller
public function show(Request $request, $categoryId, $articleNatureId = false)
{
$productTypes = Articles::getProductTypesWithOffers([
'category_id' => $categoryId,
]);
$articleNatures = Articles::getArticleNaturesWithOffers([
'category_id' => $categoryId,
]);
if ($articleNatureId) {
$productType = ArticleNatures::getProductType($articleNatureId);
dump($productType);
exit;
} else {
$articleNature = $request->input('article_nature');
if (! $articleNature) {
if (count($articleNatures) === 1) {
if (count($articleNatures)) {
$articleNature = $articleNatures[0];
} else {
$articleNature = 'semences';
}
}
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
@@ -61,7 +53,7 @@ class CategoryController extends Controller
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
];
// dump($data);
dump($data);
// exit;
return view('Shop.Shelves.shelve', $data);
}

View File

@@ -11,9 +11,7 @@ class CustomerController extends Controller
{
public function profile($id = false)
{
$data = Customers::editProfile($id);
return view('Shop.Customers.profile', $data);
return view('Shop.Customers.profile', Customers::editProfile($id));
}
public function modalProfile($id = false)
@@ -25,16 +23,14 @@ class CustomerController extends Controller
public function edit()
{
$id = Auth::id();
$data['customer'] = Customers::get($id, 'addresses')->toArray();
return view('Shop.Customers.edit', $data);
return view('Shop.Customers.edit', [
'customer' => Customers::getArray(Auth::id(), 'addresses'),
]);
}
public function storeProfileAjax(Request $request)
{
$data = $request->all();
$customer = Customers::store($data);
$customer = Customers::store($request->all());
return response()->json(['error' => 0]);
}

View File

@@ -37,6 +37,7 @@ class OrderController extends Controller
{
if (ShopCart::count()) {
$customer = Customers::getWithAddresses();
$data = [
'customer' => $customer ? $customer->toArray() : false,
'basket' => ShopCart::getSummary(),