added fav product with meta theme part

pull/44/head
A1Gard 2 months ago
parent 229fc5204b
commit 8c544652fe

@ -0,0 +1,30 @@
@php($productFav = getCategoryProductBySetting($data->area->name.'_'.$data->part,1) )
@if(count($productFav) > 0)
<section class="FavProductWithMeta py-5">
<div class="{{gfx()['container']}}">
<h4 class="text-center text-muted">
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
</h4>
<h1 class="text-center my-2">
{{$productFav[0]->name}}
</h1>
<div class="row">
@foreach($productFav[0]->fullMeta(4) as $meta)
<div class="col-md text-center">
<i class="{{$meta['data']['icon']}}"></i>
<h5>
{{$meta['data']['label']}}
</h5>
<p>
{!! $meta['human_value'] !!}
</p>
</div>
@endforeach
<div class="col-12">
<img src="{{$productFav[0]->originalOptimizedImageUrl()}}" class="img-fluid" alt=" {{$productFav[0]->name}}">
</div>
</div>
</div>
</section>
@endif

@ -0,0 +1,10 @@
{
"name": "FavProductWithMeta",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -0,0 +1,42 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Category;
use App\Models\Part;
use App\Models\Setting;
class FavProductWithMeta
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_title';
$setting->value = "Fav product";
$setting->type = 'text';
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part;
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part;
$setting->value = Category::first()->id;
$setting->type = 'CATEGORY';
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part;
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part)->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_title')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,22 @@
.FavProductWithMeta {
// scss
i{
font-size: 128px;
-webkit-text-stroke: 6px $xshop-background;
}
[class^="col-md"]{
&:nth-child(1) i{
color: darkgoldenrod;
}
&:nth-child(2) i{
color: forestgreen;
}
&:nth-child(3) i{
color: dodgerblue;
}
&:nth-child(4) i{
color: red;
}
}
}
Loading…
Cancel
Save