@extends('layouts.app')
@section('content')
@php
function turkce_seo($text)
{
$find = ['Ç', 'Ş', 'Ğ', 'Ü', 'İ', 'Ö', 'ç', 'ş', 'ğ', 'ü', 'ö', 'ı', '+', '#'];
$replace = ['c', 's', 'g', 'u', 'i', 'o', 'c', 's', 'g', 'u', 'o', 'i', 'plus', 'sharp'];
$text = strtolower(str_replace($find, $replace, $text));
$text = preg_replace('@[^A-Za-z0-9\-_\.\+]@i', ' ', $text);
$text = trim(preg_replace('/\s+/', ' ', $text));
$text = str_replace(' ', '-', $text);
return $text;
}
function generateMenu($json)
{
$menuItems = json_decode($json);
$groupedItems = [];
// Parenti 0 olanları grupla
foreach ($menuItems as $menuItem) {
if ($menuItem->menuParent == 0) {
$groupedItems[$menuItem->id] = $menuItem;
}
}
$menu = '
';
$menu = "". $title ."
" . $menu;
return $menu;
}
@endphp
{!! generateMenu(json_encode($category_all)) !!}
{{ App::getLocale() == 'tr' ? $category->menuTitle : $category->menuTitleEn }}
@foreach ($exportData as $data)
@if($data['category_id'] != $current_category)
{{ App::getLocale() == 'tr' ? $data['menuTitle'] : $data['menuTitleEn'] }}
@endif
@foreach ($data['urunler'] as $key => $item)
@php $item = $item[0] @endphp
@if ($item->cat_id != $current_category)
{!! productGenerator($item) !!}
@endif
@endforeach
@endforeach
@if(array_key_exists($current_category, $exportData))
@foreach ($exportData[$current_category]['urunler'] as $key => $item)
@php $item = $item[0] @endphp
{!! productGenerator($item) !!}
@endforeach
@endif
@endsection