Merge branch 'master' of https://github.com/bagisto/bagisto into rahul
This commit is contained in:
commit
399ba55982
|
|
@ -323,6 +323,14 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.locales.index'
|
||||
])->name('admin.locales.store');
|
||||
|
||||
Route::get('/locales/edit/{id}', 'Webkul\Core\Http\Controllers\LocaleController@edit')->defaults('_config', [
|
||||
'view' => 'admin::settings.locales.edit'
|
||||
])->name('admin.locales.edit');
|
||||
|
||||
Route::put('/locales/edit/{id}', 'Webkul\Core\Http\Controllers\LocaleController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.locales.index'
|
||||
])->name('admin.locales.update');
|
||||
|
||||
Route::get('/locales/delete/{id}', 'Webkul\Core\Http\Controllers\LocaleController@destroy')->name('admin.locales.delete');
|
||||
|
||||
|
||||
|
|
@ -339,6 +347,14 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.currencies.index'
|
||||
])->name('admin.currencies.store');
|
||||
|
||||
Route::get('/currencies/edit/{id}', 'Webkul\Core\Http\Controllers\CurrencyController@edit')->defaults('_config', [
|
||||
'view' => 'admin::settings.currencies.edit'
|
||||
])->name('admin.currencies.edit');
|
||||
|
||||
Route::put('/currencies/edit/{id}', 'Webkul\Core\Http\Controllers\CurrencyController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.currencies.index'
|
||||
])->name('admin.currencies.update');
|
||||
|
||||
Route::get('/currencies/delete/{id}', 'Webkul\Core\Http\Controllers\CurrencyController@destroy')->name('admin.currencies.delete');
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -312,8 +312,8 @@ return [
|
|||
'settings' => [
|
||||
'locales' => [
|
||||
'title' => 'Locales',
|
||||
'add-locale-title' => 'Add Locale',
|
||||
'edit-locale-title' => 'Edit Locale',
|
||||
'add-title' => 'Add Locale',
|
||||
'edit-title' => 'Edit Locale',
|
||||
'add-title' => 'Add Locale',
|
||||
'save-btn-title' => 'Save Locale',
|
||||
'general' => 'General',
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('slug') ? 'has-error' : '']">
|
||||
<label for="slug" class="required">{{ __('admin::app.catalog.categories.slug') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="slug" name="slug" value="{{ old('slug') }}"/>
|
||||
<input type="text" v-validate="'required'" class="control" id="slug" name="slug" value="{{ old('slug') }}" v-slugify/>
|
||||
<span class="control-error" v-if="errors.has('slug')">@{{ errors.first('slug') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[slug]') ? 'has-error' : '']">
|
||||
<label for="slug" class="required">{{ __('admin::app.catalog.categories.slug') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="slug" name="{{$locale}}[slug]" value="{{ old($locale)['slug'] ?: $category->translate($locale)['slug'] }}"/>
|
||||
<input type="text" v-validate="'required'" class="control" id="slug" name="{{$locale}}[slug]" value="{{ old($locale)['slug'] ?: $category->translate($locale)['slug'] }}" v-slugify/>
|
||||
<span class="control-error" v-if="errors.has('{{$locale}}[slug]')">@{{ errors.first('{!!$locale!!}[slug]') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
{{ $attribute->admin_name }}
|
||||
|
||||
@if ($attribute->type == 'price')
|
||||
<span class="currency-code">({{ core()->getBaseCurrencySymbol() }})</span>
|
||||
<span class="currency-code">({{ currency()->symbol(core()->getBaseCurrencyCode()) }})</span>
|
||||
@endif
|
||||
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -37,12 +37,6 @@
|
|||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('symbol') ? 'has-error' : '']">
|
||||
<label for="symbol" class="required">{{ __('admin::app.settings.currencies.symbol') }}</label>
|
||||
<input v-validate="'required'" class="control" id="symbol" name="symbol" value="{{ old('symbol') }}"/>
|
||||
<span class="control-error" v-if="errors.has('symbol')">@{{ errors.first('symbol') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.currencies.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.currencies.update', $currency->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.currencies.edit-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.currencies.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.currencies.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.currencies.code') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ $currency->code }}" disabled="disabled"/>
|
||||
<input type="hidden" name="code" value="{{ $currency->code }}"/>
|
||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.settings.currencies.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $currency->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -61,9 +61,9 @@
|
|||
</td>
|
||||
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has('ratio') ? 'has-error' : '']">
|
||||
<input v-validate="'required'" class="control" id="ratio" name="ratio" value="{{ old('ratio') ?: $exchangeRate->ratio }}"/>
|
||||
<span class="control-error" v-if="errors.has('ratio')">@{{ errors.first('ratio') }}</span>
|
||||
<div class="control-group" :class="[errors.has('rate') ? 'has-error' : '']">
|
||||
<input v-validate="'required'" class="control" id="rate" name="rate" value="{{ old('rate') ?: $exchangeRate->rate }}"/>
|
||||
<span class="control-error" v-if="errors.has('rate')">@{{ errors.first('rate') }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.locales.add-locale-title') }}
|
||||
{{ __('admin::app.settings.locales.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.locales.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.locales.update', $locale->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.locales.edit-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.locales.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.locales.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.locales.code') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ $locale->code }}" disabled="disabled"/>
|
||||
<input type="hidden" name="code" value="{{ $locale->code }}"/>
|
||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.settings.locales.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $locale->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -161,7 +161,6 @@ class Cart {
|
|||
*/
|
||||
public function add($id, $data)
|
||||
{
|
||||
|
||||
$itemData = $this->prepareItemData($id, $data);
|
||||
|
||||
if(!$itemData) {
|
||||
|
|
@ -196,8 +195,6 @@ class Cart {
|
|||
'base_total' => $cartItem->price * ($prevQty + $newQty)
|
||||
]);
|
||||
|
||||
$this->collectTotals();
|
||||
|
||||
session()->flash('success', trans('shop::app.checkout.cart.quantity.success'));
|
||||
|
||||
return true;
|
||||
|
|
@ -248,8 +245,6 @@ class Cart {
|
|||
$parent = $cart->items()->create($itemData['parent']);
|
||||
}
|
||||
|
||||
$this->collectTotals();
|
||||
|
||||
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
|
||||
|
||||
return $cart;
|
||||
|
|
@ -323,8 +318,6 @@ class Cart {
|
|||
|
||||
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
|
||||
|
||||
$this->collectTotals();
|
||||
|
||||
return $cart;
|
||||
}
|
||||
}
|
||||
|
|
@ -334,8 +327,6 @@ class Cart {
|
|||
|
||||
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
|
||||
|
||||
$this->collectTotals();
|
||||
|
||||
return $cart;
|
||||
}
|
||||
}
|
||||
|
|
@ -493,8 +484,6 @@ class Cart {
|
|||
}
|
||||
|
||||
$item->update(['quantity' => $quantity]);
|
||||
|
||||
$this->collectTotals();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -515,8 +504,6 @@ class Cart {
|
|||
if($cart = $this->getCart()) {
|
||||
$this->cartItem->delete($itemId);
|
||||
|
||||
$this->collectTotals();
|
||||
|
||||
//delete the cart instance if no items are there
|
||||
if($cart->items()->get()->count() == 0) {
|
||||
$this->cart->delete($cart->id);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class Code implements Rule
|
|||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return preg_match('/^[a-z]+[a-z0-9_]+$/', $value);
|
||||
return preg_match('/^[a-zA-Z]+[a-zA-Z0-9_]+$/', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -237,21 +237,6 @@ class Core
|
|||
return ($currency = $this->getBaseCurrency()) ? $currencyCode = $currency->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseCurrencySymbol()
|
||||
{
|
||||
static $currencySymbol;
|
||||
|
||||
if($currencySymbol)
|
||||
return $currencySymbol;
|
||||
|
||||
return $currencySymbol = $this->getBaseCurrency()->symbol ?? $this->getBaseCurrencyCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency model
|
||||
*
|
||||
|
|
@ -284,21 +269,6 @@ class Core
|
|||
return ($currency = $this->getChannelBaseCurrency()) ? $currencyCode = $currency->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns base channel's currency symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChannelBaseCurrencySymbol()
|
||||
{
|
||||
static $currencySymbol;
|
||||
|
||||
if($currencySymbol)
|
||||
return $currencySymbol;
|
||||
|
||||
return $currencySymbol = $this->getChannelBaseCurrency()->symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency model
|
||||
*
|
||||
|
|
@ -311,7 +281,12 @@ class Core
|
|||
if($currency)
|
||||
return $currency;
|
||||
|
||||
return $currency = $this->currencyRepository->first();
|
||||
if($currencyCode = session()->get('currency')) {
|
||||
if($currency = $this->currencyRepository->findOneByField('code', $currencyCode))
|
||||
return $currency;
|
||||
}
|
||||
|
||||
return $currency = $this->getChannelBaseCurrency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -329,21 +304,6 @@ class Core
|
|||
return ($currency = $this->getCurrentCurrency()) ? $currencyCode = $currency->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentCurrencySymbol()
|
||||
{
|
||||
static $currencySymbol;
|
||||
|
||||
if($currencySymbol)
|
||||
return $currencySymbol;
|
||||
|
||||
return $currencySymbol = $this->getCurrentCurrency()->symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts price
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ class CreateCurrenciesTable extends Migration
|
|||
Schema::create('currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('symbol');
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CreateCurrencyExchangeRatesTable extends Migration
|
|||
$table->increments('id');
|
||||
$table->decimal('rate', 10, 5);
|
||||
|
||||
$table->integer('target_currency')->unsigned();
|
||||
$table->integer('target_currency')->unique()->unsigned();
|
||||
$table->foreign('target_currency')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ class CurrencyController extends Controller
|
|||
{
|
||||
$this->validate(request(), [
|
||||
'code' => 'required|unique:countries,code',
|
||||
'name' => 'required',
|
||||
'symbol' => 'required'
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$this->currency->create(request()->all());
|
||||
|
|
@ -84,6 +83,40 @@ class CurrencyController extends Controller
|
|||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$currency = $this->currency->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('currency'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:currencies,code,' . $id, new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$this->currency->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Currency updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class ExchangeRateController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'target_currency' => 'required',
|
||||
'target_currency' => ['required', 'unique:currency_exchange_rates,target_currency'],
|
||||
'rate' => 'required|numeric'
|
||||
]);
|
||||
|
||||
|
|
@ -121,8 +121,8 @@ class ExchangeRateController extends Controller
|
|||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'target_currency' => 'required',
|
||||
'ratio' => 'required|numeric'
|
||||
'target_currency' => ['required', 'unique:currency_exchange_rates,target_currency,' . $id],
|
||||
'rate' => 'required|numeric'
|
||||
]);
|
||||
|
||||
$this->exchangeRate->update(request()->all(), $id);
|
||||
|
|
|
|||
|
|
@ -83,6 +83,40 @@ class LocaleController extends Controller
|
|||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$locale = $this->locale->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('locale'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:locales,code,' . $id, new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$this->locale->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', 'Locale updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ class Currency extends Model
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code', 'name', 'symbol'
|
||||
'code', 'name'
|
||||
];
|
||||
}
|
||||
|
|
@ -88,9 +88,11 @@ class CartController extends Controller
|
|||
|
||||
public function add($id) {
|
||||
$data = request()->input();
|
||||
// dd($data);
|
||||
|
||||
Cart::add($id, $data);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
@ -102,6 +104,8 @@ class CartController extends Controller
|
|||
public function remove($itemId) {
|
||||
Cart::removeItem($itemId);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
@ -123,6 +127,8 @@ class CartController extends Controller
|
|||
|
||||
Cart::update($data);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Shop\Http\Middleware;
|
||||
|
||||
use Webkul\Core\Repositories\CurrencyRepository;
|
||||
use Closure;
|
||||
|
||||
class Currency
|
||||
{
|
||||
/**
|
||||
* @var CurrencyRepository
|
||||
*/
|
||||
protected $currency;
|
||||
|
||||
/**
|
||||
* @param \Webkul\Core\Repositories\CurrencyRepository $locale
|
||||
*/
|
||||
public function __construct(CurrencyRepository $currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if($currency = $request->get('currency')) {
|
||||
if($this->currency->findOneByField('code', $currency)) {
|
||||
session()->put('currency', $currency);
|
||||
}
|
||||
} else {
|
||||
if(!session()->get('currency')) {
|
||||
session()->put('currency', core()->getChannelBaseCurrencyCode());
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web', 'theme', 'locale']], function () {
|
||||
Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function () {
|
||||
|
||||
Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [
|
||||
'view' => 'shop::home.index'
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Illuminate\Routing\Router;
|
|||
use Illuminate\Support\Facades\Blade;
|
||||
use Webkul\Shop\Http\Middleware\Locale;
|
||||
use Webkul\Shop\Http\Middleware\Theme;
|
||||
use Webkul\Shop\Http\Middleware\Currency;
|
||||
use Webkul\Shop\Providers\ComposerServiceProvider;
|
||||
use Webkul\Ui\Menu;
|
||||
|
||||
|
|
@ -31,8 +32,8 @@ class ShopServiceProvider extends ServiceProvider
|
|||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'shop');
|
||||
|
||||
$router->aliasMiddleware('locale', Locale::class);
|
||||
|
||||
$router->aliasMiddleware('theme', Theme::class);
|
||||
$router->aliasMiddleware('currency', Currency::class);
|
||||
|
||||
$this->app->register(ComposerServiceProvider::class);
|
||||
|
||||
|
|
|
|||
|
|
@ -382,6 +382,21 @@ section.slider-block {
|
|||
align-items: center;
|
||||
// cursor: pointer;
|
||||
|
||||
.currency-switcher {
|
||||
float: right;
|
||||
border-right: 2px solid $border-color;
|
||||
cursor: pointer;
|
||||
|
||||
.dropdown-list {
|
||||
width: 100px;
|
||||
top: 37px;
|
||||
|
||||
.dropdown-container {
|
||||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul.account-dropdown-container {
|
||||
float: right;
|
||||
border-right: 2px solid $border-color;
|
||||
|
|
@ -390,6 +405,7 @@ section.slider-block {
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-right: 14px;
|
||||
margin-left: 14px;
|
||||
|
||||
.dropdown-list {
|
||||
width: 300px;
|
||||
|
|
@ -613,21 +629,6 @@ section.slider-block {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.nav > li:last-child {
|
||||
display:flex; align-items:center;
|
||||
border-radius: 0 0 4px 0;
|
||||
float:right;
|
||||
display: none;
|
||||
|
||||
img {
|
||||
margin-right:6px;
|
||||
}
|
||||
}
|
||||
|
||||
.nav > li:last-child > a {
|
||||
border-radius: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.nav li li a {
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,8 @@ return [
|
|||
'success_remove' => 'Item removed successfully',
|
||||
'error_add' => 'Item cannot be added to cart',
|
||||
],
|
||||
'quantity-error' => 'Requested quantity is not available.'
|
||||
'quantity-error' => 'Requested quantity is not available.',
|
||||
'cart-subtotal' => 'Cart Subtotal'
|
||||
],
|
||||
|
||||
'onepage' => [
|
||||
|
|
|
|||
|
|
@ -28,26 +28,30 @@
|
|||
@foreach($cart->items as $item)
|
||||
|
||||
<?php
|
||||
$product = $item->product;
|
||||
$productBaseImage = $productImageHelper->getProductBaseImage($product);
|
||||
if($item->type == "configurable")
|
||||
$productBaseImage = $productImageHelper->getProductBaseImage($item->child->product);
|
||||
else
|
||||
$productBaseImage = $productImageHelper->getProductBaseImage($item->product);
|
||||
?>
|
||||
|
||||
<div class="item">
|
||||
<div style="margin-right: 15px;">
|
||||
<a href="{{ url()->to('/').'/products/'.$product->url_key }}"><img class="item-image" src="{{ $productBaseImage['medium_image_url'] }}" /></a>
|
||||
<a href="{{ url()->to('/').'/products/'.$item->product->url_key }}"><img class="item-image" src="{{ $productBaseImage['medium_image_url'] }}" /></a>
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
|
||||
<div class="item-title">
|
||||
<a href="{{ url()->to('/').'/products/'.$product->url_key }}">{{ $product->name }}</a>
|
||||
<a href="{{ url()->to('/').'/products/'.$item->product->url_key }}">
|
||||
{{ $item->product->name }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="price">
|
||||
{{ core()->currency($item->base_price) }}
|
||||
</div>
|
||||
|
||||
@if ($product->type == 'configurable')
|
||||
@if ($item->type == 'configurable')
|
||||
|
||||
<div class="summary">
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
|
||||
|
||||
<?php $cart = cart()->getCart(); ?>
|
||||
|
||||
@if($cart)
|
||||
<?php $items = $cart->items; ?>
|
||||
|
||||
<div class="dropdown-toggle">
|
||||
<div style="display: inline-block; cursor: pointer;">
|
||||
<span class="name">
|
||||
Cart
|
||||
<span class="count"> ({{ intval($cart->items_qty) }})</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<i class="icon arrow-down-icon active"></i>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-list" style="display: none; top: 50px; right: 0px">
|
||||
<div class="dropdown-container">
|
||||
<div class="dropdown-cart">
|
||||
<div class="dropdown-header">
|
||||
<p class="heading">
|
||||
{{ __('shop::app.checkout.cart.cart-subtotal') }} -
|
||||
{{ core()->currency($cart->sub_total) }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-content">
|
||||
@foreach($items as $item)
|
||||
@if($item->type == "configurable")
|
||||
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
$images = $productImageHelper->getProductBaseImage($item->child->product);
|
||||
@endphp
|
||||
<img src="{{ $images['small_image_url'] }}" />
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
|
||||
<div class="item-name">{{ $item->child->name }}</div>
|
||||
|
||||
<div class="item-price">{{ core()->currency($item->total) }}</div>
|
||||
|
||||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
$images = $productImageHelper->getProductBaseImage($item->product);
|
||||
@endphp
|
||||
<img src="{{ $images['small_image_url'] }}" />
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
|
||||
<div class="item-name">{{ $item->name }}</div>
|
||||
|
||||
<div class="item-price">{{ $item->total }}</div>
|
||||
|
||||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="dropdown-footer">
|
||||
<a href="{{ route('shop.checkout.cart.index') }}">View Shopping Cart</a>
|
||||
|
||||
<a class="btn btn-primary btn-lg" style="color: white;" href="{{ route('shop.checkout.onepage.index') }}">CHECKOUT</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
<div class="dropdown-toggle">
|
||||
<div style="display: inline-block; cursor: pointer;">
|
||||
|
||||
<span class="name">Cart<span class="count"> (0) </span></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
|
@ -3,11 +3,7 @@
|
|||
|
||||
<div class="item-detail">
|
||||
<label>
|
||||
@if($cart->items_qty - intval($cart->items_qty) > 0)
|
||||
{{ $cart->items_qty }}
|
||||
@else
|
||||
{{ intval($cart->items_qty) }}
|
||||
@endif
|
||||
{{ intval($cart->items_qty) }}
|
||||
{{ __('shop::app.checkout.total.sub-total') }}
|
||||
{{ __('shop::app.checkout.total.price') }}
|
||||
</label>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,27 @@
|
|||
</div>
|
||||
|
||||
<div class="right-content">
|
||||
@if (core()->getCurrentChannel()->currencies->count() > 1)
|
||||
<div class="currency-switcher">
|
||||
<div class="dropdown-toggle">
|
||||
USD
|
||||
<i class="icon arrow-down-icon active"></i>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-list bottom-right">
|
||||
<div class="dropdown-container">
|
||||
<ul>
|
||||
@foreach (core()->getCurrentChannel()->currencies as $currency)
|
||||
<li>
|
||||
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<ul class="account-dropdown-container">
|
||||
<li class="account-dropdown">
|
||||
<div class="dropdown-toggle">
|
||||
|
|
@ -79,108 +100,13 @@
|
|||
|
||||
<ul class="cart-dropdown-container">
|
||||
|
||||
<?php $cart = cart()->getCart(); ?>
|
||||
|
||||
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
|
||||
|
||||
<li class="cart-dropdown">
|
||||
<span class="icon cart-icon"></span>
|
||||
@if($cart)
|
||||
<?php $items = $cart->items; ?>
|
||||
|
||||
<div class="dropdown-toggle">
|
||||
<div style="display: inline-block; cursor: pointer;">
|
||||
@if($cart->items_qty - intval($cart->items_qty) > 0)
|
||||
|
||||
<span class="name">
|
||||
Cart
|
||||
<span class="count"> ({{ $cart->items_qty }})</span>
|
||||
</span>
|
||||
|
||||
@else
|
||||
|
||||
<span class="name">
|
||||
Cart
|
||||
<span class="count"> ({{ intval($cart->items_qty) }})</span>
|
||||
</span>
|
||||
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<i class="icon arrow-down-icon active"></i>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-list" style="display: none; top: 50px; right: 0px">
|
||||
<div class="dropdown-container">
|
||||
<div class="dropdown-cart">
|
||||
<div class="dropdown-header">
|
||||
<p class="heading">Cart Subtotal - {{ $cart->sub_total }}</p>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-content">
|
||||
@foreach($items as $item)
|
||||
@if($item->type == "configurable")
|
||||
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
$images = $productImageHelper->getProductBaseImage($item->child->product);
|
||||
@endphp
|
||||
<img src="{{ $images['small_image_url'] }}" />
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
|
||||
<div class="item-name">{{ $item->child->name }}</div>
|
||||
|
||||
<div class="item-price">{{ $item->total }}</div>
|
||||
|
||||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
<div class="item">
|
||||
<div class="item-image" >
|
||||
@php
|
||||
$images = $productImageHelper->getProductBaseImage($item->product);
|
||||
@endphp
|
||||
<img src="{{ $images['small_image_url'] }}" />
|
||||
</div>
|
||||
|
||||
<div class="item-details">
|
||||
|
||||
<div class="item-name">{{ $item->name }}</div>
|
||||
|
||||
<div class="item-price">{{ $item->total }}</div>
|
||||
|
||||
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="dropdown-footer">
|
||||
<a href="{{ route('shop.checkout.cart.index') }}">View Shopping Cart</a>
|
||||
|
||||
<a class="btn btn-primary btn-lg" style="color: white;" href="{{ route('shop.checkout.onepage.index') }}">CHECKOUT</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
<div class="dropdown-toggle">
|
||||
<div style="display: inline-block; cursor: pointer;">
|
||||
|
||||
<span class="name">Cart<span class="count"> (0) </span></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('shop::checkout.cart.mini-cart')
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -242,14 +168,18 @@
|
|||
<ul class="resp-cart-dropdown-container">
|
||||
|
||||
<li class="cart-dropdown">
|
||||
<?php $cart = cart()->getCart(); ?>
|
||||
|
||||
@if(isset($cart))
|
||||
<div>
|
||||
<a href="{{ route('shop.checkout.cart.index') }}"><span class="icon cart-icon"></span></a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="{{ route('shop.checkout.cart.index') }}">
|
||||
<span class="icon cart-icon"></span>
|
||||
</a>
|
||||
</div>
|
||||
@else
|
||||
<div style="display: inline-block; cursor: pointer;">
|
||||
<span class="icon cart-icon"></span>
|
||||
</div>
|
||||
<div style="display: inline-block; cursor: pointer;">
|
||||
<span class="icon cart-icon"></span>
|
||||
</div>
|
||||
@endif
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
bind(el, binding, vnode) {
|
||||
let handler = function(e) {
|
||||
setTimeout(function() {
|
||||
e.target.value = e.target.value.toString().toLowerCase()
|
||||
e.target.value = e.target.value.toString()
|
||||
.replace(/[^\w_ ]+/g,'')
|
||||
.trim()
|
||||
.replace(/ +/g,'-');
|
||||
|
|
|
|||
|
|
@ -772,6 +772,42 @@ h2 {
|
|||
}
|
||||
}
|
||||
|
||||
.badge {
|
||||
background: #E7E7E7;
|
||||
@include border-radius(2px);
|
||||
padding: 8px;
|
||||
color: #000311;
|
||||
display: inline-block;
|
||||
|
||||
&.label-sm {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
&.label-md {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
&.label-lg {
|
||||
padding: 11px;
|
||||
}
|
||||
|
||||
&.label-xl {
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: $success-color;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: $danger-color;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-color: $warning-color;
|
||||
}
|
||||
}
|
||||
|
||||
.image-wrapper {
|
||||
margin-bottom: 20px;
|
||||
display: inline-block;
|
||||
|
|
|
|||
|
|
@ -950,6 +950,21 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.header .header-top div.right-content .currency-switcher {
|
||||
float: right;
|
||||
border-right: 2px solid #C7C7C7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.header .header-top div.right-content .currency-switcher .dropdown-list {
|
||||
width: 100px;
|
||||
top: 37px;
|
||||
}
|
||||
|
||||
.header .header-top div.right-content .currency-switcher .dropdown-list .dropdown-container {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.header .header-top div.right-content ul.account-dropdown-container {
|
||||
float: right;
|
||||
border-right: 2px solid #C7C7C7;
|
||||
|
|
@ -964,6 +979,7 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
|
|||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
margin-right: 14px;
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .dropdown-list {
|
||||
|
|
@ -1216,26 +1232,6 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.header .header-bottom .nav > li:last-child {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
border-radius: 0 0 4px 0;
|
||||
float: right;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.header .header-bottom .nav > li:last-child img {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.header .header-bottom .nav > li:last-child > a {
|
||||
border-radius: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.header .header-bottom .nav li li a {
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue