Merge branch 'master' into issue-4242

This commit is contained in:
devansh bawari 2020-12-04 20:29:07 +05:30
commit e49908b314
38 changed files with 124 additions and 66 deletions

View File

@ -2,9 +2,9 @@
namespace Webkul\API\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -218,6 +218,10 @@ return [
],
],
'channel_based' => true,
], [
'name' => 'buy_now_button_display',
'title' => 'admin::app.admin.system.buy-now-button-display',
'type' => 'boolean',
]
],
], [

View File

@ -2,9 +2,9 @@
namespace Webkul\Admin\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -1381,7 +1381,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1356,7 +1356,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
],
],
];

View File

@ -1381,7 +1381,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1337,7 +1337,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1373,7 +1373,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1378,7 +1378,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1373,7 +1373,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1362,7 +1362,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1376,7 +1376,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1359,7 +1359,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -69,8 +69,8 @@ class ChannelController extends Controller
'currencies' => 'required|array|min:1',
'base_currency_id' => 'required|in_array:currencies.*',
'root_category_id' => 'required',
'logo.*' => 'mimes:bmp,jpeg,jpg,png,webp',
'favicon.*' => 'mimes:bmp,jpeg,jpg,png,webp',
'logo.*' => 'nullable|mimes:bmp,jpeg,jpg,png,webp',
'favicon.*' => 'nullable|mimes:bmp,jpeg,jpg,png,webp',
'seo_title' => 'required|string',
'seo_description' => 'required|string',
'seo_keywords' => 'required|string',
@ -133,8 +133,8 @@ class ChannelController extends Controller
'currencies' => 'required|array|min:1',
'base_currency_id' => 'required|in_array:currencies.*',
'root_category_id' => 'required',
'logo.*' => 'mimes:bmp,jpeg,jpg,png,webp',
'favicon.*' => 'mimes:bmp,jpeg,jpg,png,webp',
'logo.*' => 'nullable|mimes:bmp,jpeg,jpg,png,webp',
'favicon.*' => 'nullable|mimes:bmp,jpeg,jpg,png,webp',
'hostname' => 'unique:channels,hostname,' . $id,
'is_maintenance_on' => 'boolean'
]);

View File

@ -271,8 +271,8 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R
public function getAssets()
{
return [
'base_path' => '/home/jitendra/www/html/laravel/bagisto/packages/Webkul/DebugBar/src/Resources/',
'base_url' => '/home/jitendra/www/html/laravel/bagisto/packages/Webkul/DebugBar/src/Resources/',
'base_path' => __DIR__ . '/../Resources/',
'base_url' => __DIR__ . '/../Resources/',
'css' => 'widgets/modules/widget.css',
'js' => 'widgets/modules/widget.js'
];

View File

@ -2,9 +2,9 @@
namespace Webkul\Payment\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -2,9 +2,9 @@
namespace Webkul\Paypal\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -94,7 +94,7 @@ class Toolbar extends AbstractProduct
} elseif (! isset($params['sort'])) {
$sortBy = core()->getConfigData('catalog.products.storefront.sort_by')
? core()->getConfigData('catalog.products.storefront.sort_by')
: 'created_at-asc';
: 'name-desc';
if ($key == $sortBy) {
return true;

View File

@ -102,11 +102,9 @@ class ProductFlatRepository extends Repository
foreach ($products as $key => $product) {
foreach ($filterAttributes as $attribute) {
if ($attribute->code <> 'price') {
if (isset($product[$attribute->code])) {
if (! in_array($product[$attribute->code], $allProductAttributeOptionsCode)) {
array_push($allProductAttributeOptionsCode, $product[$attribute->code]);
}
if ($attribute->code <> 'price' && isset($product[$attribute->code])) {
if (! in_array($product[$attribute->code], $allProductAttributeOptionsCode)) {
array_push($allProductAttributeOptionsCode, $product[$attribute->code]);
}
}
}

View File

@ -570,8 +570,11 @@ class ProductRepository extends Repository
if ($attribute->code === 'price') {
$query->orderBy('min_price', $direction);
} else {
$query->orderBy($sort === 'created_at' ? 'product_flat.created_at' : $attribute->code, $direction);
$query->orderBy($attribute->code, $direction);
}
} else {
/* `created_at` is not an attribute so it will be in else case */
$query->orderBy('product_flat.created_at', $direction);
}
return $query;
@ -773,14 +776,14 @@ class ProductRepository extends Repository
]);
}
}
/**
* @object $data
* @object $copiedProduct
* @object $copiedProductImageVideo
*/
private function copyProductImageVideo($data, $copiedProduct, $copiedProductImageVideo): void
{
{
$path = explode("/", $data->path);
$path = 'product/' . $copiedProduct->id .'/'. end($path);

View File

@ -2,9 +2,9 @@
namespace Webkul\Rule\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -2,9 +2,9 @@
namespace Webkul\Shipping\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -350,4 +350,21 @@ class OnepageController extends Controller
], 422);
}
}
/**
* Check for minimum order.
*
* @return \Illuminate\Http\Response
*/
public function checkMinimumOrder()
{
$minimumOrderAmount = (float) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
$status = Cart::checkMinimumOrder();
return response()->json([
'status' => ! $status ? false : true,
'message' => ! $status ? trans('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) : 'Success',
]);
}
}

