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') ?? [];
|
||||
$data = Shelves::getOffersByCategoryAndNature($categoryId, $articleNatureId, $tags, $articleNature, $displayByRows);
|
||||
|
||||
// dump($data);
|
||||
// exit;
|
||||
return view('Shop.Shelves.shelve', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,11 @@ class Medias
|
||||
return self::getSrcByType($image, 'normal');
|
||||
}
|
||||
|
||||
public static function getZoomSrc($image)
|
||||
{
|
||||
return self::getSrcByType($image, 'zoom');
|
||||
}
|
||||
|
||||
public static function getSrcByType($image, $type)
|
||||
{
|
||||
return $image ? '/storage/'.$image['id'].'/conversions/'.self::getFilename($image, $type) : false;
|
||||
|
||||
@@ -81,7 +81,7 @@ class Articles
|
||||
$images = ArticleImages::getFullImagesByArticle($article);
|
||||
$data['image'] = self::getPreviewSrc($images[0] ?? 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['categories'] = ArticleCategories::getCategoriesNameByArticle($article);
|
||||
$data['tags'] = ArticleTags::getFullTagsSlugByArticle($article);
|
||||
@@ -143,7 +143,7 @@ class Articles
|
||||
public static function getArticlesToSell($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) {
|
||||
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
||||
if (! count($price_lists)) {
|
||||
@@ -151,8 +151,10 @@ class Articles
|
||||
}
|
||||
if (! is_array($data[$article->name] ?? false)) {
|
||||
$data[$article->name] = self::getDataForSale($article);
|
||||
if ($searchOrder) {
|
||||
$data[$article->name]['searchOrder'] = $searchOrder[$article->id];
|
||||
}
|
||||
}
|
||||
$prices = $price_lists[0]['price_list_values'][0];
|
||||
$article_nature_name = strtolower($article->article_nature->name);
|
||||
$data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices);
|
||||
|
||||
@@ -7,7 +7,7 @@ class Shelves
|
||||
public static function getOffersByCategoryAndNature($categoryId, $articleNatureId = false, $tags = [], $articleNature = false, $displayByRows = false)
|
||||
{
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers(['category_id' => $categoryId]);
|
||||
$productType = self::getProductType($articleNature, $articleNatures);
|
||||
$productType = self::getProductType($articleNatureId, $articleNature, $articleNatures);
|
||||
$articleNatureId = $articleNatureId ?
|
||||
$articleNatureId :
|
||||
self::getArticleNatureId($articleNature, $articleNatures);
|
||||
|
||||
@@ -44,6 +44,12 @@ trait Imageable
|
||||
->watermarkHeight(100, Manipulations::UNIT_PERCENT)
|
||||
->watermarkWidth(100, Manipulations::UNIT_PERCENT)
|
||||
->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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,52 +16,57 @@ trait Imageable
|
||||
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}'>" : '';
|
||||
}
|
||||
|
||||
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'>" : '';
|
||||
}
|
||||
|
||||
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}'>" : '';
|
||||
}
|
||||
|
||||
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'>" : '';
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
@@ -305,6 +305,10 @@ div.megamenu ul.megamenu li.megamenu.level1
|
||||
font-size: 0.8em
|
||||
}
|
||||
|
||||
.sp-lightbox {
|
||||
z-index: 1300;
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'noto_sanscondensed';
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
@foreach ($article_natures as $nature)
|
||||
<div class="btn products" data-id="{{ $nature }}">
|
||||
@if ($article_nature == $nature)
|
||||
<img src="{{ App\Repositories\Shop\ArticleNatures::getIconBySlug($nature, 'normal', 'icon_selection') }}">
|
||||
@php
|
||||
$iconType = 'icon_selection';
|
||||
$iconClass = 'badge-success';
|
||||
@endphp
|
||||
@else
|
||||
<img src="{{ App\Repositories\Shop\ArticleNatures::getIconBySlug($nature, 'normal', 'icon') }}">
|
||||
@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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="sp-wrap" style="width: 100%;">
|
||||
@if ($images)
|
||||
@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">
|
||||
</a>
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user