Skip to content

Commit

Permalink
[ADD] Events for SEO.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seiger committed Nov 18, 2024
1 parent 65c9953 commit 9d5ba0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion module/sCommerceModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '');
Expand All @@ -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();
Expand All @@ -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);
/*
|--------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions views/contentTab.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
@endif
@endforeach--}}
</div>
@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
</form>

@push('scripts.bot')
Expand Down

0 comments on commit 9d5ba0f

Please sign in to comment.