¨4.0.1¨
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Themes\Storefront\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Ui\Facades\TabManager;
|
||||
use Themes\Storefront\Http\Requests\SaveStorefrontRequest;
|
||||
|
||||
@@ -10,7 +11,7 @@ class StorefrontController
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
@@ -20,15 +21,16 @@ class StorefrontController
|
||||
return view('admin.storefront.edit', compact('settings', 'tabs'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function update(SaveStorefrontRequest $request)
|
||||
{
|
||||
setting($request->except('_token', '_method'));
|
||||
|
||||
return back()->withSuccess(trans('admin::messages.resource_saved', ['resource' => trans('setting::settings.settings')]));
|
||||
return back()->withSuccess(trans('admin::messages.resource_updated', ['resource' => trans('setting::settings.settings')]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
namespace Themes\Storefront\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FeaturedCategoryProductController extends ProductIndexController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param int $categoryNumber
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index($categoryNumber)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Themes\Storefront\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\FlashSale\Entities\FlashSale;
|
||||
|
||||
class FlashSaleProductController
|
||||
@@ -9,7 +10,7 @@ class FlashSaleProductController
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ class NewsletterPopup
|
||||
return response('')->withCookie($cookie);
|
||||
}
|
||||
|
||||
|
||||
public function destroy()
|
||||
{
|
||||
$cookie = cookie()->forever('show_newsletter_popup', false);
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
namespace Themes\Storefront\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProductGridController extends ProductIndexController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param int $tabNumber
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index($tabNumber)
|
||||
{
|
||||
|
||||
@@ -11,18 +11,20 @@ class ProductIndexController
|
||||
{
|
||||
private $recentlyViewed;
|
||||
|
||||
|
||||
public function __construct(RecentlyViewed $recentlyViewed)
|
||||
{
|
||||
$this->recentlyViewed = $recentlyViewed;
|
||||
}
|
||||
|
||||
|
||||
protected function getProducts($settingPrefix)
|
||||
{
|
||||
$type = setting("{$settingPrefix}_product_type", 'custom_products');
|
||||
$limit = setting("{$settingPrefix}_products_limit");
|
||||
|
||||
if ($type === 'category_products') {
|
||||
return $this->categoryProducts($settingPrefix,$limit);
|
||||
return $this->categoryProducts($settingPrefix, $limit);
|
||||
}
|
||||
|
||||
if ($type === 'recently_viewed_products') {
|
||||
@@ -37,7 +39,8 @@ class ProductIndexController
|
||||
->clean();
|
||||
}
|
||||
|
||||
private function categoryProducts($settingPrefix,$limit)
|
||||
|
||||
private function categoryProducts($settingPrefix, $limit)
|
||||
{
|
||||
return Category::findOrNew(setting("{$settingPrefix}_category_id"))
|
||||
->products()
|
||||
@@ -46,33 +49,36 @@ class ProductIndexController
|
||||
->get();
|
||||
}
|
||||
|
||||
|
||||
private function recentlyViewedProducts($limit)
|
||||
{
|
||||
return collect($this->recentlyViewed->products())
|
||||
->reverse()
|
||||
->when(! is_null($limit), function (Collection $products) use ($limit) {
|
||||
->when(!is_null($limit), function (Collection $products) use ($limit) {
|
||||
return $products->take($limit);
|
||||
})
|
||||
->values();
|
||||
}
|
||||
|
||||
|
||||
private function latestProductsCallback($limit)
|
||||
{
|
||||
return function ($query) use ($limit) {
|
||||
$query->latest()
|
||||
->when(! is_null($limit), function ($q) use ($limit) {
|
||||
->when(!is_null($limit), function ($q) use ($limit) {
|
||||
$q->limit($limit);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private function customProductsCallback($settingPrefix)
|
||||
{
|
||||
return function ($query) use ($settingPrefix) {
|
||||
$productIds = setting("{$settingPrefix}_products", []);
|
||||
|
||||
$query->whereIn('id', $productIds)
|
||||
->when(! empty($productIds), function ($q) use ($productIds) {
|
||||
->when(!empty($productIds), function ($q) use ($productIds) {
|
||||
$productIdsString = collect($productIds)->filter()->implode(',');
|
||||
|
||||
$q->orderByRaw("FIELD(id, {$productIdsString})");
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Themes\Storefront\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class TabProductController extends ProductIndexController
|
||||
{
|
||||
/**
|
||||
@@ -9,7 +11,8 @@ class TabProductController extends ProductIndexController
|
||||
*
|
||||
* @param int $sectionNumber
|
||||
* @param int $tabNumber
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index($sectionNumber, $tabNumber)
|
||||
{
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
namespace Themes\Storefront\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class VerticalProductController extends ProductIndexController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param int $columnNumber
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index($columnNumber)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ class SaveStorefrontRequest extends Request
|
||||
'storefront_product_tabs_2_section_tab_4_products',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Get data to be validated from the request.
|
||||
*
|
||||
@@ -46,7 +47,7 @@ class SaveStorefrontRequest extends Request
|
||||
public function validationData()
|
||||
{
|
||||
foreach ($this->shouldCheck as $attribute) {
|
||||
if (! $this->has($attribute)) {
|
||||
if (!$this->has($attribute)) {
|
||||
$this->merge([$attribute => null]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Themes\Storefront\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Themes\Storefront\Banner;
|
||||
use Themes\Storefront\Feature;
|
||||
use Modules\Brand\Entities\Brand;
|
||||
@@ -15,7 +16,8 @@ class HomePageComposer
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\View\View $view
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose($view)
|
||||
@@ -37,9 +39,10 @@ class HomePageComposer
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function featuredCategoriesSection()
|
||||
{
|
||||
if (! setting('storefront_featured_categories_section_enabled')) {
|
||||
if (!setting('storefront_featured_categories_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,10 +53,11 @@ class HomePageComposer
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function getFeaturedCategories()
|
||||
{
|
||||
$categoryIds = Collection::times(6, function ($number) {
|
||||
if (! is_null(setting("storefront_featured_categories_section_category_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_featured_categories_section_category_{$number}_product_type"))) {
|
||||
return setting("storefront_featured_categories_section_category_{$number}_category_id");
|
||||
}
|
||||
})->filter();
|
||||
@@ -72,6 +76,7 @@ class HomePageComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function threeColumnFullWidthBanners()
|
||||
{
|
||||
if (setting('storefront_three_column_full_width_banners_enabled')) {
|
||||
@@ -79,22 +84,24 @@ class HomePageComposer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function productTabsOne()
|
||||
{
|
||||
if (! setting('storefront_product_tabs_1_section_enabled')) {
|
||||
if (!setting('storefront_product_tabs_1_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Collection::times(4, function ($number) {
|
||||
if (! is_null(setting("storefront_product_tabs_1_section_tab_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_product_tabs_1_section_tab_{$number}_product_type"))) {
|
||||
return setting("storefront_product_tabs_1_section_tab_{$number}_title");
|
||||
}
|
||||
})->filter();
|
||||
}
|
||||
|
||||
|
||||
private function topBrands()
|
||||
{
|
||||
if (! setting('storefront_top_brands_section_enabled')) {
|
||||
if (!setting('storefront_top_brands_section_enabled')) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
@@ -103,7 +110,7 @@ class HomePageComposer
|
||||
return Cache::rememberForever(md5('storefront_top_brands:' . serialize($topBrandIds)), function () use ($topBrandIds) {
|
||||
return Brand::with('files')
|
||||
->whereIn('id', $topBrandIds)
|
||||
->when(! empty($topBrandIds), function ($query) use ($topBrandIds) {
|
||||
->when(!empty($topBrandIds), function ($query) use ($topBrandIds) {
|
||||
$topBrandIdsString = collect($topBrandIds)->filter()->implode(',');
|
||||
|
||||
$query->orderByRaw("FIELD(id, {$topBrandIdsString})");
|
||||
@@ -118,6 +125,7 @@ class HomePageComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function flashSaleAndVerticalProducts()
|
||||
{
|
||||
return [
|
||||
@@ -128,6 +136,7 @@ class HomePageComposer
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function twoColumnBanners()
|
||||
{
|
||||
if (setting('storefront_two_column_banners_enabled')) {
|
||||
@@ -135,19 +144,21 @@ class HomePageComposer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function productGrid()
|
||||
{
|
||||
if (! setting('storefront_product_grid_section_enabled')) {
|
||||
if (!setting('storefront_product_grid_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Collection::times(4, function ($number) {
|
||||
if (! is_null(setting("storefront_product_grid_section_tab_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_product_grid_section_tab_{$number}_product_type"))) {
|
||||
return setting("storefront_product_grid_section_tab_{$number}_title");
|
||||
}
|
||||
})->filter();
|
||||
}
|
||||
|
||||
|
||||
private function threeColumnBanners()
|
||||
{
|
||||
if (setting('storefront_three_column_banners_enabled')) {
|
||||
@@ -155,14 +166,15 @@ class HomePageComposer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function tabProductsTwo()
|
||||
{
|
||||
if (! setting('storefront_product_tabs_2_section_enabled')) {
|
||||
if (!setting('storefront_product_tabs_2_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tabs = Collection::times(4, function ($number) {
|
||||
if (! is_null(setting("storefront_product_tabs_2_section_tab_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_product_tabs_2_section_tab_{$number}_product_type"))) {
|
||||
return setting("storefront_product_tabs_2_section_tab_{$number}_title");
|
||||
}
|
||||
})->filter();
|
||||
@@ -173,6 +185,7 @@ class HomePageComposer
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function oneColumnBanner()
|
||||
{
|
||||
if (setting('storefront_one_column_banner_enabled')) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Themes\Storefront\Http\ViewComposers;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\View\View;
|
||||
use Mexitek\PHPColors\Color;
|
||||
use Modules\Compare\Compare;
|
||||
use Spatie\SchemaOrg\Schema;
|
||||
@@ -18,24 +20,27 @@ use Modules\Product\Entities\SearchTerm;
|
||||
class LayoutComposer
|
||||
{
|
||||
/**
|
||||
* @var \Modules\Compare\Compare
|
||||
* @var Compare
|
||||
*/
|
||||
private $compare;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new view composer instance.
|
||||
*
|
||||
* @param \Modules\Compare\Compare $compare
|
||||
* @param Compare $compare
|
||||
*/
|
||||
public function __construct(Compare $compare)
|
||||
{
|
||||
$this->compare = $compare;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\View\View $view
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose($view)
|
||||
@@ -63,29 +68,36 @@ class LayoutComposer
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function footerTagsCallback($tagIds)
|
||||
{
|
||||
return function () use ($tagIds) {
|
||||
return Tag::whereIn('id', $tagIds)
|
||||
->when(!empty($tagIds), function ($query) use ($tagIds) {
|
||||
$tagIdsString = collect($tagIds)->filter()->implode(',');
|
||||
|
||||
$query->orderByRaw("FIELD(id, {$tagIdsString})");
|
||||
})
|
||||
->get();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private function getThemeColor()
|
||||
{
|
||||
try {
|
||||
return new Color(storefront_theme_color());
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return new Color('#0068e1');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function getFavicon()
|
||||
{
|
||||
return $this->getMedia(setting('storefront_favicon'))->path;
|
||||
}
|
||||
|
||||
private function getHeaderLogo()
|
||||
{
|
||||
return $this->getMedia(setting('storefront_header_logo'))->path;
|
||||
}
|
||||
|
||||
private function getNewsletterBgImage()
|
||||
{
|
||||
return $this->getMedia(setting('storefront_newsletter_bg_image'))->path;
|
||||
}
|
||||
|
||||
private function getMedia($fileId)
|
||||
{
|
||||
@@ -94,6 +106,19 @@ class LayoutComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getHeaderLogo()
|
||||
{
|
||||
return $this->getMedia(setting('storefront_header_logo'))->path;
|
||||
}
|
||||
|
||||
|
||||
private function getNewsletterBgImage()
|
||||
{
|
||||
return $this->getMedia(setting('storefront_newsletter_bg_image'))->path;
|
||||
}
|
||||
|
||||
|
||||
private function getPrivacyPageUrl()
|
||||
{
|
||||
return Cache::tags('settings')->rememberForever('privacy_page_url', function () {
|
||||
@@ -101,11 +126,13 @@ class LayoutComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getCategories()
|
||||
{
|
||||
return Category::searchable();
|
||||
}
|
||||
|
||||
|
||||
private function getMostSearchedKeywords()
|
||||
{
|
||||
return Cache::remember('most_searched_keywords', now()->addHour(), function () {
|
||||
@@ -113,21 +140,25 @@ class LayoutComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getPrimaryMenu()
|
||||
{
|
||||
return new MegaMenu(setting('storefront_primary_menu'));
|
||||
}
|
||||
|
||||
|
||||
private function getCategoryMenu()
|
||||
{
|
||||
return new MegaMenu(setting('storefront_category_menu'));
|
||||
}
|
||||
|
||||
|
||||
private function getCart()
|
||||
{
|
||||
return Cart::instance();
|
||||
}
|
||||
|
||||
|
||||
private function getWishlist()
|
||||
{
|
||||
if (auth()->guest()) {
|
||||
@@ -137,15 +168,12 @@ class LayoutComposer
|
||||
return auth()->user()->wishlist()->pluck('product_id');
|
||||
}
|
||||
|
||||
|
||||
private function getFooterMenuOne()
|
||||
{
|
||||
return $this->getFooterMenu(setting('storefront_footer_menu_one'));
|
||||
}
|
||||
|
||||
private function getFooterMenuTwo()
|
||||
{
|
||||
return $this->getFooterMenu(setting('storefront_footer_menu_two'));
|
||||
}
|
||||
|
||||
private function getFooterMenu($menuId)
|
||||
{
|
||||
@@ -155,6 +183,13 @@ class LayoutComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getFooterMenuTwo()
|
||||
{
|
||||
return $this->getFooterMenu(setting('storefront_footer_menu_two'));
|
||||
}
|
||||
|
||||
|
||||
private function getFooterTags()
|
||||
{
|
||||
$tagIds = setting('storefront_footer_tags', []);
|
||||
@@ -166,18 +201,6 @@ class LayoutComposer
|
||||
);
|
||||
}
|
||||
|
||||
public function footerTagsCallback($tagIds)
|
||||
{
|
||||
return function () use ($tagIds) {
|
||||
return Tag::whereIn('id', $tagIds)
|
||||
->when(! empty($tagIds), function ($query) use ($tagIds) {
|
||||
$tagIdsString = collect($tagIds)->filter()->implode(',');
|
||||
|
||||
$query->orderByRaw("FIELD(id, {$tagIdsString})");
|
||||
})
|
||||
->get();
|
||||
};
|
||||
}
|
||||
|
||||
private function getCopyrightText()
|
||||
{
|
||||
@@ -188,11 +211,13 @@ class LayoutComposer
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function getAcceptedPaymentMethodsImage()
|
||||
{
|
||||
return $this->getMedia(setting('storefront_accepted_payment_methods_image'));
|
||||
}
|
||||
|
||||
|
||||
private function getSchemaMarkup()
|
||||
{
|
||||
return Schema::webSite()
|
||||
@@ -200,6 +225,7 @@ class LayoutComposer
|
||||
->potentialAction($this->searchActionSchema());
|
||||
}
|
||||
|
||||
|
||||
private function searchActionSchema()
|
||||
{
|
||||
return Schema::searchAction()
|
||||
|
||||
@@ -2,40 +2,64 @@
|
||||
|
||||
namespace Themes\Storefront\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Modules\Support\Money;
|
||||
use Modules\Product\Entities\Product;
|
||||
use Modules\Category\Entities\Category;
|
||||
use Modules\Product\Entities\ProductVariant;
|
||||
|
||||
class ProductIndexPageComposer
|
||||
{
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\View\View $view
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose($view)
|
||||
{
|
||||
$view->with([
|
||||
'categories' => $this->categories(),
|
||||
'minPrice' => $this->minPrice(),
|
||||
'maxPrice' => $this->maxPrice(),
|
||||
'latestProducts' => $this->latestProducts(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function categories()
|
||||
{
|
||||
return Category::tree();
|
||||
}
|
||||
|
||||
private function maxPrice()
|
||||
|
||||
private function minPrice()
|
||||
{
|
||||
return Money::inDefaultCurrency(Product::max('selling_price'))
|
||||
$minProductPrice = Product::min('selling_price');
|
||||
$minVariantPrice = ProductVariant::min('selling_price');
|
||||
$minPrice = min($minProductPrice, $minVariantPrice);
|
||||
|
||||
return Money::inDefaultCurrency($minPrice)
|
||||
->convertToCurrentCurrency()
|
||||
->ceil()
|
||||
->amount();
|
||||
}
|
||||
|
||||
|
||||
private function maxPrice()
|
||||
{
|
||||
$maxProductPrice = Product::max('selling_price');
|
||||
$maxVariantPrice = ProductVariant::max('selling_price');
|
||||
$maxPrice = max($maxProductPrice, $maxVariantPrice);
|
||||
|
||||
return Money::inDefaultCurrency($maxPrice)
|
||||
->convertToCurrentCurrency()
|
||||
->ceil()
|
||||
->amount();
|
||||
}
|
||||
|
||||
|
||||
private function latestProducts()
|
||||
{
|
||||
return Product::forCard()->take(5)->latest()->get()->map->clean();
|
||||
|
||||
@@ -15,7 +15,8 @@ class ProductShowPageComposer
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\View\View $view
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
@@ -30,6 +31,7 @@ class ProductShowPageComposer
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function schemaMarkup(Product $product)
|
||||
{
|
||||
return Schema::product()
|
||||
@@ -43,11 +45,13 @@ class ProductShowPageComposer
|
||||
->offers($this->offersSchema($product));
|
||||
}
|
||||
|
||||
|
||||
private function brandSchema(Product $product)
|
||||
{
|
||||
return Schema::brand()->name($product->brand->name);
|
||||
}
|
||||
|
||||
|
||||
private function aggregateRatingSchema(Product $product)
|
||||
{
|
||||
return Schema::aggregateRating()
|
||||
@@ -55,15 +59,17 @@ class ProductShowPageComposer
|
||||
->ratingCount($product->reviews()->count());
|
||||
}
|
||||
|
||||
|
||||
private function offersSchema(Product $product)
|
||||
{
|
||||
return Schema::offer()
|
||||
->price($product->selling_price->convertToCurrentCurrency()->amount())
|
||||
->price(($product->variant ?? $product)->selling_price->convertToCurrentCurrency()->amount())
|
||||
->priceCurrency(currency())
|
||||
->availability($product->isInStock() ? ItemAvailability::InStock : ItemAvailability::OutOfStock)
|
||||
->url($product->url());
|
||||
}
|
||||
|
||||
|
||||
private function getCategoryBreadCrumb(Collection $categories)
|
||||
{
|
||||
$breadcrumb = '';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Themes\Storefront\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Modules\Category\Entities\Category;
|
||||
|
||||
class StorefrontTabsComposer
|
||||
@@ -9,7 +10,8 @@ class StorefrontTabsComposer
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\View\View $view
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose($view)
|
||||
@@ -19,6 +21,7 @@ class StorefrontTabsComposer
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function getCategories()
|
||||
{
|
||||
return ['' => trans('admin::admin.form.please_select')] + Category::treeList();
|
||||
|
||||
Reference in New Issue
Block a user