View File

@ -76,6 +76,9 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
//Checkout Save Payment Method Form
Route::post('/checkout/save-payment', 'Webkul\Shop\Http\Controllers\OnepageController@savePayment')->name('shop.checkout.save-payment');
/* check minimum order */
Route::post('/checkout/check-minimum-order', 'Webkul\Shop\Http\Controllers\OnepageController@checkMinimumOrder')->name('shop.checkout.check-minimum-order');
//Checkout Save Order
Route::post('/checkout/save-order', 'Webkul\Shop\Http\Controllers\OnepageController@saveOrder')->name('shop.checkout.save-order');

View File

@ -2,9 +2,9 @@
namespace Webkul\Shop\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -388,14 +388,14 @@ return [
],
'products' => [
'layered-nav-title' => 'Einkaufen bei',
'layered-nav-title' => 'Filtern nach',
'price-label' => 'Angebotspreis von',
'remove-filter-link-title' => 'Alles löschen',
'filter-to' => 'bis',
'sort-by' => 'Sortieren',
'from-a-z' => 'Von A-Z',
'from-z-a' => 'Von Z-A',
'newest-first' => 'Neuste zuerst',
'newest-first' => 'Neueste zuerst',
'oldest-first' => 'Älteste zuerst',
'cheapest-first' => 'Günstigste zuerst',
'expensive-first' => 'Teuerste zuerst',
@ -522,7 +522,7 @@ return [
'shipping-method' => 'Versandart wählen',
'payment-methods' => 'Zahlungsmethode wählen',
'payment-method' => 'Zahlungsmethode',
'summary' => 'Bestellübersichty',
'summary' => 'Bestellübersicht',
'price' => 'Preis',
'quantity' => 'Menge',
'billing-address' => 'Rechnungsadresse',

View File

@ -1,6 +1,11 @@
{!! view_render_event('bagisto.shop.products.add_to_cart.before', ['product' => $product]) !!}
<button type="submit" class="btn btn-lg btn-primary addtocart" {{ ! $product->isSaleable() ? 'disabled' : '' }}>
@php
$width = (core()->getConfigData('catalog.products.storefront.buy_now_button_display') == 1) ? '49' : '95';
@endphp
<button type="submit" class="btn btn-lg btn-primary addtocart" {{ ! $product->isSaleable() ? 'disabled' : '' }}
style="width: <?php echo $width.'%';?>;">
{{ ($product->type == 'booking') ? __('shop::app.products.book-now') : __('shop::app.products.add-to-cart') }}
</button>

View File

@ -3,7 +3,9 @@
<div class="add-to-buttons">
@include ('shop::products.add-to-cart', ['product' => $product])
@include ('shop::products.buy-now')
@if (core()->getConfigData('catalog.products.storefront.buy_now_button_display'))
@include ('shop::products.buy-now')
@endif
</div>
{!! view_render_event('bagisto.shop.products.view.product-add.after', ['product' => $product]) !!}

View File

@ -2,9 +2,9 @@
namespace Webkul\Theme\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

View File

@ -2,9 +2,9 @@
namespace Webkul\Ui\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/velocity.js": "/js/velocity.js?id=64eee9a349d40f22629e",
"/js/velocity.js": "/js/velocity.js?id=45f7f05ff7e9c16e73e5",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
"/css/velocity.css": "/css/velocity.css?id=e41e400c39a3cb5bc551"
"/css/velocity.css": "/css/velocity.css?id=735a971d8d35f29b420a"
}

View File

@ -7,7 +7,6 @@
v-if="cartItems.length > 0"
class="modal-content sensitive-modal cart-modal-content hide">
<!--Body-->
<div class="mini-cart-container">
<div class="row small-card-container" :key="index" v-for="(item, index) in cartItems">
<div class="col-3 product-image-container mr15">
@ -40,7 +39,6 @@
</div>
</div>
<!--Footer-->
<div class="modal-footer">
<h2 class="col-6 text-left fw6">
{{ subtotalText }}
@ -74,8 +72,7 @@
'checkoutUrl',
'checkoutText',
'subtotalText',
'isMinimumOrderCompleted',
'minimumOrderMessage'
'checkMinimumOrderUrl'
],
data: function () {
@ -123,10 +120,16 @@
},
checkMinimumOrder: function (e) {
if (! Boolean(this.isMinimumOrderCompleted)) {
e.preventDefault();
window.showAlert(`alert-warning`, 'Warning', this.minimumOrderMessage);
}
e.preventDefault();
this.$http.post(this.checkMinimumOrderUrl)
.then(({ data }) => {
if (! data.status) {
window.showAlert(`alert-warning`, 'Warning', data.message);
} else {
window.location.href = this.checkoutUrl;
}
});
}
}
}

