From 9d5ba0faec477e01f6b814c7e29dac84295db045 Mon Sep 17 00:00:00 2001 From: Serhii Korneliuk Date: Mon, 18 Nov 2024 17:55:17 +0200 Subject: [PATCH] [ADD] Events for SEO. --- module/sCommerceModule.php | 3 ++- views/contentTab.blade.php | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/module/sCommerceModule.php b/module/sCommerceModule.php index 04161d6..8ff4ce7 100644 --- a/module/sCommerceModule.php +++ b/module/sCommerceModule.php @@ -684,6 +684,7 @@ } $contentField = str_replace([chr(9), chr(10), chr(13), ' '], '', $contentField); + $product = sCommerce::getProduct($requestId); $content = sProductTranslate::whereProduct($requestId)->whereLang($requestLang)->firstOrNew(); $content->pagetitle = request()->input('pagetitle', ''); $content->longtitle = request()->input('longtitle', ''); @@ -692,7 +693,6 @@ $content->builder = json_encode(array_values(request()->input('builder', []))); $content->constructor = json_encode(request()->input('constructor', [])); if (($content->product ?? 0) == 0) { - $product = sCommerce::getProduct($requestId); if (!$product->id) { $product->alias = $sCommerceController->validateAlias(trim($content->pagetitle) ?: 'new-product', $requestId); $product->save(); @@ -708,6 +708,7 @@ $_SESSION['itemname'] = $product->title; $sCommerceController->setProductsListing(); $back = str_replace('&i=0', '&i=' . $content->product, (request()->back ?? '&get=product')); + evo()->invokeEvent('sCommerceAfterProductContentSave', compact('product', 'content')); return header('Location: ' . sCommerce::moduleUrl() . $back); /* |-------------------------------------------------------------------------- diff --git a/views/contentTab.blade.php b/views/contentTab.blade.php index 5867793..30947fa 100644 --- a/views/contentTab.blade.php +++ b/views/contentTab.blade.php @@ -115,6 +115,9 @@ @endif @endforeach--}} + @if(is_array($events = evo()->invokeEvent('sCommerceFormFieldRender', ['field' => 'seo', 'lang' => request()->input('lang', $sCommerceController->langDefault()), 'dataInput' => $sCommerceController->getData()]))) + @foreach($events as $event){!!$event!!}@endforeach + @endif @push('scripts.bot')