added helper for facades

This commit is contained in:
prateek srivastava 2021-02-04 18:56:52 +05:30
parent fd7fdfe385
commit 20f2784099
16 changed files with 39 additions and 20 deletions

View File

@ -206,7 +206,7 @@
<li>
<a href="{{ route('admin.catalog.products.edit', $item->product_id) }}">
<div class="product image">
<?php $productBaseImage = ProductImage::getProductBaseImage($item->product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($item->product); ?>
<img class="item-image" src="{{ $productBaseImage['small_image_url'] }}" />
</div>
@ -316,7 +316,7 @@
<li>
<a href="{{ route('admin.catalog.products.edit', $item->product_id) }}">
<div class="image">
<?php $productBaseImage = ProductImage::getProductBaseImage($item->product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($item->product); ?>
<img class="item-image" src="{{ $productBaseImage['small_image_url'] }}" />
</div>

View File

@ -0,0 +1,17 @@
<?php
use Webkul\Product\ProductImage;
use Webkul\Product\ProductVideo;
if (! function_exists('productimage')) {
function productimage() {
return app()->make(ProductImage::class);
}
}
if (! function_exists('productvideo')) {
function productvideo() {
return app()->make(ProductVideo::class);
}
}
?>

View File

@ -23,6 +23,8 @@ class ProductServiceProvider extends ServiceProvider
*/
public function boot()
{
include __DIR__ . '/../Http/helpers.php';
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app->make(EloquentFactory::class)->load(__DIR__ . '/../Database/Factories');

View File

@ -32,7 +32,7 @@
@foreach ($reviews as $review)
<div class="account-item-card mt-15 mb-15">
<div class="media-info">
<?php $image = ProductImage::getProductBaseImage($review->product); ?>
<?php $image = productimage()->getProductBaseImage($review->product); ?>
<a href="{{ route('shop.productOrCategory.index', $review->product->url_key) }}" title="{{ $review->product->name }}">
<img class="media" src="{{ $image['small_image_url'] }}" alt=""/>
</a>

View File

@ -19,7 +19,7 @@
@foreach ($reviews as $review)
<div class="account-item-card mt-15 mb-15">
<div class="media-info">
<?php $image = ProductImage::getGalleryImages($review->product); ?>
<?php $image = productimage()->getGalleryImages($review->product); ?>
<img class="media" src="{{ $image[0]['small_image_url'] }}" alt="" />
<div class="info mt-20">

View File

@ -2,7 +2,7 @@
<div class="product-card">
<?php $productBaseImage = ProductImage::getProductBaseImage($product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($product); ?>
@if ($product->new)
<div class="sticker new">

View File

@ -11,7 +11,7 @@
<div class="review-layouter mb-20">
<div class="product-info">
<?php $productBaseImage = ProductImage::getProductBaseImage($product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($product); ?>
<div class="product-image">
<a href="{{ route('shop.productOrCategory.index', $product->url_key) }}" title="{{ $product->name }}">

View File

@ -11,7 +11,7 @@
<div class="review-layouter">
@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
<?php $productBaseImage = ProductImage::getProductBaseImage($product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($product); ?>
<div class="product-info">
<div class="product-image">

View File

@ -15,7 +15,7 @@
</script>
@endif
<?php $productBaseImage = ProductImage::getProductBaseImage($product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($product); ?>
<meta name="twitter:card" content="summary_large_image" />

View File

@ -1,9 +1,9 @@
@inject ('wishListHelper', 'Webkul\Customer\Helpers\Wishlist')
<?php
$images = ProductImage::getGalleryImages($product);
$images = productimage()->getGalleryImages($product);
$videos = ProductVideo::getVideos($product);
$videos = productvideo()->getVideos($product);
$images = array_merge($images, $videos);
?>

View File

@ -31,7 +31,7 @@
<div class="row col-12 fs16">
<div class="col-12 row">
@php
$image = ProductImage::getProductBaseImage($review->product);
$image = productimage()->getProductBaseImage($review->product);
@endphp
<a

View File

@ -20,15 +20,15 @@
}
if (isset($item)) {
$productBaseImage = ProductImage::getProductImage($item);
$productBaseImage = productimage()->getProductImage($item);
} else {
$productBaseImage = ProductImage::getProductBaseImage($product);
$productBaseImage = productimage()->getProductBaseImage($product);
}
$totalReviews = $reviewHelper->getTotalReviews($product);
$avgRatings = ceil($reviewHelper->getAverageRating($product));
$galleryImages = ProductImage::getGalleryImages($product);
$galleryImages = productimage()->getGalleryImages($product);
$priceHTML = view('shop::products.price', ['product' => $product])->render();
$product->__set('priceHTML', $priceHTML);

View File

@ -10,7 +10,7 @@
$avgStarRating = round($avgRatings);
$productImages = [];
$images = ProductImage::getGalleryImages($product);
$images = productimage()->getGalleryImages($product);
foreach ($images as $key => $image) {
array_push($productImages, $image['medium_image_url']);
@ -32,7 +32,7 @@
</script>
@endif
<?php $productBaseImage = ProductImage::getProductBaseImage($product); ?>
<?php $productBaseImage = productimage()->getProductBaseImage($product); ?>
<meta name="twitter:card" content="summary_large_image" />

View File

@ -4,7 +4,7 @@
@php
$config = $configurableOptionHelper->getConfigurationConfig($product);
$galleryImages = ProductImage::getGalleryImages($product);
$galleryImages = productimage()->getGalleryImages($product);
@endphp
{!! view_render_event('bagisto.shop.products.view.configurable-options.before', ['product' => $product]) !!}

View File

@ -1,8 +1,8 @@
@inject ('wishListHelper', 'Webkul\Customer\Helpers\Wishlist')
@php
$images = ProductImage::getGalleryImages($product);
$videos = ProductVideo::getVideos($product);
$images = productimage()->getGalleryImages($product);
$videos = productvideo()->getVideos($product);
$videoData = $imageData = [];

View File

@ -1,5 +1,5 @@
@php
$productBaseImage = ProductImage::getProductBaseImage($product);
$productBaseImage = productimage()->getProductBaseImage($product);
@endphp
<div class="col-lg-3 col-md-12">