View File

@ -349,6 +349,11 @@ body {
> h2, div {
padding-right: 0px;
}
.buynow {
float: left;
margin-right: 10px;
}
}
}

View File

@ -1,15 +1,10 @@
<div class="mini-cart-container pull-right">
@php
$minimumOrderAmount = (int) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
@endphp
<mini-cart
view-cart="{{ route('shop.checkout.cart.index') }}"
cart-text="{{ __('shop::app.minicart.view-cart') }}"
checkout-text="{{ __('shop::app.minicart.checkout') }}"
checkout-url="{{ route('shop.checkout.onepage.index') }}"
subtotal-text="{{ __('shop::app.checkout.cart.cart-subtotal') }}"
is-minimum-order-completed="{{ (bool) Cart::checkMinimumOrder() }}"
minimum-order-message="{{ __('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) }}">
check-minimum-order-url="{{ route('shop.checkout.check-minimum-order') }}">
</mini-cart>
</div>

View File

@ -0,0 +1,7 @@
{!! view_render_event('bagisto.shop.products.buy_now.before', ['product' => $product]) !!}
<button type="submit" class="theme-btn text-center buynow" {{ ! $product->isSaleable(1) ? 'disabled' : '' }}>
{{ __('shop::app.products.buy-now') }}
</button>
{!! view_render_event('bagisto.shop.products.buy_now.after', ['product' => $product]) !!}

View File

@ -124,6 +124,12 @@
</div>
<div class="product-actions">
@if (core()->getConfigData('catalog.products.storefront.buy_now_button_display'))
@include ('shop::products.buy-now', [
'product' => $product,
])
@endif
@include ('shop::products.add-to-cart', [
'form' => false,
'product' => $product,