Merge branch 'master' into duplicate_order_issue
This commit is contained in:
commit
0f67bbe95f
|
|
@ -1,6 +1,6 @@
|
|||
APP_NAME=Bagisto
|
||||
APP_ENV=local
|
||||
APP_VERSION=1.2.0
|
||||
APP_VERSION=1.3.1
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
|
@ -67,4 +67,4 @@ LINKEDIN_CALLBACK_URL=https://yourhost.com/customer/social-login/linkedin/callba
|
|||
|
||||
GITHUB_CLIENT_ID=
|
||||
GITHUB_CLIENT_SECRET=
|
||||
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback
|
||||
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback
|
||||
|
|
|
|||
|
|
@ -2,9 +2,207 @@
|
|||
|
||||
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
|
||||
|
||||
## **v1.3.0 (16th of February 2021)** - *Release*
|
||||
|
||||
* [feature] - PayPal Smart Button for quick and fast payment.
|
||||
|
||||
* [feature] - Email Marketing-Newsletter to send the newsletter to your valuable customers.
|
||||
|
||||
* [feature] - Control on Displaying of out of stock Product.
|
||||
|
||||
* [feature] - Minimum Order Amount by which it will necessary to meet their order subtotal to make a successful purchase.
|
||||
|
||||
* [feature] - Add Video of Your Product.
|
||||
|
||||
* [feature] - Maintenance Mode, let search engines know that your site is currently down.
|
||||
|
||||
* [feature] - Buy Now at Product Page, Admin can easily enable/disable the Buy Now Button for both themes.
|
||||
|
||||
* [feature] - laravel Debugger Mode, This will help the developer/users to see all the packages they are using inside the Webkul folder.
|
||||
|
||||
* [enhancement] - Duplicated queries removed.
|
||||
|
||||
* [enhancement] - Improved lighthouse score.
|
||||
|
||||
* [enhancement] - Slider path should also work in default theme.
|
||||
|
||||
* [enhancement] - Add configuration to enable/disable the image search feature.
|
||||
|
||||
* [enhancement] - Multi product images should be changed on mouse hover.
|
||||
|
||||
* [enhancement] - Add configuration to set admin url while install using bagisto:install command.
|
||||
|
||||
* [enhancement] - Add confirm box while moving an item to wishlist from the cart page.
|
||||
|
||||
* [enhancement] - Add option to export auto generated coupons in cart rule.
|
||||
|
||||
* [enhancement] - Add bulk category delete functionality.
|
||||
|
||||
* [enhancement] - Default shop content should be localized.
|
||||
|
||||
* [enhancement] - Schedule cron job to process newsletter campaigns mails.
|
||||
|
||||
* [enhancement] - Showing configurable product base on catalog rule price.
|
||||
|
||||
* [enhancement] - Wishlist and Cart key in Product API.
|
||||
|
||||
* [enhancement] - Add a option in the channel configuration to enable/disable wishlist.
|
||||
|
||||
* [enhancement] - Add product number.
|
||||
|
||||
* #3886 [fixed] - Cart item not bound to the account when login with social login.
|
||||
|
||||
* #3785 [fixed] - Product filter is not working according to channel filter.
|
||||
|
||||
* #3879 [fixed] - Getting exception on uploading high size image in Invoice Slip Design logo.
|
||||
|
||||
* #3954 [fixed] - Featured New Product Adding Special Price the 2 columns in mobile version is broke.
|
||||
|
||||
* #3964 [fixed] - pay with paypal smart button is missing in checkout.
|
||||
|
||||
* #3940 [fixed] - bagisto:install defines APP_URL to localhost by default.
|
||||
|
||||
* #3957 [fixed] - Configurable product parent image is visible in cart instead of variant image.
|
||||
|
||||
* #3981 [fixed] - No validation message on creating addresses without required params.
|
||||
|
||||
* #4030 [fixed] - featured or new label should not visible if product is not exist in default theme.
|
||||
|
||||
* #4061 [fixed] - variant image is not visible when item added in wishlist.
|
||||
|
||||
* #4024 [fixed] - customer group price discount is not applied when product price and discount amount is same.
|
||||
|
||||
* #4062 [fixed] - search icon in velocity theme is not clickable.
|
||||
|
||||
* #4085 [fixed] - Not able to fetch invoice by API.
|
||||
|
||||
* #4094 [fixed] - filter is not working properly in case product name contains any special character.
|
||||
|
||||
* #4130 [fixed] - event ticket price field accepts negative values.
|
||||
|
||||
* #4117 [fixed] - error in booking product while booking a slot.
|
||||
|
||||
* #4124 [fixed] - Client Side validation issue in Special Price for ticket booking Product.
|
||||
|
||||
* #4191 [fixed] - back date should be disabled in booking products.
|
||||
|
||||
* #4105 [fixed] - Issue with total due in cash on delivery.
|
||||
|
||||
* #3975 [fixed] - Filter is not working properly for status column in case product has not been name and other required details.
|
||||
|
||||
* #4212 [fixed] - Error uninstall developer dependencies going into production mode.
|
||||
|
||||
* #4234 [fixed] - default values are not working in system configuration.
|
||||
|
||||
* #4228 [fixed] - add a validation if user trying to upload greater size image in image search.
|
||||
|
||||
* #3807 [fixed] - Can't locate path for migrations in bagisto/packages.
|
||||
|
||||
* #4248 [fixed] - PayPay scripts are being loaded even if inactive.
|
||||
|
||||
* #4277 [fixed] - subtotal is not updating when remove product from the minicart.
|
||||
|
||||
* #4287 [fixed] - Product locale not correctly selected since admin language select.
|
||||
|
||||
* #4119 [fixed] - Admin should not be able to create multiple cart rule using same coupon code.
|
||||
|
||||
* #4299 [fixed] - sort by newest first or oldest first doesn't work in category.
|
||||
|
||||
* #3932 [fixed] - When copying a product, replicating the image causes it to be volatile.
|
||||
|
||||
* #4335 [fixed] - Image search disable functionality is not working.
|
||||
|
||||
* #4325 [fixed] - address is not saving on onepage checkout.
|
||||
|
||||
* #4394 [fixed] - maintenance mode status is not working in channel section.
|
||||
|
||||
* #4372 [fixed] - The brand attribute should be deletable.
|
||||
|
||||
* #4393 [fixed] - composer test in windows.
|
||||
|
||||
* #4413 [fixed] - getting error when setup fresh bagisto from master.
|
||||
|
||||
* #4408 [fixed] - silder image not work.
|
||||
|
||||
* #4401 [fixed] - composer install --no-dev , gives error.
|
||||
|
||||
* #4192 [fixed] - db connection failed at first time when setup using bagisto:install.
|
||||
|
||||
* #4425 [fixed] - saved billing address details are not showing on onepage checkout.
|
||||
|
||||
* #4434 [fixed] - missing date picker option in event filter #4434.
|
||||
|
||||
* #3374 [fixed] - Social Login Error.
|
||||
|
||||
* #4440 [fixed] - getting exception when allow user role with marketing permission.
|
||||
|
||||
* #3002 [fixed] - Buggggggg iOS Safari images are stretched.
|
||||
|
||||
* #4456 [fixed] - getting exception when filter category, attribute, customer datagrid based on status.
|
||||
|
||||
* #4433 [fixed] - getting exception when filter campaigns/email templates based on status.
|
||||
|
||||
* #4452 [fixed] - products are not visible on homepage if filter based on ar locale.
|
||||
|
||||
* #4457 [fixed] - cart rule status always set as draft.
|
||||
|
||||
* #4428 [fixed] - user roles permission option always save when trying to uncheck selected option.
|
||||
|
||||
* #4392 [fixed] - Multiple cart rule is getting applied in case condition matches on applying only one coupon.
|
||||
|
||||
* #4459 [fixed] - disabled option should not accessible from routes in frontend.
|
||||
|
||||
* #4447 [fixed] - Product URl key not accepting value for Chinese, Japnese, Arabic locale.
|
||||
|
||||
* #4481 [fixed] - Shipping costs are not calculated with grand total.
|
||||
|
||||
* #4399 [fixed] - Role-based security issue - User with no permission has acces to some admin pages/controls.
|
||||
|
||||
* #4369 [fixed] - Product filter [Shop By].
|
||||
|
||||
* #4486 [fixed] - getting exception when copy cart rule.
|
||||
|
||||
* #4386 [fixed] - Slow Category Query.
|
||||
|
||||
* #4432 [fixed] - subscribed checkbox should be mark if customer is already subscribed.
|
||||
|
||||
* #4435 [fixed] - customer group condition doesn't match while sending newsletter email.
|
||||
|
||||
* #4506 [fixed] - customer group pricing fixed discount should accept decimal values.
|
||||
|
||||
* #4498 [fixed] - able to delete root category which is selected in channel.
|
||||
|
||||
* #4420 [fixed] - Invoice PDF breaking.
|
||||
|
||||
* #3638 [fixed] - Promotion, combine "percentage" & "fixed amount to whole cart" cart rules get wrong disco * unt amount.
|
||||
|
||||
* #3572 [fixed] - No info about other discounts in case there is multiple group pricing exist in same product.
|
||||
|
||||
* #4577 [fixed] - error on minicart while adding configurable item.
|
||||
|
||||
* #4571 [fixed] - video is not showing for variant product in product page.
|
||||
|
||||
* #4566 [fixed] - wrong attribute are visible on layered navigation.
|
||||
|
||||
* #4567 [fixed] - configurable product variant attribute options are not visible in layered navigation.
|
||||
|
||||
* #4590 [fixed] - getting exception on cart when remove minimum amount from backend.
|
||||
|
||||
* #4583 [fixed] - inactive template are sending in newsletter mail to subscribed users.
|
||||
|
||||
* #4596 [fixed] - Unable to view order at customer end.
|
||||
|
||||
* #4495 [fixed] - Only load the locales that are enabled on the channel.
|
||||
|
||||
* #4597 [fixed] - Add a product to Wishlist twice issue.
|
||||
|
||||
* #4620 [fixed] - value is not saved in fallback locale in configuration section.
|
||||
|
||||
* #4573 [fixed] - out of stock items are visible on category & search page when configuration is disabled.
|
||||
|
||||
## **v1.2.0 (8th of September 2020)** - *Release*
|
||||
|
||||
* [feature] - Config to add custom css and javascript (Eg. google anlytics)
|
||||
* [feature] - Config to add custom css and javascript (Eg. google anlytics)
|
||||
|
||||
* [feature] - Added some config for payment method additional information
|
||||
|
||||
|
|
@ -480,7 +678,7 @@
|
|||
|
||||
* #3356 [fixed] - search term removed from the search bar in default theme
|
||||
|
||||
* #3357 [fixed] - Image search feature is not available in mobile view default theme
|
||||
* #3357 [fixed] - Image search feature is not available in mobile view default theme
|
||||
|
||||
* #3358 [fixed] - New and sale icon lable on product issue in RTL
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
"intervention/image": "^2.4",
|
||||
"intervention/imagecache": "^2.3",
|
||||
"kalnoy/nestedset": "5.0.1",
|
||||
"khaled.alshamaa/ar-php": "^5.5.2",
|
||||
"khaled.alshamaa/ar-php": "^6.0.0",
|
||||
"konekt/concord": "^1.2",
|
||||
"laravel/framework": "^7.0",
|
||||
"laravel/scout": "^8.0",
|
||||
|
|
@ -161,4 +161,4 @@
|
|||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -28,7 +28,7 @@ return [
|
|||
],
|
||||
|
||||
'admin-api' => [
|
||||
'driver' => 'token',
|
||||
'driver' => 'jwt',
|
||||
'provider' => 'admins',
|
||||
]
|
||||
],
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ class Product extends JsonResource
|
|||
$this->productReviewHelper = app('Webkul\Product\Helpers\Review');
|
||||
|
||||
$this->wishlistHelper = app('Webkul\Customer\Helpers\Wishlist');
|
||||
|
||||
parent::__construct($resource);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +47,8 @@ class Product extends JsonResource
|
|||
'formated_price' => core()->currency($productTypeInstance->getMinimalPrice()),
|
||||
'short_description' => $product->short_description,
|
||||
'description' => $product->description,
|
||||
'images' => ProductImageFacade::collection($product->images),
|
||||
'images' => ProductImage::collection($product->images),
|
||||
'videos' => ProductVideo::collection($product->videos),
|
||||
'base_image' => ProductImageFacade::getProductBaseImage($product),
|
||||
'created_at' => $product->created_at,
|
||||
'updated_at' => $product->updated_at,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Catalog;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ProductVideo extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'url' => $this->url
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.attributes.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.attributes.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.attributes.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.attributes.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.categories.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.categories.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.categories.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.categories.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.families.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.families.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.families.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.families.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.catalog.products.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.products.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link"
|
||||
onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
onclick="window.location = '{{ route('admin.catalog.products.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.catalog.products.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.cms.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.cms.pages.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.cms.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.cms.pages.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.addresses.index', ['id' => $customer->id]) }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.addresses.create-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.index') }}'"></i>
|
||||
|
||||
{{ __('address::app.admin.addresses.title-orders', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.index') }}'"></i>
|
||||
{{ __('admin::app.users.users.confirm-delete-title') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.customers.title') }}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.index') }}'"></i>
|
||||
{{ $customer->first_name . " " . $customer->last_name }}
|
||||
</h1>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.groups.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.groups.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.groups.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.groups.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.note.title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.review.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.reviews.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.review.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.marketing.campaigns.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.campaigns.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.marketing.campaigns.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.events.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.marketing.events.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.events.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.marketing.events.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customers.subscribers.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.subscribers.title-edit') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.email-templates.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.marketing.templates.add-title') }}
|
||||
</h1>
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.marketing.templates.create.after') !!}
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.email-templates.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.marketing.templates.edit-title') }}
|
||||
</h1>
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.marketing.templates.create.after') !!}
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link"
|
||||
onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
onclick="window.location = '{{ route('admin.cart-rules.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.promotions.cart-rules.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link"
|
||||
onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
onclick="window.location = '{{ route('admin.cart-rules.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.promotions.cart-rules.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link"
|
||||
onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
onclick="window.location = '{{ route('admin.catalog-rules.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.promotions.catalog-rules.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link"
|
||||
onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
onclick="window.location = '{{ route('admin.catalog-rules.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.promotions.catalog-rules.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.invoices.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.invoices.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<h1>
|
||||
{!! view_render_event('sales.invoice.title.before', ['order' => $order]) !!}
|
||||
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.invoices.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.invoices.view-title', ['invoice_id' => $invoice->id]) }}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<h1>
|
||||
{!! view_render_event('sales.order.title.before', ['order' => $order]) !!}
|
||||
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.orders.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.orders.view-title', ['order_id' => $order->increment_id]) }}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.refunds.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.refunds.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.refunds.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.refunds.view-title', ['refund_id' => $refund->id]) }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.shipments.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.shipments.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.shipments.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.sales.shipments.view-title', ['shipment_id' => $shipment->id]) }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.channels.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.channels.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.channels.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.channels.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.currencies.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.currencies.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.currencies.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.currencies.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.exchange_rates.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.exchange_rates.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.exchange_rates.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.exchange_rates.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.inventory_sources.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.inventory_sources.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.inventory_sources.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.inventory_sources.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.locales.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.locales.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.locales.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.locales.edit-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sliders.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.sliders.add-title') }}
|
||||
</h1>
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
<select class="control" id="channel_id" name="channel_id" v-validate="'required'" data-vv-as=""{{ __('admin::app.settings.sliders.channels') }}"">
|
||||
@foreach ($channels as $channel)
|
||||
<option value="{{ $channel->id }}" @if ($channel->id == old('channel_id')) selected @endif>
|
||||
{{ __($channel->name) }}
|
||||
{{ __(core()->getChannelName($channel)) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sliders.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.sliders.edit-title') }}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<select class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.settings.sliders.channels') }}"" value="" v-validate="'required'">
|
||||
@foreach ($channels as $channel)
|
||||
<option value="{{ $channel->id }}" @if ($channel->id == $slider->channel_id) selected @endif>
|
||||
{{ __($channel->name) }}
|
||||
{{ __(core()->getChannelName($channel)) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.tax-categories.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.tax-categories.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.tax-categories.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.tax-categories.edit.title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.tax-rates.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.tax-rates.add-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.tax-rates.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.settings.tax-rates.edit.title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.roles.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.users.roles.add-role-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.roles.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.users.roles.edit-role-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.users.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.users.users.add-user-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = history.length > 1 ? document.referrer : '{{ route('admin.dashboard.index') }}'"></i>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.users.index') }}'"></i>
|
||||
|
||||
{{ __('admin::app.users.users.edit-user-title') }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ class BookingProductEventTicketRepository extends Repository
|
|||
$savedTickets[$ticketId]['ticket'] = $ticket;
|
||||
$savedTickets[$ticketId]['ticketInputs'] = $ticketInputs;
|
||||
}
|
||||
|
||||
Event::dispatch('booking_product.booking.event-ticket.save.after', ['tickets' => $savedTickets]);
|
||||
}
|
||||
|
||||
foreach ($previousTicketIds as $previousTicketId) {
|
||||
$this->delete($previousTicketId);
|
||||
}
|
||||
|
||||
Event::dispatch('booking_product.booking.event-ticket.save.after', ['tickets' => $savedTickets]);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,15 +3,15 @@
|
|||
namespace Webkul\CartRule\Helpers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Webkul\Checkout\Facades\Cart;
|
||||
use Webkul\Rule\Helpers\Validator;
|
||||
use Webkul\Checkout\Models\CartItem;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Webkul\CartRule\Repositories\CartRuleRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCouponRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCouponUsageRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCustomerRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
use Webkul\Checkout\Models\CartItem;
|
||||
use Webkul\Rule\Helpers\Validator;
|
||||
use Webkul\Checkout\Facades\Cart;
|
||||
use Webkul\CartRule\Repositories\CartRuleCouponRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCustomerRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCouponUsageRepository;
|
||||
|
||||
class CartRule
|
||||
{
|
||||
|
|
@ -153,7 +153,9 @@ class CartRule
|
|||
if (Cart::getCurrentCustomer()->check()) {
|
||||
$customerGroupId = Cart::getCurrentCustomer()->user()->customer_group_id;
|
||||
} else {
|
||||
if ($customerGuestGroup = $this->customerGroupRepository->findOneByField('code', 'guest')) {
|
||||
$customerGuestGroup = $this->customerGroupRepository->getCustomerGuestGroup();
|
||||
|
||||
if ($customerGuestGroup) {
|
||||
$customerGroupId = $customerGuestGroup->id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
namespace Webkul\CatalogRule\Helpers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Webkul\CatalogRule\Repositories\CatalogRuleProductPriceRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
use Webkul\CatalogRule\Repositories\CatalogRuleProductPriceRepository;
|
||||
|
||||
class CatalogRuleProductPrice
|
||||
{
|
||||
|
|
@ -161,7 +161,7 @@ class CatalogRuleProductPrice
|
|||
|
||||
case 'by_fixed':
|
||||
$price = max(0, $price - $rule->discount_amount);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'by_percent':
|
||||
|
|
@ -191,7 +191,7 @@ class CatalogRuleProductPrice
|
|||
}
|
||||
|
||||
/**
|
||||
* Get catalog rules product price for specific date, channel and customer group
|
||||
* Get catalog rules product price for specific date, channel and customer group.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product $product
|
||||
* @return array|void
|
||||
|
|
@ -201,7 +201,7 @@ class CatalogRuleProductPrice
|
|||
if ($this->getCurrentCustomer()->check()) {
|
||||
$customerGroupId = $this->getCurrentCustomer()->user()->customer_group_id;
|
||||
} else {
|
||||
$customerGroup = $this->customerGroupRepository->findOneByField('code', 'guest');
|
||||
$customerGroup = $this->customerGroupRepository->getCustomerGuestGroup();
|
||||
|
||||
if (! $customerGroup) {
|
||||
return;
|
||||
|
|
@ -210,11 +210,6 @@ class CatalogRuleProductPrice
|
|||
$customerGroupId = $customerGroup->id;
|
||||
}
|
||||
|
||||
return $this->catalogRuleProductPriceRepository->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'customer_group_id' => $customerGroupId,
|
||||
'rule_date' => Carbon::now()->format('Y-m-d'),
|
||||
]);
|
||||
return $this->catalogRuleProductPriceRepository->checkInLoadedCatalogRulePrice($product, $customerGroupId);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
namespace Webkul\CatalogRule\Repositories;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
class CatalogRuleProductPriceRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
* Specify Model class name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -15,4 +16,25 @@ class CatalogRuleProductPriceRepository extends Repository
|
|||
{
|
||||
return 'Webkul\CatalogRule\Contracts\CatalogRuleProductPrice';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if catalog rule prices already loaded. If already loaded then load from it.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function checkInLoadedCatalogRulePrice($product, $customerGroupId)
|
||||
{
|
||||
static $catalogRulePrices = [];
|
||||
|
||||
if (array_key_exists($product->id, $catalogRulePrices)) {
|
||||
return $catalogRulePrices[$product->id];
|
||||
}
|
||||
|
||||
return $catalogRulePrices[$product->id] = $this->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'customer_group_id' => $customerGroupId,
|
||||
'rule_date' => Carbon::now()->format('Y-m-d'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,14 +4,14 @@ namespace Webkul\Core;
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Webkul\Core\Models\Channel;
|
||||
use Webkul\Core\Repositories\CurrencyRepository;
|
||||
use Webkul\Core\Repositories\ExchangeRateRepository;
|
||||
use Webkul\Core\Repositories\CountryRepository;
|
||||
use Webkul\Core\Repositories\CountryStateRepository;
|
||||
use Webkul\Core\Repositories\ChannelRepository;
|
||||
use Webkul\Core\Repositories\LocaleRepository;
|
||||
use Webkul\Core\Repositories\CoreConfigRepository;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Webkul\Core\Repositories\LocaleRepository;
|
||||
use Webkul\Core\Repositories\ChannelRepository;
|
||||
use Webkul\Core\Repositories\CountryRepository;
|
||||
use Webkul\Core\Repositories\CurrencyRepository;
|
||||
use Webkul\Core\Repositories\CoreConfigRepository;
|
||||
use Webkul\Core\Repositories\CountryStateRepository;
|
||||
use Webkul\Core\Repositories\ExchangeRateRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
|
||||
class Core
|
||||
|
|
@ -72,9 +72,20 @@ class Core
|
|||
*/
|
||||
protected $coreConfigRepository;
|
||||
|
||||
/** @var Channel */
|
||||
/**
|
||||
* @var \Webkul\Core\Models\Channel
|
||||
*/
|
||||
private static $channel;
|
||||
|
||||
/**
|
||||
* Register your core config keys here which you don't want to
|
||||
* load in static array. These keys will load from database
|
||||
* everytime the `getConfigData` method is called.
|
||||
*/
|
||||
private $coreConfigExceptions = [
|
||||
'catalog.products.guest-checkout.allow-guest-checkout'
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
|
|
@ -118,7 +129,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all channels
|
||||
* Returns all channels.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
|
@ -134,7 +145,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns currenct channel models
|
||||
* Returns currenct channel models.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Channel
|
||||
*/
|
||||
|
|
@ -158,7 +169,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the current channel
|
||||
* Set the current channel.
|
||||
*
|
||||
* @param Channel $channel
|
||||
*/
|
||||
|
|
@ -168,7 +179,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns currenct channel code
|
||||
* Returns currenct channel code.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Channel
|
||||
*/
|
||||
|
|
@ -184,7 +195,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns default channel models
|
||||
* Returns default channel models.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Channel
|
||||
*/
|
||||
|
|
@ -206,7 +217,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the default channel code configured in config/app.php
|
||||
* Returns the default channel code configured in `config/app.php`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -228,13 +239,7 @@ class Core
|
|||
*/
|
||||
public function getChannelName($channel): string
|
||||
{
|
||||
static $channelName;
|
||||
|
||||
if ($channelName) {
|
||||
return $channelName;
|
||||
}
|
||||
|
||||
return $channelName = $channel->name
|
||||
return $channel->name
|
||||
?? $channel->translate(app()->getLocale())->name
|
||||
?? $channel->translate(config('app.fallback_locale'))->name;
|
||||
}
|
||||
|
|
@ -256,7 +261,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns current locale
|
||||
* Returns current locale.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Locale
|
||||
*/
|
||||
|
|
@ -278,7 +283,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all Customer Groups
|
||||
* Returns all customer groups.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
|
@ -294,7 +299,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all currencies
|
||||
* Returns all currencies.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
|
@ -310,7 +315,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency model
|
||||
* Returns base channel's currency model.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Currency
|
||||
*/
|
||||
|
|
@ -332,7 +337,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency code
|
||||
* Returns base channel's currency code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -348,7 +353,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency model
|
||||
* Returns base channel's currency model.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Currency
|
||||
*/
|
||||
|
|
@ -366,7 +371,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency code
|
||||
* Returns base channel's currency code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -382,7 +387,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency model
|
||||
* Returns current channel's currency model.
|
||||
*
|
||||
* @return \Webkul\Core\Contracts\Currency
|
||||
*/
|
||||
|
|
@ -404,7 +409,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency code
|
||||
* Returns current channel's currency code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -420,7 +425,27 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts price
|
||||
* Returns exchange rates.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getExchangeRate($targetCurrencyId)
|
||||
{
|
||||
static $exchangeRate;
|
||||
|
||||
if ($exchangeRate || $exchangeRate === '') {
|
||||
return $exchangeRate;
|
||||
}
|
||||
|
||||
$found = $this->exchangeRateRepository->findOneWhere([
|
||||
'target_currency' => $targetCurrencyId,
|
||||
]);
|
||||
|
||||
return $exchangeRate = ($found ? $found : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts price.
|
||||
*
|
||||
* @param float $amount
|
||||
* @param string $targetCurrencyCode
|
||||
|
|
@ -456,11 +481,9 @@ class Core
|
|||
return $amount;
|
||||
}
|
||||
|
||||
$exchangeRate = $this->exchangeRateRepository->findOneWhere([
|
||||
'target_currency' => $targetCurrency->id,
|
||||
]);
|
||||
$exchangeRate = $this->getExchangeRate($targetCurrency->id);
|
||||
|
||||
if (null === $exchangeRate || ! $exchangeRate->rate) {
|
||||
if ('' === $exchangeRate || null === $exchangeRate || ! $exchangeRate->rate) {
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
|
@ -474,7 +497,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts to base price
|
||||
* Converts to base price.
|
||||
*
|
||||
* @param float $amount
|
||||
* @param string $targetCurrencyCode
|
||||
|
|
@ -503,7 +526,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Format and convert price with currency symbol
|
||||
* Format and convert price with currency symbol.
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
|
|
@ -519,7 +542,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Return currency symbol from currency code
|
||||
* Return currency symbol from currency code.
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
|
|
@ -533,7 +556,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Format and convert price with currency symbol
|
||||
* Format and convert price with currency symbol.
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
|
|
@ -550,7 +573,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Format and convert price with currency symbol
|
||||
* Format and convert price with currency symbol.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -565,7 +588,7 @@ class Core
|
|||
$pattern = str_replace("#,##0.00", "%v", $pattern);
|
||||
|
||||
return [
|
||||
'symbol' => core()->currencySymbol(core()->getCurrentCurrencyCode()),
|
||||
'symbol' => $this->currencySymbol($this->getCurrentCurrencyCode()),
|
||||
'decimal' => $formater->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL),
|
||||
'format' => $pattern,
|
||||
];
|
||||
|
|
@ -604,7 +627,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if current date of the given channel (in the channel timezone) is within the range
|
||||
* Checks if current date of the given channel (in the channel timezone) is within the range.
|
||||
*
|
||||
* @param int|string|\Webkul\Core\Contracts\Channel $channel
|
||||
* @param string|null $dateFrom
|
||||
|
|
@ -638,7 +661,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Get channel timestamp, timstamp will be builded with channel timezone settings
|
||||
* Get channel timestamp, timstamp will be builded with channel timezone settings.
|
||||
*
|
||||
* @param \Webkul\Core\Contracts\Channel $channel
|
||||
*
|
||||
|
|
@ -660,7 +683,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Check whether sql date is empty
|
||||
* Check whether sql date is empty.
|
||||
*
|
||||
* @param string $date
|
||||
*
|
||||
|
|
@ -693,7 +716,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve information from payment configuration
|
||||
* Retrieve information from payment configuration.
|
||||
*
|
||||
* @param string $field
|
||||
* @param int|string|null $channelId
|
||||
|
|
@ -703,51 +726,20 @@ class Core
|
|||
*/
|
||||
public function getConfigData($field, $channel = null, $locale = null)
|
||||
{
|
||||
if (null === $channel) {
|
||||
$channel = request()->get('channel') ?: ($this->getCurrentChannelCode() ?: $this->getDefaultChannelCode());
|
||||
}
|
||||
static $loadedConfigs = [];
|
||||
|
||||
if (null === $locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
}
|
||||
|
||||
$fields = $this->getConfigField($field);
|
||||
|
||||
$channel_based = false;
|
||||
$locale_based = false;
|
||||
|
||||
if (isset($fields['channel_based']) && $fields['channel_based']) {
|
||||
$channel_based = true;
|
||||
}
|
||||
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
$locale_based = true;
|
||||
}
|
||||
|
||||
if (isset($fields['channel_based']) && $fields['channel_based']) {
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'channel_code' => $channel,
|
||||
'locale_code' => $locale,
|
||||
]);
|
||||
} else {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'channel_code' => $channel,
|
||||
]);
|
||||
}
|
||||
if (array_key_exists($field, $loadedConfigs) && ! in_array($field, $this->coreConfigExceptions)) {
|
||||
$coreConfigValue = $loadedConfigs[$field];
|
||||
} else {
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'locale_code' => $locale,
|
||||
]);
|
||||
} else {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
]);
|
||||
if (null === $channel) {
|
||||
$channel = request()->get('channel') ?: ($this->getCurrentChannelCode() ?: $this->getDefaultChannelCode());
|
||||
}
|
||||
|
||||
if (null === $locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
}
|
||||
|
||||
$loadedConfigs[$field] = $coreConfigValue = $this->getCoreConfigValue($field, $channel, $locale);
|
||||
}
|
||||
|
||||
if (! $coreConfigValue) {
|
||||
|
|
@ -764,7 +756,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve a group of information from the core config table
|
||||
* Retrieve a group of information from the core config table.
|
||||
*
|
||||
* @param mixed $criteria
|
||||
*
|
||||
|
|
@ -776,7 +768,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve all countries
|
||||
* Retrieve all countries.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
|
@ -786,7 +778,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns country name by code
|
||||
* Returns country name by code.
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
|
|
@ -800,7 +792,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve all country states
|
||||
* Retrieve all country states.
|
||||
*
|
||||
* @param string $countryCode
|
||||
*
|
||||
|
|
@ -812,7 +804,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve all grouped states by country code
|
||||
* Retrieve all grouped states by country code.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
|
@ -828,7 +820,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve all grouped states by country code
|
||||
* Retrieve all grouped states by country code.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
|
@ -846,7 +838,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns time intervals
|
||||
* Returns time intervals.
|
||||
*
|
||||
* @param \Illuminate\Support\Carbon $startDate
|
||||
* @param \Illuminate\Support\Carbon $endDate
|
||||
|
|
@ -906,7 +898,6 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $date
|
||||
* @param int $day
|
||||
*
|
||||
|
|
@ -928,7 +919,7 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* Method to sort through the acl items and put them in order
|
||||
* Method to sort through the acl items and put them in order.
|
||||
*
|
||||
* @param array $items
|
||||
*
|
||||
|
|
@ -1044,6 +1035,86 @@ class Core
|
|||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $array1
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function convertEmptyStringsToNull($array)
|
||||
{
|
||||
foreach ($array as $key => $value) {
|
||||
if ($value == "" || $value == "null") {
|
||||
$array[$key] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create singleton object through single facade.
|
||||
*
|
||||
* @param string $className
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getSingletonInstance($className)
|
||||
{
|
||||
static $instance = [];
|
||||
|
||||
if (array_key_exists($className, $instance)) {
|
||||
return $instance[$className];
|
||||
}
|
||||
|
||||
return $instance[$className] = app($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string as selector part for identifying elements in views.
|
||||
*
|
||||
* @param float $taxRate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function taxRateAsIdentifier(float $taxRate): string
|
||||
{
|
||||
return str_replace('.', '_', (string)$taxRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shop email sender details.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSenderEmailDetails()
|
||||
{
|
||||
$sender_name = $this->getConfigData('general.general.email_settings.sender_name') ? $this->getConfigData('general.general.email_settings.sender_name') : config('mail.from.name');
|
||||
|
||||
$sender_email = $this->getConfigData('general.general.email_settings.shop_email_from') ? $this->getConfigData('general.general.email_settings.shop_email_from') : config('mail.from.address');
|
||||
|
||||
return [
|
||||
'name' => $sender_name,
|
||||
'email' => $sender_email,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Admin email details.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAdminEmailDetails()
|
||||
{
|
||||
$admin_name = $this->getConfigData('general.general.email_settings.admin_name') ? $this->getConfigData('general.general.email_settings.admin_name') : config('mail.admin.name');
|
||||
|
||||
$admin_email = $this->getConfigData('general.general.email_settings.admin_email') ? $this->getConfigData('general.general.email_settings.admin_email') : config('mail.admin.address');
|
||||
|
||||
return [
|
||||
'name' => $admin_name,
|
||||
'email' => $admin_email,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $array1
|
||||
* @param array $array2
|
||||
|
|
@ -1066,82 +1137,38 @@ class Core
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $array1
|
||||
*
|
||||
* @return array
|
||||
* Get core config values.
|
||||
*/
|
||||
public function convertEmptyStringsToNull($array)
|
||||
protected function getCoreConfigValue($field, $channel, $locale)
|
||||
{
|
||||
foreach ($array as $key => $value) {
|
||||
if ($value == "" || $value == "null") {
|
||||
$array[$key] = null;
|
||||
$fields = $this->getConfigField($field);
|
||||
|
||||
if (isset($fields['channel_based']) && $fields['channel_based']) {
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'channel_code' => $channel,
|
||||
'locale_code' => $locale,
|
||||
]);
|
||||
} else {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'channel_code' => $channel,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if (isset($fields['locale_based']) && $fields['locale_based']) {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
'locale_code' => $locale,
|
||||
]);
|
||||
} else {
|
||||
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
|
||||
'code' => $field,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create singletom object through single facade
|
||||
*
|
||||
* @param string $className
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getSingletonInstance($className)
|
||||
{
|
||||
static $instance = [];
|
||||
|
||||
if (array_key_exists($className, $instance)) {
|
||||
return $instance[$className];
|
||||
}
|
||||
|
||||
return $instance[$className] = app($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string as selector part for identifying elements in views
|
||||
*
|
||||
* @param float $taxRate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function taxRateAsIdentifier(float $taxRate): string
|
||||
{
|
||||
return str_replace('.', '_', (string)$taxRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shop email sender details
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSenderEmailDetails()
|
||||
{
|
||||
$sender_name = core()->getConfigData('general.general.email_settings.sender_name') ? core()->getConfigData('general.general.email_settings.sender_name') : config('mail.from.name');
|
||||
|
||||
$sender_email = core()->getConfigData('general.general.email_settings.shop_email_from') ? core()->getConfigData('general.general.email_settings.shop_email_from') : config('mail.from.address');
|
||||
|
||||
return [
|
||||
'name' => $sender_name,
|
||||
'email' => $sender_email,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Admin email details
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAdminEmailDetails()
|
||||
{
|
||||
$admin_name = core()->getConfigData('general.general.email_settings.admin_name') ? core()->getConfigData('general.general.email_settings.admin_name') : config('mail.admin.name');
|
||||
|
||||
$admin_email = core()->getConfigData('general.general.email_settings.admin_email') ? core()->getConfigData('general.general.email_settings.admin_email') : config('mail.admin.address');
|
||||
|
||||
return [
|
||||
'name' => $admin_name,
|
||||
'email' => $admin_email,
|
||||
];
|
||||
return $coreConfigValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -123,5 +123,15 @@ class ConfigTableSeeder extends Seeder
|
|||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
DB::table('core_config')->insert([
|
||||
'id' => 12,
|
||||
'code' => 'catalog.products.homepage.out_of_stock_items',
|
||||
'value' => '1',
|
||||
'channel_code' => null,
|
||||
'locale_code' => null,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -162,24 +162,20 @@ class ExchangeRateController extends Controller
|
|||
{
|
||||
$exchangeRate = $this->exchangeRateRepository->findOrFail($id);
|
||||
|
||||
if ($this->exchangeRateRepository->count() == 1) {
|
||||
session()->flash('error', trans('admin::app.settings.exchange_rates.last-delete-error'));
|
||||
} else {
|
||||
try {
|
||||
Event::dispatch('core.exchange_rate.delete.before', $id);
|
||||
try {
|
||||
Event::dispatch('core.exchange_rate.delete.before', $id);
|
||||
|
||||
$this->exchangeRateRepository->delete($id);
|
||||
$this->exchangeRateRepository->delete($id);
|
||||
|
||||
session()->flash('success', trans('admin::app.settings.exchange_rates.delete-success'));
|
||||
session()->flash('success', trans('admin::app.settings.exchange_rates.delete-success'));
|
||||
|
||||
Event::dispatch('core.exchange_rate.delete.after', $id);
|
||||
Event::dispatch('core.exchange_rate.delete.after', $id);
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
|
||||
session()->flash('error', trans('admin::app.response.delete-error', ['name' => 'Exchange rate']));
|
||||
}
|
||||
return response()->json(['message' => true], 200);
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
|
||||
session()->flash('error', trans('admin::app.response.delete-error', ['name' => 'Exchange rate']));
|
||||
}
|
||||
|
||||
return response()->json(['message' => false], 400);
|
||||
|
|
|
|||
|
|
@ -72,9 +72,10 @@ class SubscriptionController extends Controller
|
|||
|
||||
$customer = $subscriber->customer;
|
||||
|
||||
$customer->subscribed_to_news_letter = $data['is_subscribed'];
|
||||
|
||||
$customer->save();
|
||||
if (! is_null($customer)) {
|
||||
$customer->subscribed_to_news_letter = $data['is_subscribed'];
|
||||
$customer->save();
|
||||
}
|
||||
|
||||
$result = $subscriber->update($data);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,28 +2,8 @@
|
|||
|
||||
namespace Webkul\Customer\Helpers;
|
||||
|
||||
use Webkul\Customer\Repositories\WishlistRepository;
|
||||
|
||||
class Wishlist
|
||||
{
|
||||
/**
|
||||
* WishlistRepository object
|
||||
*
|
||||
* @var \Webkul\Customer\Repositories\WishlistRepository
|
||||
*/
|
||||
protected $wishlistRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\WishlistRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(WishlistRepository $wishlistRepository)
|
||||
{
|
||||
$this->wishlistRepository = $wishlistRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns wishlist products for current customer.
|
||||
*
|
||||
|
|
@ -34,12 +14,10 @@ class Wishlist
|
|||
{
|
||||
$wishlist = false;
|
||||
|
||||
if (auth()->guard('customer')->user()) {
|
||||
$wishlist = $this->wishlistRepository->findOneWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $product->product_id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id,
|
||||
]);
|
||||
if ($customer = auth()->guard('customer')->user()) {
|
||||
$wishlist = $customer->wishlist_items->filter(function ($item) use ($product) {
|
||||
return $item->channel_id == core()->getCurrentChannel()->id && $item->product_id == $product->product_id;
|
||||
})->first();
|
||||
}
|
||||
|
||||
if ($wishlist) {
|
||||
|
|
|
|||
|
|
@ -42,4 +42,20 @@ class CustomerGroupRepository extends Repository
|
|||
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns guest group.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getCustomerGuestGroup()
|
||||
{
|
||||
static $customerGuestGroup;
|
||||
|
||||
if ($customerGuestGroup) {
|
||||
return $customerGuestGroup;
|
||||
}
|
||||
|
||||
return $customerGuestGroup = $this->findOneByField('code', 'guest');
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +61,20 @@ class WishlistRepository extends Repository
|
|||
*/
|
||||
public function getCustomerWhishlist()
|
||||
{
|
||||
return $this->model->where([
|
||||
$query = $this->model;
|
||||
|
||||
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
$query = $this->model
|
||||
->leftJoin('products as ps', 'wishlist.product_id', '=', 'ps.id')
|
||||
->leftJoin('product_inventories as pv', 'ps.id', '=', 'pv.product_id')
|
||||
->where(function ($qb) {
|
||||
$qb
|
||||
->WhereIn('ps.type', ['configurable', 'grouped', 'downloadable', 'bundle', 'booking'])
|
||||
->orwhereIn('ps.type', ['simple', 'virtual'])->where('pv.qty' , '>' , 0);
|
||||
});
|
||||
}
|
||||
|
||||
return $query->where([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id,
|
||||
])->paginate(5);
|
||||
|
|
|
|||
|
|
@ -15,4 +15,24 @@ class InventorySourceRepository extends Repository
|
|||
{
|
||||
return 'Webkul\Inventory\Contracts\InventorySource';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns channel inventory source ids.
|
||||
*
|
||||
* @return collection
|
||||
*/
|
||||
public function getChannelInventorySourceIds()
|
||||
{
|
||||
static $channelInventorySourceIds;
|
||||
|
||||
if ($channelInventorySourceIds) {
|
||||
return $channelInventorySourceIds;
|
||||
}
|
||||
|
||||
$found = core()->getCurrentChannel()->inventory_sources()
|
||||
->where('status', 1)
|
||||
->pluck('id');
|
||||
|
||||
return $channelInventorySourceIds = ($found ? $found : collect([]));
|
||||
}
|
||||
}
|
||||
|
|
@ -74,6 +74,28 @@ class Review extends AbstractProduct
|
|||
return $totalRating[$product->id] = $product->reviews()->where('status', 'approved')->sum('rating');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns reviews with ratings.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
*
|
||||
* @return collection
|
||||
*/
|
||||
public function getReviewsWithRatings($product)
|
||||
{
|
||||
static $reviews = [];
|
||||
|
||||
if (array_key_exists($product->id, $reviews)) {
|
||||
return $reviews[$product->id];
|
||||
}
|
||||
|
||||
return $reviews[$product->id] = $product->reviews()->where('status', 'approved')
|
||||
->select('rating', DB::raw('count(*) as total'))
|
||||
->groupBy('rating')
|
||||
->orderBy('rating', 'desc')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Percentage rating of the product
|
||||
*
|
||||
|
|
@ -82,11 +104,7 @@ class Review extends AbstractProduct
|
|||
*/
|
||||
public function getPercentageRating($product)
|
||||
{
|
||||
$reviews = $product->reviews()->where('status', 'approved')
|
||||
->select('rating', DB::raw('count(*) as total'))
|
||||
->groupBy('rating')
|
||||
->orderBy('rating', 'desc')
|
||||
->get();
|
||||
$reviews = $this->getReviewsWithRatings($product);
|
||||
|
||||
$totalReviews = $this->getTotalReviews($product);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use Webkul\Attribute\Models\AttributeFamilyProxy;
|
|||
use Webkul\Inventory\Models\InventorySourceProxy;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Product\Contracts\Product as ProductContract;
|
||||
use Webkul\CatalogRule\Models\CatalogRuleProductPriceProxy;
|
||||
|
||||
class Product extends Model implements ProductContract
|
||||
{
|
||||
|
|
@ -338,6 +339,23 @@ class Product extends Model implements ProductContract
|
|||
return parent::getAttribute($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check in loaded family attributes.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function checkInLoadedFamilyAttributes()
|
||||
{
|
||||
static $loadedFamilyAttributes = [];
|
||||
|
||||
if (array_key_exists($this->attribute_family_id, $loadedFamilyAttributes)) {
|
||||
return $loadedFamilyAttributes[$this->attribute_family_id];
|
||||
}
|
||||
|
||||
return $loadedFamilyAttributes[$this->attribute_family_id] = core()->getSingletonInstance(AttributeRepository::class)
|
||||
->getFamilyAttributes($this->attribute_family);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -348,9 +366,7 @@ class Product extends Model implements ProductContract
|
|||
$hiddenAttributes = $this->getHidden();
|
||||
|
||||
if (isset($this->id)) {
|
||||
$familyAttributes = core()
|
||||
->getSingletonInstance(AttributeRepository::class)
|
||||
->getFamilyAttributes($this->attribute_family);
|
||||
$familyAttributes = $this->checkInLoadedFamilyAttributes();
|
||||
|
||||
foreach ($familyAttributes as $attribute) {
|
||||
if (in_array($attribute->code, $hiddenAttributes)) {
|
||||
|
|
|
|||
|
|
@ -121,16 +121,14 @@ class ProductFlat extends Model implements ProductFlatContract
|
|||
*/
|
||||
public function images()
|
||||
{
|
||||
return (ProductImageProxy::modelClass())
|
||||
::where('product_images.product_id', $this->product_id)
|
||||
->select('product_images.*');
|
||||
return $this->hasMany(ProductImageProxy::modelClass(), 'product_id', 'product_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* The videos that belong to the product.
|
||||
*/
|
||||
public function videos()
|
||||
{
|
||||
{
|
||||
return $this->product->videos();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,16 @@ class ProductImage extends AbstractProduct
|
|||
*/
|
||||
public function getGalleryImages($product)
|
||||
{
|
||||
static $loadedGalleryImages = [];
|
||||
|
||||
if (! $product) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (array_key_exists($product->id, $loadedGalleryImages)) {
|
||||
return $loadedGalleryImages[$product->id];
|
||||
}
|
||||
|
||||
$images = [];
|
||||
|
||||
foreach ($product->images as $image) {
|
||||
|
|
@ -64,16 +70,60 @@ class ProductImage extends AbstractProduct
|
|||
];
|
||||
}
|
||||
|
||||
return $images;
|
||||
return $loadedGalleryImages[$product->id] = $images;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product's base image
|
||||
* This method will first check whether the gallery images are already
|
||||
* present or not. If not then it will load from the product.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @param array
|
||||
* @return array
|
||||
*/
|
||||
public function getProductBaseImage($product, array $galleryImages = null)
|
||||
{
|
||||
static $loadedBaseImages = [];
|
||||
|
||||
if ($product) {
|
||||
if (array_key_exists($product->id, $loadedBaseImages)) {
|
||||
return $loadedBaseImages[$product->id];
|
||||
}
|
||||
|
||||
return $loadedBaseImages[$product->id] = $galleryImages
|
||||
? $galleryImages[0]
|
||||
: $this->otherwiseLoadFromProduct($product);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product varient image if available otherwise product base image.
|
||||
*
|
||||
* @param \Webkul\Customer\Contracts\Wishlist $item
|
||||
* @return array
|
||||
*/
|
||||
public function getProductImage($item)
|
||||
{
|
||||
if ($item instanceof \Webkul\Customer\Contracts\Wishlist) {
|
||||
if (isset($item->additional['selected_configurable_option'])) {
|
||||
$product = $this->productRepository->find($item->additional['selected_configurable_option']);
|
||||
} else {
|
||||
$product = $item->product;
|
||||
}
|
||||
} else {
|
||||
$product = $item->product;
|
||||
}
|
||||
|
||||
return $this->getProductBaseImage($product);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load product's base image.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return array
|
||||
*/
|
||||
public function getProductBaseImage($product)
|
||||
protected function otherwiseLoadFromProduct($product)
|
||||
{
|
||||
$images = $product ? $product->images : null;
|
||||
|
||||
|
|
@ -95,25 +145,4 @@ class ProductImage extends AbstractProduct
|
|||
|
||||
return $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product varient image if available otherwise product base image
|
||||
*
|
||||
* @param \Webkul\Customer\Contracts\Wishlist $item
|
||||
* @return array
|
||||
*/
|
||||
public function getProductImage($item)
|
||||
{
|
||||
if ($item instanceof \Webkul\Customer\Contracts\Wishlist) {
|
||||
if (isset($item->additional['selected_configurable_option'])) {
|
||||
$product = $this->productRepository->find($item->additional['selected_configurable_option']);
|
||||
} else {
|
||||
$product = $item->product;
|
||||
}
|
||||
} else {
|
||||
$product = $item->product;
|
||||
}
|
||||
|
||||
return $this->getProductBaseImage($product);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,13 @@
|
|||
|
||||
namespace Webkul\Product\Repositories;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
class ProductCustomerGroupPriceRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
* Specify Model class name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -50,4 +48,22 @@ class ProductCustomerGroupPriceRepository extends Repository
|
|||
$this->delete($customerGroupPriceId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if product customer group prices already loaded then load from it.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function checkInLoadedCustomerGroupPrice($product, $customerGroupId)
|
||||
{
|
||||
static $customerGroupPrices = [];
|
||||
|
||||
if (array_key_exists($product->id, $customerGroupPrices)) {
|
||||
return $customerGroupPrices[$product->id];
|
||||
}
|
||||
|
||||
return $customerGroupPrices[$product->id] = $product->customer_group_prices->filter(function ($customerGroupPrice) use ($customerGroupId) {
|
||||
return $customerGroupPrice->customer_group_id == $customerGroupId || is_null($customerGroupPrice->customer_group_id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -19,11 +19,17 @@ class ProductFlatRepository extends Repository
|
|||
*/
|
||||
public function getCategoryProductMaximumPrice($category = null)
|
||||
{
|
||||
static $loadedCategoryMaxPrice = [];
|
||||
|
||||
if (! $category) {
|
||||
return $this->model->max('max_price');
|
||||
}
|
||||
|
||||
return $this->model
|
||||
if (array_key_exists($category->id, $loadedCategoryMaxPrice)) {
|
||||
return $loadedCategoryMaxPrice[$category->id];
|
||||
}
|
||||
|
||||
return $loadedCategoryMaxPrice[$category->id] = $this->model
|
||||
->leftJoin('product_categories', 'product_flat.product_id', 'product_categories.product_id')
|
||||
->where('product_categories.category_id', $category->id)
|
||||
->max('max_price');
|
||||
|
|
@ -108,6 +114,12 @@ class ProductFlatRepository extends Repository
|
|||
*/
|
||||
public function getProductsRelatedFilterableAttributes($category)
|
||||
{
|
||||
static $loadedCategoryAttributes = [];
|
||||
|
||||
if (array_key_exists($category->id, $loadedCategoryAttributes)) {
|
||||
return $loadedCategoryAttributes[$category->id];
|
||||
}
|
||||
|
||||
$productsCount = $this->categoryProductQuerybuilder($category->id)->count();
|
||||
|
||||
if ($productsCount > 0) {
|
||||
|
|
@ -122,10 +134,10 @@ class ProductFlatRepository extends Repository
|
|||
}
|
||||
])->whereIn('id', $allFilterableAttributes)->get();
|
||||
|
||||
return $attributes;
|
||||
return $loadedCategoryAttributes[$category->id] = $attributes;
|
||||
} else {
|
||||
|
||||
return $category->filterableAttributes;
|
||||
return $loadedCategoryAttributes[$category->id] = $category->filterableAttributes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
namespace Webkul\Product\Repositories;
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
class ProductInventoryRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
* Specify Model class name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -49,4 +48,20 @@ class ProductInventoryRepository extends Repository
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if product inventories are already loaded. If already loaded then load from it.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function checkInLoadedProductInventories($product)
|
||||
{
|
||||
static $productInventories = [];
|
||||
|
||||
if (array_key_exists($product->id, $productInventories)) {
|
||||
return $productInventories[$product->id];
|
||||
}
|
||||
|
||||
return $productInventories[$product->id] = $product->inventories;
|
||||
}
|
||||
}
|
||||
|
|
@ -165,6 +165,10 @@ class ProductRepository extends Repository
|
|||
$qb->where('product_categories.category_id', $categoryId);
|
||||
}
|
||||
|
||||
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
$qb = $this->checkOutOfStockItem($qb);
|
||||
}
|
||||
|
||||
if (is_null(request()->input('status'))) {
|
||||
$qb->where('product_flat.status', 1);
|
||||
}
|
||||
|
|
@ -428,6 +432,11 @@ class ProductRepository extends Repository
|
|||
->paginate(16);
|
||||
} else {
|
||||
$results = app(ProductFlatRepository::class)->scopeQuery(function ($query) use ($term, $channel, $locale) {
|
||||
|
||||
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
$query = $this->checkOutOfStockItem($query);
|
||||
}
|
||||
|
||||
return $query->distinct()
|
||||
->addSelect('product_flat.*')
|
||||
->where('product_flat.status', 1)
|
||||
|
|
@ -796,4 +805,19 @@ class ProductRepository extends Repository
|
|||
|
||||
Storage::copy($data->path, $copiedProductImageVideo->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Webkul\Product\Models\ProductFlat
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function checkOutOfStockItem($query) {
|
||||
return $query->leftJoin('products as ps', 'product_flat.product_id', '=', 'ps.id')
|
||||
->leftJoin('product_inventories as pv', 'product_flat.product_id', '=', 'pv.product_id')
|
||||
->where(function ($qb) {
|
||||
$qb
|
||||
->WhereIn('ps.type', ['configurable', 'grouped', 'downloadable', 'bundle', 'booking'])
|
||||
->orwhereIn('ps.type', ['simple', 'virtual'])->where('pv.qty' , '>' , 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -12,8 +12,11 @@ use Webkul\Attribute\Repositories\AttributeRepository;
|
|||
use Webkul\Product\Datatypes\CartItemValidationResult;
|
||||
use Webkul\Product\Repositories\ProductImageRepository;
|
||||
use Webkul\Product\Repositories\ProductVideoRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
use Webkul\Inventory\Repositories\InventorySourceRepository;
|
||||
use Webkul\Product\Repositories\ProductInventoryRepository;
|
||||
use Webkul\Product\Repositories\ProductAttributeValueRepository;
|
||||
use Webkul\Product\Repositories\ProductCustomerGroupPriceRepository;
|
||||
|
||||
abstract class AbstractType
|
||||
{
|
||||
|
|
@ -288,7 +291,7 @@ abstract class AbstractType
|
|||
|
||||
$this->productVideoRepository->uploadVideos($data, $product);
|
||||
|
||||
app('Webkul\Product\Repositories\ProductCustomerGroupPriceRepository')->saveCustomerGroupPrices($data,
|
||||
app(ProductCustomerGroupPriceRepository::class)->saveCustomerGroupPrices($data,
|
||||
$product);
|
||||
}
|
||||
|
||||
|
|
@ -435,20 +438,18 @@ abstract class AbstractType
|
|||
{
|
||||
$total = 0;
|
||||
|
||||
$channelInventorySourceIds = core()->getCurrentChannel()
|
||||
->inventory_sources()
|
||||
->where('status', 1)
|
||||
->pluck('id');
|
||||
$channelInventorySourceIds = app(InventorySourceRepository::class)->getChannelInventorySourceIds();
|
||||
|
||||
foreach ($this->product->inventories as $inventory) {
|
||||
if (is_numeric($index = $channelInventorySourceIds->search($inventory->inventory_source_id))) {
|
||||
$productInventories = $this->productInventoryRepository->checkInLoadedProductInventories($this->product);
|
||||
|
||||
foreach ($productInventories as $inventory) {
|
||||
if (is_numeric($channelInventorySourceIds->search($inventory->inventory_source_id))) {
|
||||
$total += $inventory->qty;
|
||||
}
|
||||
}
|
||||
|
||||
$orderedInventory = $this->product->ordered_inventories()
|
||||
->where('channel_id', core()->getCurrentChannel()->id)
|
||||
->first();
|
||||
->where('channel_id', core()->getCurrentChannel()->id)->first();
|
||||
|
||||
if ($orderedInventory) {
|
||||
$total -= $orderedInventory->qty;
|
||||
|
|
@ -573,7 +574,9 @@ abstract class AbstractType
|
|||
|
||||
$rulePrice = app('Webkul\CatalogRule\Helpers\CatalogRuleProductPrice')->getRulePrice($this->product);
|
||||
|
||||
if ((is_null($this->product->special_price) || ! (float)$this->product->special_price)
|
||||
$specialPrice = $this->product->special_price;
|
||||
|
||||
if ((is_null($specialPrice) || ! (float) $specialPrice)
|
||||
&& ! $rulePrice
|
||||
&& $customerGroupPrice == $this->product->price
|
||||
) {
|
||||
|
|
@ -582,7 +585,7 @@ abstract class AbstractType
|
|||
|
||||
$haveSpecialPrice = false;
|
||||
|
||||
if (! (float)$this->product->special_price) {
|
||||
if (! (float) $specialPrice) {
|
||||
if ($rulePrice && $rulePrice->price < $this->product->price) {
|
||||
$this->product->special_price = $rulePrice->price;
|
||||
|
||||
|
|
@ -633,18 +636,14 @@ abstract class AbstractType
|
|||
if (Cart::getCurrentCustomer()->check()) {
|
||||
$customerGroupId = Cart::getCurrentCustomer()->user()->customer_group_id;
|
||||
} else {
|
||||
$customerGroupRepository = app('Webkul\Customer\Repositories\CustomerGroupRepository');
|
||||
$customerGuestGroup = app(CustomerGroupRepository::class)->getCustomerGuestGroup();
|
||||
|
||||
if ($customerGuestGroup = $customerGroupRepository->findOneByField('code', 'guest')) {
|
||||
if ($customerGuestGroup) {
|
||||
$customerGroupId = $customerGuestGroup->id;
|
||||
}
|
||||
}
|
||||
|
||||
$customerGroupPrices = $product->customer_group_prices()->where(function ($query) use ($customerGroupId) {
|
||||
$query->where('customer_group_id', $customerGroupId)
|
||||
->orWhereNull('customer_group_id');
|
||||
}
|
||||
)->get();
|
||||
$customerGroupPrices = app(ProductCustomerGroupPriceRepository::class)->checkInLoadedCustomerGroupPrice($product, $customerGroupId);
|
||||
|
||||
if (!$customerGroupPrices->count()) {
|
||||
return $product->price;
|
||||
|
|
@ -995,4 +994,20 @@ abstract class AbstractType
|
|||
|
||||
return $offerLines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check in loaded saleable.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function checkInLoadedSaleableChecks($product, $callback)
|
||||
{
|
||||
static $loadedSaleableChecks = [];
|
||||
|
||||
if (array_key_exists($product->id, $loadedSaleableChecks)) {
|
||||
return $loadedSaleableChecks[$product->id];
|
||||
}
|
||||
|
||||
return $loadedSaleableChecks[$product->id] = $callback($product);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,14 @@
|
|||
|
||||
namespace Webkul\Product\Type;
|
||||
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Product\Models\ProductFlat;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Product\Repositories\ProductAttributeValueRepository;
|
||||
use Webkul\Product\Repositories\ProductInventoryRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Product\Repositories\ProductImageRepository;
|
||||
use Webkul\Product\Repositories\ProductVideoRepository;
|
||||
use Webkul\Product\Repositories\ProductInventoryRepository;
|
||||
use Webkul\Product\Repositories\ProductAttributeValueRepository;
|
||||
use Webkul\Product\Repositories\ProductGroupedProductRepository;
|
||||
use Webkul\Product\Models\ProductAttributeValue;
|
||||
use Webkul\Product\Models\ProductFlat;
|
||||
|
||||
class Grouped extends AbstractType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,33 +19,36 @@ class Simple extends AbstractType
|
|||
];
|
||||
|
||||
/**
|
||||
* Show quantity box
|
||||
* Show quantity box.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $showQuantityBox = true;
|
||||
|
||||
/**
|
||||
* Return true if this product type is saleable
|
||||
* Return true if this product type is saleable. Saleable check added because
|
||||
* this is the point where all parent product will recall this.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSaleable()
|
||||
{
|
||||
if (! $this->product->status) {
|
||||
return $this->checkInLoadedSaleableChecks($this->product, function ($product) {
|
||||
if (! $product->status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_callable(config('products.isSaleable')) &&
|
||||
call_user_func(config('products.isSaleable'), $product) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->haveSufficientQuantity(1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_callable(config('products.isSaleable')) &&
|
||||
call_user_func(config('products.isSaleable'), $this->product) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->haveSufficientQuantity(1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Webkul\Shop\Http\Middleware;
|
||||
|
||||
use Webkul\Core\Repositories\CurrencyRepository;
|
||||
use Closure;
|
||||
use Webkul\Core\Repositories\CurrencyRepository;
|
||||
|
||||
class Currency
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
@case('addToCartHtml')
|
||||
<div class="action">
|
||||
<div v-html="product.defaultAddToCart"></div>
|
||||
<div v-html="addToCartHtml"></div>
|
||||
|
||||
<span class="icon white-cross-sm-icon remove-product" @click="removeProductCompare(product.id)"></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@
|
|||
if (imageInput.files[0].type.includes('image/')) {
|
||||
var self = this;
|
||||
|
||||
if (imageInput.files[0].size <= 2000000) {
|
||||
if (imageInput.files[0].size <= 2000000) {
|
||||
self.$root.showLoader();
|
||||
|
||||
var formData = new FormData();
|
||||
|
|
@ -344,8 +344,8 @@
|
|||
];
|
||||
|
||||
self.$root.addFlashMessages();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
imageInput.value = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ class TaxRate extends Model implements TaxRateContract
|
|||
'identifier',
|
||||
'is_zip',
|
||||
'zip_code',
|
||||
'zip_code',
|
||||
'zip_from',
|
||||
'zip_to',
|
||||
'state',
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ use Webkul\Product\Models\Product as ProductModel;
|
|||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Product\Repositories\ProductFlatRepository;
|
||||
use Webkul\Velocity\Repositories\OrderBrandsRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||
use Webkul\Product\Repositories\ProductReviewRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||
use Webkul\Velocity\Repositories\VelocityMetadataRepository;
|
||||
|
||||
class Helper extends Review
|
||||
|
|
@ -174,49 +174,18 @@ class Helper extends Review
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the count rating of the product
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product $product
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCountRating($product)
|
||||
{
|
||||
$reviews = $product->reviews()
|
||||
->where('status', 'approved')
|
||||
->select('rating', DB::raw('count(*) as total'))
|
||||
->groupBy('rating')
|
||||
->orderBy('rating','desc')
|
||||
->get();
|
||||
|
||||
$totalReviews = $this->getTotalReviews($product);
|
||||
|
||||
for ($i = 5; $i >= 1; $i--) {
|
||||
if (! $reviews->isEmpty()) {
|
||||
foreach ($reviews as $review) {
|
||||
if ($review->rating == $i) {
|
||||
$percentage[$i] = $review->total;
|
||||
|
||||
break;
|
||||
} else {
|
||||
$percentage[$i]=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$percentage[$i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
return $percentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the count rating of the product
|
||||
* Returns the count rating of the product.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getVelocityMetaData($locale = null, $channel = null, $default = true)
|
||||
{
|
||||
static $metaData;
|
||||
|
||||
if ($metaData) {
|
||||
return $metaData;
|
||||
}
|
||||
|
||||
if (! $locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
}
|
||||
|
|
@ -309,12 +278,8 @@ class Helper extends Review
|
|||
{
|
||||
$reviewHelper = app('Webkul\Product\Helpers\Review');
|
||||
|
||||
$totalReviews = $reviewHelper->getTotalReviews($product);
|
||||
|
||||
$avgRatings = ceil($reviewHelper->getAverageRating($product));
|
||||
|
||||
$galleryImages = ProductImage::getGalleryImages($product);
|
||||
$productImage = ProductImage::getProductBaseImage($product)['medium_image_url'];
|
||||
$productImage = ProductImage::getProductBaseImage($product, $galleryImages)['medium_image_url'];
|
||||
|
||||
$largeProductImageName = "large-product-placeholder.png";
|
||||
$mediumProductImageName = "meduim-product-placeholder.png";
|
||||
|
|
@ -334,8 +299,8 @@ class Helper extends Review
|
|||
|
||||
return [
|
||||
'priceHTML' => $priceHTML,
|
||||
'avgRating' => $avgRatings,
|
||||
'totalReviews' => $totalReviews,
|
||||
'avgRating' => ceil($reviewHelper->getAverageRating($product)),
|
||||
'totalReviews' => $reviewHelper->getTotalReviews($product),
|
||||
'image' => $productImage,
|
||||
'new' => $isProductNew,
|
||||
'galleryImages' => $galleryImages,
|
||||
|
|
@ -344,7 +309,6 @@ class Helper extends Review
|
|||
'description' => $product->description,
|
||||
'shortDescription' => $product->short_description,
|
||||
'firstReviewText' => trans('velocity::app.products.be-first-review'),
|
||||
'defaultAddToCart' => view('shop::products.add-buttons', ['product' => $product])->render(),
|
||||
'addToCartHtml' => view('shop::products.add-to-cart', [
|
||||
'product' => $product,
|
||||
'addWishlistClass' => ! (isset($list) && $list) ? '' : '',
|
||||
|
|
@ -373,38 +337,26 @@ class Helper extends Review
|
|||
*/
|
||||
public function fetchProductCollection($items, $moveToCart = false, $separator='&')
|
||||
{
|
||||
$productCollection = [];
|
||||
$productIds = explode($separator, $items);
|
||||
$productIds = collect(explode($separator, $items));
|
||||
|
||||
foreach ($productIds as $productId) {
|
||||
// @TODO:- query only once insted of 2
|
||||
return $productIds->map(function ($productId) use ($moveToCart) {
|
||||
$productFlat = $this->productFlatRepository->findOneWhere(['id' => $productId]);
|
||||
|
||||
if ($productFlat) {
|
||||
$product = $this->productRepository->findOneWhere(['id' => $productFlat->product_id]);
|
||||
$formattedProduct = $this->formatProduct($productFlat, false, [
|
||||
'moveToCart' => $moveToCart,
|
||||
'btnText' => $moveToCart ? trans('shop::app.customer.account.wishlist.move-to-cart') : null,
|
||||
]);
|
||||
|
||||
if ($product) {
|
||||
$formattedProduct = $this->formatProduct($productFlat, false, [
|
||||
'moveToCart' => $moveToCart,
|
||||
'btnText' => $moveToCart ? trans('shop::app.customer.account.wishlist.move-to-cart') : null,
|
||||
]);
|
||||
|
||||
$productMetaDetails = [];
|
||||
$productMetaDetails['slug'] = $product->url_key;
|
||||
$productMetaDetails['product_image'] = $formattedProduct['image'];
|
||||
$productMetaDetails['priceHTML'] = $formattedProduct['priceHTML'];
|
||||
$productMetaDetails['new'] = $formattedProduct['new'];
|
||||
$productMetaDetails['addToCartHtml'] = $formattedProduct['addToCartHtml'];
|
||||
$productMetaDetails['galleryImages'] = $formattedProduct['galleryImages'];
|
||||
$productMetaDetails['defaultAddToCart'] = $formattedProduct['defaultAddToCart'];
|
||||
|
||||
$product = array_merge($productFlat->toArray(), $productMetaDetails);
|
||||
|
||||
array_push($productCollection, $product);
|
||||
}
|
||||
return array_merge($productFlat->toArray(), [
|
||||
'slug' => $productFlat->url_key,
|
||||
'product_image' => $formattedProduct['image'],
|
||||
'priceHTML' => $formattedProduct['priceHTML'],
|
||||
'new' => $formattedProduct['new'],
|
||||
'addToCartHtml' => $formattedProduct['addToCartHtml'],
|
||||
'galleryImages' => $formattedProduct['galleryImages']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $productCollection;
|
||||
})->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,26 +2,19 @@
|
|||
|
||||
namespace Webkul\Velocity\Http\Controllers\Shop;
|
||||
|
||||
use Webkul\Velocity\Helpers\Helper;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository as CustomerCompareProductRepository;
|
||||
|
||||
class ComparisonController extends Controller
|
||||
{
|
||||
/**
|
||||
* function for customers to get products in comparison.
|
||||
* Method for customers to get products in comparison.
|
||||
*
|
||||
* @return \Illuminate\Http\Response|\Illuminate\View\View
|
||||
*/
|
||||
public function getComparisonList()
|
||||
{
|
||||
if (! core()->getConfigData('general.content.shop.compare_option')) {
|
||||
|
||||
abort(404);
|
||||
} else {
|
||||
if (request()->get('data')) {
|
||||
$productSlugs = null;
|
||||
|
||||
$productCollection = [];
|
||||
|
||||
if (auth()->guard('customer')->user()) {
|
||||
|
|
@ -32,20 +25,17 @@ class ComparisonController extends Controller
|
|||
'product_flat.id'
|
||||
)
|
||||
->where('customer_id', auth()->guard('customer')->user()->id)
|
||||
->get()
|
||||
->toArray();
|
||||
->get();
|
||||
|
||||
$items = [];
|
||||
|
||||
foreach ($productCollection as $index => $customerCompare) {
|
||||
array_push($items, $customerCompare['id']);
|
||||
}
|
||||
|
||||
$items = implode('&', $items);
|
||||
$productCollection = $this->velocityHelper->fetchProductCollection($items);
|
||||
$items = $productCollection->map(function ($product) {
|
||||
return $product->id;
|
||||
})->join('&');
|
||||
|
||||
$productCollection = ! empty($items)
|
||||
? $this->velocityHelper->fetchProductCollection($items)
|
||||
: [];
|
||||
} else {
|
||||
// for product details
|
||||
/* for product details */
|
||||
if ($items = request()->get('items')) {
|
||||
$productCollection = $this->velocityHelper->fetchProductCollection($items);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ class ShopController extends Controller
|
|||
switch ($slug) {
|
||||
case 'new-products':
|
||||
case 'featured-products':
|
||||
$formattedProducts = [];
|
||||
$count = request()->get('count');
|
||||
|
||||
if ($slug == "new-products") {
|
||||
|
|
@ -75,19 +74,17 @@ class ShopController extends Controller
|
|||
$products = $this->velocityProductRepository->getFeaturedProducts($count);
|
||||
}
|
||||
|
||||
foreach ($products as $product) {
|
||||
if (core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
array_push($formattedProducts, $this->velocityHelper->formatProduct($product));
|
||||
} else {
|
||||
if ($product->isSaleable()) {
|
||||
array_push($formattedProducts, $this->velocityHelper->formatProduct($product));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$response = [
|
||||
'status' => true,
|
||||
'products' => $formattedProducts,
|
||||
'products' => $products->map(function ($product) {
|
||||
if (core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
return $this->velocityHelper->formatProduct($product);
|
||||
} else {
|
||||
if ($product->isSaleable()) {
|
||||
return $this->velocityHelper->formatProduct($product);
|
||||
}
|
||||
}
|
||||
}),
|
||||
];
|
||||
|
||||
break;
|
||||
|
|
@ -199,10 +196,25 @@ class ShopController extends Controller
|
|||
public function getItemsCount()
|
||||
{
|
||||
if ($customer = auth()->guard('customer')->user()) {
|
||||
$wishlistItemsCount = $this->wishlistRepository->count([
|
||||
'customer_id' => $customer->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
]);
|
||||
|
||||
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
$wishlistItemsCount = $this->wishlistRepository->getModel()
|
||||
->leftJoin('products as ps', 'wishlist.product_id', '=', 'ps.id')
|
||||
->leftJoin('product_inventories as pv', 'ps.id', '=', 'pv.product_id')
|
||||
->where(function ($qb) {
|
||||
$qb
|
||||
->WhereIn('ps.type', ['configurable', 'grouped', 'downloadable', 'bundle', 'booking'])
|
||||
->orwhereIn('ps.type', ['simple', 'virtual'])->where('pv.qty' , '>' , 0);
|
||||
})
|
||||
->where('wishlist.customer_id' , $customer->id)
|
||||
->where('wishlist.channel_id' , core()->getCurrentChannel()->id)
|
||||
->count('wishlist.id');
|
||||
} else {
|
||||
$wishlistItemsCount = $this->wishlistRepository->count([
|
||||
'customer_id' => $customer->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
]);
|
||||
}
|
||||
|
||||
$comparedItemsCount = $this->compareProductsRepository->count([
|
||||
'customer_id' => $customer->id,
|
||||
|
|
@ -244,26 +256,36 @@ class ShopController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will fetch products from category.
|
||||
*
|
||||
* @param int $categoryId
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCategoryProducts($categoryId)
|
||||
{
|
||||
$products = $this->productRepository->getAll($categoryId);
|
||||
/* fetch category details */
|
||||
$categoryDetails = $this->categoryRepository->find($categoryId);
|
||||
|
||||
$productItems = $products->items();
|
||||
$productsArray = $products->toArray();
|
||||
|
||||
if ($productItems) {
|
||||
$formattedProducts = [];
|
||||
|
||||
foreach ($productItems as $product) {
|
||||
array_push($formattedProducts, $this->velocityHelper->formatProduct($product));
|
||||
}
|
||||
|
||||
$productsArray['data'] = $formattedProducts;
|
||||
/* if category not found then return empty response */
|
||||
if (! $categoryDetails) {
|
||||
return response()->json([
|
||||
'products' => [],
|
||||
'paginationHTML' => ''
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json($response ?? [
|
||||
'products' => $productsArray,
|
||||
'paginationHTML' => $products->appends(request()->input())->links()->toHtml(),
|
||||
/* fetching products */
|
||||
$products = $this->productRepository->getAll($categoryId);
|
||||
$products->withPath($categoryDetails->slug);
|
||||
|
||||
/* sending response */
|
||||
return response()->json([
|
||||
'products' => collect($products->items())->map(function ($product) {
|
||||
return $this->velocityHelper->formatProduct($product);
|
||||
}),
|
||||
'paginationHTML' => $products->appends(request()->input())->links()->toHtml()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -116,6 +116,10 @@ class ProductRepository extends Repository
|
|||
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
|
||||
if (! core()->getConfigData('catalog.products.homepage.out_of_stock_items')) {
|
||||
$query = app('Webkul\Product\Repositories\ProductRepository')->checkOutOfStockItem($query);
|
||||
}
|
||||
|
||||
$query = $query->distinct()
|
||||
->addSelect('product_flat.*')
|
||||
->leftJoin('products', 'product_flat.product_id', '=', 'products.id')
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@
|
|||
'products_and_description'
|
||||
]
|
||||
);
|
||||
|
||||
$products = $productRepository->getAll($category->id);
|
||||
@endphp
|
||||
|
||||
@section('content-wrapper')
|
||||
|
|
@ -126,9 +124,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.shop.productOrCategory.index.pagination.before', ['category' => $category]) !!}
|
||||
|
||||
<div class="bottom-toolbar">
|
||||
{{ $products->appends(request()->input())->links() }}
|
||||
</div>
|
||||
<div class="bottom-toolbar" v-html="paginationHTML"></div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.productOrCategory.index.pagination.after', ['category' => $category]) !!}
|
||||
</template>
|
||||
|
|
@ -166,7 +162,7 @@
|
|||
this.$http.get(`${this.$root.baseUrl}/category-products/{{ $category->id }}${window.location.search}`)
|
||||
.then(response => {
|
||||
this.isLoading = false;
|
||||
this.products = response.data.products.data;
|
||||
this.products = response.data.products;
|
||||
this.paginationHTML = response.data.paginationHTML;
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
</script>
|
||||
@endif
|
||||
|
||||
<?php $productBaseImage = productimage()->getProductBaseImage($product); ?>
|
||||
<?php $productBaseImage = productimage()->getProductBaseImage($product, $images); ?>
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
@inject ('customHelper', 'Webkul\Velocity\Helpers\Helper')
|
||||
|
||||
@php
|
||||
$reviews = $reviewHelper->getReviews($product)->paginate(10);
|
||||
|
||||
if (! isset($total)) {
|
||||
$total = $reviewHelper->getTotalReviews($product);
|
||||
|
||||
$avgRatings = $reviewHelper->getAverageRating($product);
|
||||
$avgStarRating = round($avgRatings);
|
||||
}
|
||||
|
||||
$percentageRatings = $reviewHelper->getPercentageRating($product);
|
||||
$countRatings = $customHelper->getCountRating($product);
|
||||
@endphp
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.review.before', ['product' => $product]) !!}
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
</div>
|
||||
|
||||
<div class="customer-reviews" slot="body">
|
||||
@foreach ($reviewHelper->getReviews($product)->paginate(10) as $review)
|
||||
@foreach ($reviews as $review)
|
||||
<div class="row">
|
||||
<h4 class="col-lg-12 fs18">{{ $review->title }}</h4>
|
||||
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
</h3>
|
||||
|
||||
<div class="customer-reviews">
|
||||
@foreach ($reviewHelper->getReviews($product)->paginate(10) as $review)
|
||||
@foreach ($reviews as $review)
|
||||
<div class="row">
|
||||
<h4 class="col-lg-12 fs18">{{ $review->title }}</h4>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
*
|
||||
!.gitignore
|
||||
Loading…
Reference in New Issue