add watermark on zoom, update display of article nature on shelve (change icon to text
This commit is contained in:
@@ -16,8 +16,6 @@ class CategoryController extends Controller
|
|||||||
$tags = $request->input('tags') ?? [];
|
$tags = $request->input('tags') ?? [];
|
||||||
$data = Shelves::getOffersByCategoryAndNature($categoryId, $articleNatureId, $tags, $articleNature, $displayByRows);
|
$data = Shelves::getOffersByCategoryAndNature($categoryId, $articleNatureId, $tags, $articleNature, $displayByRows);
|
||||||
|
|
||||||
// dump($data);
|
|
||||||
// exit;
|
|
||||||
return view('Shop.Shelves.shelve', $data);
|
return view('Shop.Shelves.shelve', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ class Medias
|
|||||||
return self::getSrcByType($image, 'normal');
|
return self::getSrcByType($image, 'normal');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getZoomSrc($image)
|
||||||
|
{
|
||||||
|
return self::getSrcByType($image, 'zoom');
|
||||||
|
}
|
||||||
|
|
||||||
public static function getSrcByType($image, $type)
|
public static function getSrcByType($image, $type)
|
||||||
{
|
{
|
||||||
return $image ? '/storage/'.$image['id'].'/conversions/'.self::getFilename($image, $type) : false;
|
return $image ? '/storage/'.$image['id'].'/conversions/'.self::getFilename($image, $type) : false;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Articles
|
|||||||
$images = ArticleImages::getFullImagesByArticle($article);
|
$images = ArticleImages::getFullImagesByArticle($article);
|
||||||
$data['image'] = self::getPreviewSrc($images[0] ?? false);
|
$data['image'] = self::getPreviewSrc($images[0] ?? false);
|
||||||
$data['images'] = count($images) ? $images : false;
|
$data['images'] = count($images) ? $images : false;
|
||||||
$data['image_big'] = self::getImageSrc($images[0] ?? false);
|
$data['image_big'] = self::getZoomSrc($images[0] ?? false);
|
||||||
$data['inherited'] = ArticleInherited::getInherited($id);
|
$data['inherited'] = ArticleInherited::getInherited($id);
|
||||||
$data['categories'] = ArticleCategories::getCategoriesNameByArticle($article);
|
$data['categories'] = ArticleCategories::getCategoriesNameByArticle($article);
|
||||||
$data['tags'] = ArticleTags::getFullTagsSlugByArticle($article);
|
$data['tags'] = ArticleTags::getFullTagsSlugByArticle($article);
|
||||||
@@ -143,7 +143,7 @@ class Articles
|
|||||||
public static function getArticlesToSell($options)
|
public static function getArticlesToSell($options)
|
||||||
{
|
{
|
||||||
$articles = self::getArticlesWithOffers($options);
|
$articles = self::getArticlesWithOffers($options);
|
||||||
$searchOrder = array_flip($options['ids']->toArray() ?? []);
|
$searchOrder = $options['ids'] ?? false ? array_flip($options['ids']->toArray()) : false;
|
||||||
foreach ($articles as $article) {
|
foreach ($articles as $article) {
|
||||||
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
||||||
if (! count($price_lists)) {
|
if (! count($price_lists)) {
|
||||||
@@ -151,7 +151,9 @@ class Articles
|
|||||||
}
|
}
|
||||||
if (! is_array($data[$article->name] ?? false)) {
|
if (! is_array($data[$article->name] ?? false)) {
|
||||||
$data[$article->name] = self::getDataForSale($article);
|
$data[$article->name] = self::getDataForSale($article);
|
||||||
$data[$article->name]['searchOrder'] = $searchOrder[$article->id];
|
if ($searchOrder) {
|
||||||
|
$data[$article->name]['searchOrder'] = $searchOrder[$article->id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$prices = $price_lists[0]['price_list_values'][0];
|
$prices = $price_lists[0]['price_list_values'][0];
|
||||||
$article_nature_name = strtolower($article->article_nature->name);
|
$article_nature_name = strtolower($article->article_nature->name);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class Shelves
|
|||||||
public static function getOffersByCategoryAndNature($categoryId, $articleNatureId = false, $tags = [], $articleNature = false, $displayByRows = false)
|
public static function getOffersByCategoryAndNature($categoryId, $articleNatureId = false, $tags = [], $articleNature = false, $displayByRows = false)
|
||||||
{
|
{
|
||||||
$articleNatures = Articles::getArticleNaturesWithOffers(['category_id' => $categoryId]);
|
$articleNatures = Articles::getArticleNaturesWithOffers(['category_id' => $categoryId]);
|
||||||
$productType = self::getProductType($articleNature, $articleNatures);
|
$productType = self::getProductType($articleNatureId, $articleNature, $articleNatures);
|
||||||
$articleNatureId = $articleNatureId ?
|
$articleNatureId = $articleNatureId ?
|
||||||
$articleNatureId :
|
$articleNatureId :
|
||||||
self::getArticleNatureId($articleNature, $articleNatures);
|
self::getArticleNatureId($articleNature, $articleNatures);
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ trait Imageable
|
|||||||
->watermarkHeight(100, Manipulations::UNIT_PERCENT)
|
->watermarkHeight(100, Manipulations::UNIT_PERCENT)
|
||||||
->watermarkWidth(100, Manipulations::UNIT_PERCENT)
|
->watermarkWidth(100, Manipulations::UNIT_PERCENT)
|
||||||
->watermarkFit(Manipulations::FIT_FILL);
|
->watermarkFit(Manipulations::FIT_FILL);
|
||||||
|
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)
|
||||||
|
->watermark($watermark)
|
||||||
|
->watermarkHeight(100, Manipulations::UNIT_PERCENT)
|
||||||
|
->watermarkWidth(100, Manipulations::UNIT_PERCENT)
|
||||||
|
->watermarkFit(Manipulations::FIT_FILL);
|
||||||
|
|
||||||
// $this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
// $this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,52 +16,57 @@ trait Imageable
|
|||||||
return Medias::getImages(self::get($id));
|
return Medias::getImages(self::get($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumb($image, $with_undefined = true)
|
public static function getThumb($image, $undefined = true)
|
||||||
{
|
{
|
||||||
$src = self::getThumbSrc($image, $with_undefined);
|
$src = self::getThumbSrc($image, $undefined);
|
||||||
|
|
||||||
return $src ? "<img src='{$src}'>" : '';
|
return $src ? "<img src='{$src}'>" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumbSrc($image, $with_undefined = true)
|
public static function getThumbSrc($image, $undefined = true)
|
||||||
{
|
{
|
||||||
return $image ? Medias::getThumbSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' : '');
|
return $image ? Medias::getThumbSrc($image) : ($undefined ? '/img/visuel-non-disponible.jpg' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPreview($image, $with_undefined = true)
|
public static function getPreview($image, $undefined = true)
|
||||||
{
|
{
|
||||||
$src = self::getPreviewSrc($image, $with_undefined);
|
$src = self::getPreviewSrc($image, $undefined);
|
||||||
|
|
||||||
return $src ? "<img src='{$src}' class='img-fluid'>" : '';
|
return $src ? "<img src='{$src}' class='img-fluid'>" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPreviewSrc($image, $with_undefined = true)
|
public static function getPreviewSrc($image, $undefined = true)
|
||||||
{
|
{
|
||||||
return $image ? Medias::getPreviewSrc($image) : ($with_undefined ? self::getUnknown() : '');
|
return $image ? Medias::getPreviewSrc($image) : ($undefined ? self::getUnknown() : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getNormal($image, $with_undefined = true)
|
public static function getNormal($image, $undefined = true)
|
||||||
{
|
{
|
||||||
$src = self::getNormalSrc($image, $with_undefined);
|
$src = self::getNormalSrc($image, $undefined);
|
||||||
|
|
||||||
return $src ? "<img src='{$src}'>" : '';
|
return $src ? "<img src='{$src}'>" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getNormalSrc($image, $with_undefined = true)
|
public static function getNormalSrc($image, $undefined = true)
|
||||||
{
|
{
|
||||||
return $image ? Medias::getNormalSrc($image) : ($with_undefined ? self::getUnknown() : '');
|
return $image ? Medias::getNormalSrc($image) : ($undefined ? self::getUnknown() : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getImage($image, $with_undefined = true)
|
public static function getZoomSrc($image, $undefined = true)
|
||||||
{
|
{
|
||||||
$src = self::getImageSrc($image, $with_undefined);
|
return $image ? Medias::getZoomSrc($image) : ($undefined ? self::getUnknown() : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImage($image, $undefined = true)
|
||||||
|
{
|
||||||
|
$src = self::getImageSrc($image, $undefined);
|
||||||
|
|
||||||
return $src ? "<img src='{$src}' class='img-fluid'>" : '';
|
return $src ? "<img src='{$src}' class='img-fluid'>" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getImageSrc($image, $with_undefined = true)
|
public static function getImageSrc($image, $undefined = true)
|
||||||
{
|
{
|
||||||
return $image ? Medias::getImageSrc($image) : ($with_undefined ? self::getUnknown() : '');
|
return $image ? Medias::getImageSrc($image) : ($undefined ? self::getUnknown() : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUnknown()
|
public static function getUnknown()
|
||||||
|
|||||||
@@ -305,6 +305,10 @@ div.megamenu ul.megamenu li.megamenu.level1
|
|||||||
font-size: 0.8em
|
font-size: 0.8em
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sp-lightbox {
|
||||||
|
z-index: 1300;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'noto_sanscondensed';
|
font-family: 'noto_sanscondensed';
|
||||||
|
|||||||
@@ -1,26 +1,41 @@
|
|||||||
@foreach ($article_natures as $nature)
|
@foreach ($article_natures as $nature)
|
||||||
<div class="btn products" data-id="{{ $nature }}">
|
<div class="btn products" data-id="{{ $nature }}">
|
||||||
@if ($article_nature == $nature)
|
@if ($article_nature == $nature)
|
||||||
<img src="{{ App\Repositories\Shop\ArticleNatures::getIconBySlug($nature, 'normal', 'icon_selection') }}">
|
@php
|
||||||
@else
|
$iconType = 'icon_selection';
|
||||||
<img src="{{ App\Repositories\Shop\ArticleNatures::getIconBySlug($nature, 'normal', 'icon') }}">
|
$iconClass = 'badge-success';
|
||||||
@endif
|
@endphp
|
||||||
</div>
|
@else
|
||||||
|
@php
|
||||||
|
$iconType = 'icon';
|
||||||
|
$iconClass = 'badge-secondary';
|
||||||
|
@endphp
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@php
|
||||||
|
$icon = App\Repositories\Shop\ArticleNatures::getIconBySlug($nature, 'normal', $iconType);
|
||||||
|
@endphp
|
||||||
|
@if ($icon)
|
||||||
|
<img src="{{ $icon }}" alt="{{ $nature }}">
|
||||||
|
@else
|
||||||
|
<span class="badge {{ $iconClass }}" style="font-size: 1.2em;">{{ $nature }}</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
$('#by_rows').click(function() {
|
$('#by_rows').click(function() {
|
||||||
$('#display_by_rows').val(1);
|
$('#display_by_rows').val(1);
|
||||||
$('#category-form').submit();
|
$('#category-form').submit();
|
||||||
});
|
});
|
||||||
$('#by_cards').click(function() {
|
$('#by_cards').click(function() {
|
||||||
$('#display_by_rows').val(0);
|
$('#display_by_rows').val(0);
|
||||||
$('#category-form').submit();
|
$('#category-form').submit();
|
||||||
});
|
});
|
||||||
$('.products').click(function() {
|
$('.products').click(function() {
|
||||||
$('#article_nature').val($(this).data('id'));
|
$('#article_nature').val($(this).data('id'));
|
||||||
$('#category-form').submit();
|
$('#category-form').submit();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
<div class="sp-loading"><img src="images/sp-loading.gif" alt=""><br>LOADING IMAGES</div>
|
<div class="sp-loading"><img src="images/sp-loading.gif" alt=""><br>LOADING IMAGES</div>
|
||||||
<div class="sp-wrap" style="width: 100%;">
|
<div class="sp-wrap" style="width: 100%;">
|
||||||
@if ($images)
|
@if ($images)
|
||||||
@foreach ($images as $image)
|
@foreach ($images as $image)
|
||||||
<a href="{{ App\Repositories\Core\Images::getImageSrc($image) }}">
|
<a href="{{ App\Repositories\Shop\Articles::getZoomSrc($image) }}">
|
||||||
<img src="{{ App\Repositories\Core\Images::getNormalSrc($image) }}" class="img-fluid">
|
<img src="{{ App\Repositories\Core\Images::getNormalSrc($image) }}" class="img-fluid">
|
||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
@else
|
@else
|
||||||
<img src="{{ $image }}" class="img-fluid">
|
<img src="{{ $image }}" class="img-fluid">
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
$(window).load(function() {
|
$(window).load(function() {
|
||||||
$('.sp-wrap').smoothproducts();
|
$('.sp-wrap').smoothproducts();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user