This commit is contained in:
Shubham Mehrotra 2020-04-30 17:21:46 +05:30
commit 9603befdec
41 changed files with 429 additions and 193 deletions

View File

@ -1,6 +1,6 @@
APP_NAME=Bagisto
APP_ENV=local
APP_VERSION=1.1.0
APP_VERSION=1.1.2
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

View File

@ -1,6 +1,6 @@
APP_NAME=Laravel
APP_ENV=local
APP_VERSION=1.1.0
APP_VERSION=1.1.2
APP_KEY=base64:G4KY3tUsTaY9ONo1n/QyJvVLQZdJDgbIkSJswFK01HE=
APP_DEBUG=true
APP_URL=http://localhost

View File

@ -2,6 +2,75 @@
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
## **v1.1.2 (24th of March 2020)** - *Release*
* [feature] - Now customer can cancel order.
* [feature] - Auto and manual currency exchange rates update feature added.
* #797 [fixed] - Add new module
* #2453 [fixed] - Velocity theme is not loading on fresh instance
* #2691 [fixed] - Shipping and Payment methods automatically selected on Checkout oage
* #2752 [fixed] - Error when you create or update a new catalog under root
* #2793 [fixed] - Stock Check Incorrect for Configurable Items
* #2826 [fixed] - Not able to view cart icon
* #2869 [fixed] - Updating "Velocity meta data" throws QueryException
* #2871 [fixed] - Refund throws "Undefined index: shipping" error
* #2875 [fixed] - Deleting brands that have been assigned to products causes checkout error
* #2884 [fixed] - Undefined Index slot: when add to cart rental booking
* #2890 [fixed] - cart rule condition (price in cart) always set to equal or less than when select greater than/less than
* #2895 [fixed] - The type hint of view in this blade file is 'address' - there is no tag in any provider which loads view with this type hint.
* #2896 [fixed] - There are two fields with having same value of name attribute one is hidden and other is of its desired type - is this redundant code or its solving any purpose?
* #2897 [fixed] - Inventory status field should be passed through validation for boolean in its backend controller.
* #2898 [fixed] - error when viewing a category and then wanting to change the language of the page in mobile view
* #2899 [fixed] - showing the configured products as radio button
* #2900 [fixed] - getting different variant of a configurable product in front end
* #2901 [fixed] - Error when creating a category
* #2902 [fixed] - unify address tables
* #2908 [fixed] - A class is missing from the Velocity ProductRepositiry file
* #2914 [fixed] - Filter not showing on mobile, also sorting not working on mobile
* #2915 [fixed] - filters are missing on mobile view.
* #2919 [fixed] - Header Content not working on other languages
* #2925 [fixed] - exception for php version 7.4
* #2938 [fixed] - Extend Model Class
* #2939 [fixed] - get product description for API without html tags
* #2940 [fixed] - creating categories have error
* #2943 [fixed] - Scroll images is not working
* #2945 [fixed] - API product detail return empty array
* #2954 [fixed] - The merging cart function does not work when already added all items of product into customer cart
## **v1.1.0 (24th of March 2020)** - *Release*
* #797 [fixed] - Add new module

59
composer.lock generated
View File

@ -4096,16 +4096,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v4.4.5",
"version": "v4.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "7e41b4fcad4619535f45f8bfa7744c4f384e1648"
"reference": "62f92509c9abfd1f73e17b8cf1b72c0bdac6611b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/7e41b4fcad4619535f45f8bfa7744c4f384e1648",
"reference": "7e41b4fcad4619535f45f8bfa7744c4f384e1648",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/62f92509c9abfd1f73e17b8cf1b72c0bdac6611b",
"reference": "62f92509c9abfd1f73e17b8cf1b72c0bdac6611b",
"shasum": ""
},
"require": {
@ -4147,7 +4147,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2020-02-13T19:40:01+00:00"
"time": "2020-03-30T14:07:33+00:00"
},
{
"name": "symfony/http-kernel",
@ -4241,16 +4241,16 @@
},
{
"name": "symfony/mime",
"version": "v5.0.5",
"version": "v5.0.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "9b3e5b5e58c56bbd76628c952d2b78556d305f3c"
"reference": "481b7d6da88922fb1e0d86a943987722b08f3955"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/9b3e5b5e58c56bbd76628c952d2b78556d305f3c",
"reference": "9b3e5b5e58c56bbd76628c952d2b78556d305f3c",
"url": "https://api.github.com/repos/symfony/mime/zipball/481b7d6da88922fb1e0d86a943987722b08f3955",
"reference": "481b7d6da88922fb1e0d86a943987722b08f3955",
"shasum": ""
},
"require": {
@ -4299,7 +4299,7 @@
"mime",
"mime-type"
],
"time": "2020-02-04T09:41:09+00:00"
"time": "2020-03-27T16:56:45+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -4420,16 +4420,16 @@
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.14.0",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "6842f1a39cf7d580655688069a03dd7cd83d244a"
"reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6842f1a39cf7d580655688069a03dd7cd83d244a",
"reference": "6842f1a39cf7d580655688069a03dd7cd83d244a",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
"reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
"shasum": ""
},
"require": {
@ -4443,7 +4443,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
"dev-master": "1.15-dev"
}
},
"autoload": {
@ -4478,20 +4478,20 @@
"portable",
"shim"
],
"time": "2020-01-17T12:01:36+00:00"
"time": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.14.0",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
"reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
"reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
"shasum": ""
},
"require": {
@ -4503,7 +4503,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
"dev-master": "1.15-dev"
}
},
"autoload": {
@ -4537,7 +4537,7 @@
"portable",
"shim"
],
"time": "2020-01-13T11:15:53+00:00"
"time": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-php56",
@ -4597,16 +4597,16 @@
},
{
"name": "symfony/polyfill-php72",
"version": "v1.14.0",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf"
"reference": "37b0976c78b94856543260ce09b460a7bc852747"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
"reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
"reference": "37b0976c78b94856543260ce09b460a7bc852747",
"shasum": ""
},
"require": {
@ -4615,7 +4615,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
"dev-master": "1.15-dev"
}
},
"autoload": {
@ -4648,7 +4648,7 @@
"portable",
"shim"
],
"time": "2020-01-13T11:15:53+00:00"
"time": "2020-02-27T09:26:54+00:00"
},
{
"name": "symfony/polyfill-php73",
@ -7770,6 +7770,5 @@
"ext-pdo_mysql": "*",
"ext-tokenizer": "*"
},
"platform-dev": [],
"plugin-api-version": "1.1.0"
"platform-dev": []
}

View File

@ -153,7 +153,7 @@ return [
/*
Application Version
*/
'version' => env('APP_VERSION', '1.1.0'),
'version' => env('APP_VERSION'),
/**
* Blacklisting attributes while debugging

View File

@ -30,12 +30,16 @@ return [
],
'exchange-api' => [
'default' => 'fixer',
'default' => 'exchange_rates',
'fixer' => [
'paid_account' => false,
'key' => env('fixer_api_key'),
'class' => 'Webkul\Core\Helpers\Exchange\FixerExchange'
]
],
'exchange_rates' => [
'class' => 'Webkul\Core\Helpers\Exchange\ExchangeRates'
],
],
'stripe' => [

View File

@ -45,10 +45,9 @@ class ProductController extends Controller
*/
public function get($id)
{
$product = $this->productRepository->findOrFail($id);
$options = $this->productRepository->findOrFail($id)->getTypeInstance()->getProductOptions($product);
return $options;
return new ProductResource(
$this->productRepository->findOrFail($id)
);
}
/**

View File

@ -99,6 +99,12 @@ return [
'type' => 'image',
'channel_based' => true,
'validation' => 'mimes:jpeg,bmp,png,jpg',
], [
'name' => 'favicon',
'title' => 'admin::app.admin.system.favicon',
'type' => 'image',
'channel_based' => true,
'validation' => 'mimes:jpeg,bmp,png,jpg',
],
],
], [

View File

@ -507,7 +507,7 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::settings.exchange_rates.edit'
])->name('admin.exchange_rates.edit');
Route::get('/exchange_rates/update-rates/{service}', 'Webkul\Core\Http\Controllers\ExchangeRateController@updateRates')->name('admin.exchange_rates.update-rates');
Route::get('/exchange_rates/update-rates', 'Webkul\Core\Http\Controllers\ExchangeRateController@updateRates')->name('admin.exchange_rates.update_rates');
Route::put('/exchange_rates/edit/{id}', 'Webkul\Core\Http\Controllers\ExchangeRateController@update')->defaults('_config', [
'redirect' => 'admin.exchange_rates.index'

View File

@ -729,7 +729,7 @@ return [
'target_currency' => 'العملة المستهدفة',
'rate' => 'معدل',
'exchange-class-not-found' => ':service لم يتم العثور على فئة سعر الصرف آسيف',
'update-rates' => ':service تحديث الأسعار باستخدام ',
'update-rates' => 'الأسعار',
'create-success' => 'تم إنشاء سعر الصرف بنجاح',
'update-success' => 'تم تحديث سعر الصرف بنجاح',
'delete-success' => 'تم حذف سعر الصرف بنجاح',
@ -1304,7 +1304,8 @@ return [
'all-channels' => 'الكل',
'all-locales' => 'الكل',
'invoice-slip-design' => 'Invoice Slip Design',
'logo' => 'logo'
'logo' => 'logo',
'favicon' => 'Favicon'
]
]
];

View File

@ -729,7 +729,7 @@ return [
'target_currency' => 'Target Currency',
'rate' => 'Rate',
'exchange-class-not-found' => ':service exchange rate class not found',
'update-rates' => 'Update rates using :service',
'update-rates' => 'Update Rates',
'create-success' => 'Exchange Rate created successfully.',
'update-success' => 'Exchange Rate updated successfully.',
'delete-success' => 'Exchange Rate deleted successfully.',
@ -1309,7 +1309,8 @@ return [
'all-channels' => 'All',
'all-locales' => 'All',
'invoice-slip-design' => 'Invoice Slip Design',
'logo' => 'logo'
'logo' => 'logo',
'favicon' => 'Favicon'
]
]
];

View File

@ -729,7 +729,7 @@ return [
'target_currency' => 'هدف ارز',
'rate' => 'نرخ',
'exchange-class-not-found' => 'کلاس نرخ ارز :service یافت نشد',
'update-rates' => ' به روز کنید :service نرخ ها را با استفاده از',
'update-rates' => 'نرخ ها را به روز کنید',
'create-success' => 'نرخ ارز با موفقیت ایجاد شد.',
'update-success' => 'نرخ ارز با موفقیت به روز شد.',
'delete-success' => 'نرخ ارز با موفقیت حذف شد.',
@ -1310,7 +1310,8 @@ return [
'all-locales' => 'همه',
'sandbox' => 'Sandbox',
'invoice-slip-design' => 'Invoice Slip Design',
'logo' => 'logo'
'logo' => 'logo',
'favicon' => 'Favicon'
]
]
];

View File

@ -729,7 +729,7 @@ return [
'target_currency' => 'Valuta doel',
'rate' => 'Tarief',
'exchange-class-not-found' => ':service wisselkoersklasse niet gevonden',
'update-rates' => 'Tarieven bijwerken met :service',
'update-rates' => 'Tarieven bijwerken',
'create-success' => 'Wisselkoers succesvol aangemaakt.',
'update-success' => 'Wisselkoers succesvol bijgewerkt.',
'delete-success' => 'Wisselkoers succesvol verwijderd.',
@ -1309,7 +1309,8 @@ return [
'all-channels' => 'Alles',
'all-locales' => 'Alles',
'invoice-slip-design' => 'Invoice Slip Design',
'logo' => 'logo'
'logo' => 'logo',
'favicon' => 'Favicon'
]
]
];

View File

@ -729,6 +729,7 @@ return [
'target_currency' => 'Moeda Alvo',
'rate' => 'Taxa',
'exchange-class-not-found' => ':service de taxa de câmbio de serviço não encontrada',
'update-rates' => 'Atualizar Tarifas',
'rate' => 'Taxa',
'create-success' => 'Taxa de Câmbio criada com sucesso.',
'update-success' => 'Taxa de Câmbio atualizada com sucesso.',
@ -1312,7 +1313,8 @@ return [
'all-locales' => 'Todos',
'sandbox' => 'Sandbox',
'invoice-slip-design' => 'Design da Nota do Pedido',
'logo' => 'logo'
'logo' => 'logo',
'favicon' => 'Favicon'
]
]
];

View File

@ -13,7 +13,7 @@
<div class="page-action">
<a href="{{ route('admin.catalog.attributes.create') }}" class="btn btn-lg btn-primary">
{{ __('Add Attribute') }}
{{ __('admin::app.catalog.attributes.add-title') }}
</a>
</div>
</div>
@ -28,4 +28,4 @@
{!! view_render_event('bagisto.admin.catalog.attributes.list.after') !!}
</div>
@stop
@stop

View File

@ -6,7 +6,12 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="icon" sizes="16x16" href="{{ asset('vendor/webkul/ui/assets/images/favicon.ico') }}" />
@if ($favicon = core()->getConfigData('general.design.admin_logo.favicon'))
<link rel="icon" sizes="16x16" href="{{ \Illuminate\Support\Facades\Storage::url($favicon) }}" />
@else
<link rel="icon" sizes="16x16" href="{{ asset('vendor/webkul/ui/assets/images/favicon.ico') }}" />
@endif
<link rel="stylesheet" href="{{ asset('vendor/webkul/ui/assets/css/ui.css') }}">
<link rel="stylesheet" href="{{ asset('vendor/webkul/admin/assets/css/admin.css') }}">

View File

@ -56,7 +56,7 @@
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
<select v-validate="'required'" class="control" name="target_currency" data-vv-as="&quot;{{ __('admin::app.settings.exchange_rates.target_currency') }}&quot;">
@foreach ($currencies as $currency)
@if (is_null($currency->CurrencyExchangeRate))
@if (is_null($currency->exchange_rate))
<option value="{{ $currency->id }}">{{ $currency->name }}</option>
@endif
@endforeach

View File

@ -12,25 +12,20 @@
</div>
<div class="page-action">
<a href="{{ route('admin.exchange_rates.update_rates') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.exchange_rates.update-rates') }}
</a>
<a href="{{ route('admin.exchange_rates.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.exchange_rates.add-title') }}
</a>
@php
$defaultService = config('services.exchange-api.default');
@endphp
{{-- <a href="{{ route('admin.exchange_rates.update-rates', $defaultService) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.exchange_rates.update-rates', [
'service' => $defaultService
]) }}
</a> --}}
</div>
</div>
<div class="page-content">
@inject('exchange_rates','Webkul\Admin\DataGrids\ExchangeRatesDataGrid')
{!! $exchange_rates->render() !!}
{!! app('Webkul\Admin\DataGrids\ExchangeRatesDataGrid')->render() !!}
</div>
</div>
@stop

View File

@ -368,8 +368,14 @@ class Cart
continue;
}
$found = true;
$cartItem->quantity = $newQuantity = $cartItem->quantity + $guestCartItem->quantity;
if ($cartItem->quantity > $cartItem->product->getTypeInstance()->totalQuantity()) {
$cartItem->quantity = $newQuantity = $cartItem->product->getTypeInstance()->totalQuantity();
}
if (! $this->isItemHaveQuantity($cartItem)) {
$this->cartItemRepository->delete($guestCartItem->id);
@ -387,8 +393,6 @@ class Cart
$guestCart->items->forget($key);
$this->cartItemRepository->delete($guestCartItem->id);
$found = true;
}
if (! $found) {

View File

@ -0,0 +1,36 @@
<?php
namespace Webkul\Core\Console\Commands;
use Illuminate\Console\Command;
class ExchangeRateUpdate extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'exchange-rate:update';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Automatically updates currency exchange rates ';
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
try {
app(config('services.exchange-api.' . config('services.exchange-api.default') . '.class'))->updateRates();
} catch(\Exception $e) {
}
}
}

View File

@ -4,7 +4,5 @@ namespace Webkul\Core\Helpers\Exchange;
abstract class ExchangeRate
{
abstract public function fetchRates();
abstract public function UpdateRates();
abstract public function updateRates();
}

View File

@ -0,0 +1,88 @@
<?php
namespace Webkul\Core\Helpers\Exchange;
use Webkul\Core\Helpers\Exchange\ExchangeRate;
use Webkul\Core\Repositories\CurrencyRepository;
use Webkul\Core\Repositories\ExchangeRateRepository;
class ExchangeRates extends ExchangeRate
{
/**
* API endpoint
*
* @var string
*/
protected $apiEndPoint;
/**
* Holds CurrencyRepository instance
*
* @var \Webkul\Core\Repositories\CurrencyRepository
*/
protected $currencyRepository;
/**
* Holds ExchangeRateRepository instance
*
* @var \Webkul\Core\Repositories\ExchangeRateRepository
*/
protected $exchangeRateRepository;
/**
* Create a new helper instance.
*
* @param \Webkul\Core\Repositories\CurrencyRepository $currencyRepository
* @param \Webkul\Core\Repositories\ExchangeRateRepository $exchangeRateRepository
* @return void
*/
public function __construct(
CurrencyRepository $currencyRepository,
ExchangeRateRepository $exchangeRateRepository
)
{
$this->currencyRepository = $currencyRepository;
$this->exchangeRateRepository = $exchangeRateRepository;
$this->apiEndPoint = 'https://api.exchangeratesapi.io/latest';
}
/**
* Fetch rates and updates in currency_exchange_rates table
*
* @return \Exception|void
*/
public function updateRates()
{
$client = new \GuzzleHttp\Client();
foreach ($this->currencyRepository->all() as $currency) {
if ($currency->code == config('app.currency')) {
continue;
}
$result = $client->request('GET', $this->apiEndPoint . '?base=' . config('app.currency') . '&symbols=' . $currency->code);
$result = json_decode($result->getBody()->getContents(), true);
if (isset($result['success']) && ! $result['success']) {
throw new E\xception(
isset($result['error']['info'])
? $result['error']['info']
: $result['error']['type'], 1);
}
if ($exchangeRate = $currency->exchange_rate) {
$this->exchangeRateRepository->update([
'rate' => $result['rates'][$currency->code],
], $exchangeRate->id);
} else {
$this->exchangeRateRepository->create([
'rate' => $result['rates'][$currency->code],
'target_currency' => $currency->id,
]);
}
}
}
}

View File

@ -3,9 +3,10 @@
namespace Webkul\Core\Helpers\Exchange;
use Webkul\Core\Helpers\Exchange\ExchangeRate;
use Webkul\Core\Repositories\CurrencyRepository;
use Webkul\Core\Repositories\ExchangeRateRepository;
class FixerExchange extends ExchangeRate
class FixerExchange extends ExchangeRate
{
/**
* API key
@ -21,49 +22,76 @@ class FixerExchange extends ExchangeRate
*/
protected $apiEndPoint;
/**
* Holds CurrencyRepository instance
*
* @var \Webkul\Core\Repositories\CurrencyRepository
*/
protected $currencyRepository;
/**
* Holds ExchangeRateRepository instance
*
* @var \Webkul\Core\Helpers\Exchange\ExchangeRate
* @var \Webkul\Core\Repositories\ExchangeRateRepository
*/
protected $exchangeRate;
protected $exchangeRateRepository;
/**
* Create a new helper instance.
*
* @param \Webkul\Core\Repositories\CurrencyRepository $currencyRepository
* @param \Webkul\Core\Repositories\ExchangeRateRepository $exchangeRateRepository
* @return void
*/
public function __construct()
public function __construct(
CurrencyRepository $currencyRepository,
ExchangeRateRepository $exchangeRateRepository
)
{
$this->apiKey = config('services.exchange-api')['fixer']['key'];
$this->currencyRepository = $currencyRepository;
$this->apiEndPoint = 'http://data.fixer.io/api/latest?access_key=' . $this->apiKey;
$this->exchangeRateRepository = $exchangeRateRepository;
$this->apiEndPoint = 'http://data.fixer.io/api';
$this->apiKey = config('services.exchange-api')['fixer']['key'];
}
/**
* @return array
* Fetch rates and updates in currency_exchange_rates table
*
* @return \Exception|void
*/
public function fetchRates()
{
$rates = array();
$this->exchangeRate = app('Webkul\Core\Repositories\ExchangeRateRepository');
// dummy api call
$client = new \GuzzleHttp\Client();
if (config('services.exchange-api')['fixer']['paid_account']) {
$result = $client->request('GET', 'http://data.fixer.io/api/' . date('Y-m-d').'?access_key=' . $this->apiKey.'&base=' . core()->getBaseCurrency()->code . '&symbols=INR');
} else {
$result = $client->request('GET', 'http://data.fixer.io/api/' . date('Y-m-d') . '?access_key=' . $this->apiKey . '&symbols=USD');
}
$result = json_decode($result->getBody()->getContents());
return $result;
}
public function updateRates()
{
$client = new \GuzzleHttp\Client();
foreach ($this->currencyRepository->all() as $currency) {
if ($currency->code == config('app.currency')) {
continue;
}
$result = $client->request('GET', $this->apiEndPoint . '/' . date('Y-m-d') . '?access_key=' . $this->apiKey .'&base=' . config('app.currency') . '&symbols=' . $currency->code);
$result = json_decode($result->getBody()->getContents(), true);
if (isset($result['success']) && ! $result['success']) {
throw new \Exception(
isset($result['error']['info'])
? $result['error']['info']
: $result['error']['type'], 1);
}
if ($exchangeRate = $currency->exchange_rate) {
$this->exchangeRateRepository->update([
'rate' => $result['rates'][$currency->code],
], $exchangeRate->id);
} else {
$this->exchangeRateRepository->create([
'rate' => $result['rates'][$currency->code],
'target_currency' => $currency->id,
]);
}
}
}
}

View File

@ -67,7 +67,7 @@ class ExchangeRateController extends Controller
*/
public function create()
{
$currencies = $this->currencyRepository->with('CurrencyExchangeRate')->all();
$currencies = $this->currencyRepository->with('exchange_rate')->all();
return view($this->_config['view'], compact('currencies'));
}
@ -137,38 +137,19 @@ class ExchangeRateController extends Controller
/**
* Update Rates Using Exchange Rates API
*
* @param string $service
* @return \Illuminate\Http\JsonResponse
*/
public function updateRates($service)
public function updateRates()
{
$exchangeService = config('services.exchange-api')[$service];
try {
app(config('services.exchange-api.' . config('services.exchange-api.default') . '.class'))->updateRates();
if (is_array($exchangeService)) {
if (! array_key_exists('class', $exchangeService)) {
return response()->json([
'success' => false,
'rates' => null,
'error' => trans('admin::app.exchange-rate.exchange-class-not-found', [
'service' => $service,
]),
], 400);
}
$exchangeServiceInstance = new $exchangeService['class'];
$updatedRates = $exchangeServiceInstance->fetchRates();
return response()->json([
'success' => true,
'rates' => 'rates',
], 200);
} else {
return response()->json([
'success' => false,
'rates' => null,
'error' => trans('admin::app.exchange-rate.invalid-config'),
], 400);
session()->flash('success', trans('admin::app.settings.exchange_rates.update-success'));
} catch(\Exception $e) {
session()->flash('error', $e->getMessage());
}
return redirect()->back();
}
/**

View File

@ -30,9 +30,9 @@ class Currency extends Model implements CurrencyContract
}
/**
* Get the currency_exchange associated with the currency.
* Get the exchange rate associated with the currency.
*/
public function CurrencyExchangeRate()
public function exchange_rate()
{
return $this->hasOne(CurrencyExchangeRateProxy::modelClass(), 'target_currency');
}

View File

@ -12,6 +12,7 @@ use Webkul\Core\Models\SliderProxy;
use Webkul\Core\Observers\SliderObserver;
use Webkul\Core\Console\Commands\BagistoVersion;
use Webkul\Core\Console\Commands\Install;
use Webkul\Core\Console\Commands\ExchangeRateUpdate;
class CoreServiceProvider extends ServiceProvider
{
@ -78,7 +79,7 @@ class CoreServiceProvider extends ServiceProvider
protected function registerCommands(): void
{
if ($this->app->runningInConsole()) {
$this->commands([BagistoVersion::class, Install::class,]);
$this->commands([BagistoVersion::class, Install::class, ExchangeRateUpdate::class]);
}
}

View File

@ -145,14 +145,16 @@ class ProductRepository extends Repository
if (isset($params['sort'])) {
$attribute = $this->attributeRepository->findOneByField('code', $params['sort']);
if ($params['sort'] == 'price') {
if ($attribute->code == 'price') {
$qb->orderBy('min_price', $params['order']);
if ($attribute) {
if ($params['sort'] == 'price') {
if ($attribute->code == 'price') {
$qb->orderBy('min_price', $params['order']);
} else {
$qb->orderBy($attribute->code, $params['order']);
}
} else {
$qb->orderBy($attribute->code, $params['order']);
$qb->orderBy($params['sort'] == 'created_at' ? 'product_flat.created_at' : $attribute->code, $params['order']);
}
} else {
$qb->orderBy($params['sort'] == 'created_at' ? 'product_flat.created_at' : $attribute->code, $params['order']);
}
}
@ -262,7 +264,7 @@ class ProductRepository extends Repository
->where('product_flat.new', 1)
->where('product_flat.channel', $channel)
->where('product_flat.locale', $locale)
->orderBy('product_id', 'desc');
->inRandomOrder();
})->paginate(4);
return $results;
@ -287,7 +289,7 @@ class ProductRepository extends Repository
->where('product_flat.featured', 1)
->where('product_flat.channel', $channel)
->where('product_flat.locale', $locale)
->orderBy('product_id', 'desc');
->inRandomOrder();
})->paginate(4);
return $results;

View File

@ -161,6 +161,26 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
<label for="billing[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
@{{ errors.first('address-form.billing[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[state]') ? 'has-error' : '']">
<label for="billing[state]" class="required">
{{ __('shop::app.checkout.onepage.state') }}
@ -195,26 +215,6 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
<label for="billing[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
@{{ errors.first('address-form.billing[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[phone]') ? 'has-error' : '']">
<label for="billing[phone]" class="required">
{{ __('shop::app.checkout.onepage.phone') }}
@ -386,6 +386,24 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
<label for="shipping[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
@{{ errors.first('address-form.shipping[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[state]') ? 'has-error' : '']">
<label for="shipping[state]" class="required">
{{ __('shop::app.checkout.onepage.state') }}
@ -421,24 +439,6 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
<label for="shipping[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
@{{ errors.first('address-form.shipping[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[phone]') ? 'has-error' : '']">
<label for="shipping[phone]" class="required">
{{ __('shop::app.checkout.onepage.phone') }}

View File

@ -6,11 +6,14 @@
<?php
$filterAttributes = [];
$maxPrice = 0;
if (isset($category)) {
$products = $productRepository->getAll($category->id);
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}
if (! count($filterAttributes) > 0) {
@ -161,7 +164,7 @@
props: ['index', 'attribute', 'appliedFilterValues'],
data: function() {
let maxPrice = '{{ core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category)) }}';
let maxPrice = @json($maxPrice);
maxPrice = maxPrice ? ((parseInt(maxPrice) !== 0 || maxPrice) ? parseInt(maxPrice) : 500) : 500;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/velocity.js": "/js/velocity.js?id=08fbd43328947b542230",
"/js/velocity.js": "/js/velocity.js?id=a0421440e72113e0ce0d",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
"/css/velocity.css": "/css/velocity.css?id=c173cf4cc10342579c9b"
}

View File

@ -11,14 +11,13 @@ window.jQuery = window.$ = require("jquery");
window.BootstrapSass = require("bootstrap-sass");
Vue.use(VueToast);
Vue.use(VeeValidate);
Vue.use(VueCarousel);
Vue.use(BootstrapSass);
Vue.prototype.$http = axios;
Vue.use(VeeValidate, {
dictionary: {
ar: { messages: messagesAr }
ar: messagesAr
}
});

View File

@ -25,6 +25,14 @@
{{ __('shop::app.customer.account.order.view.page-tile', ['order_id' => $order->increment_id]) }}
</span>
<span></span>
@if ($order->canCancel())
<span class="account-action">
<a href="{{ route('customer.orders.cancel', $order->id) }}" class="theme-btn light unset pull-right" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'" style="float: right">
{{ __('shop::app.customer.account.order.view.cancel-btn-title') }}
</a>
</span>
@endif
</div>
{!! view_render_event('bagisto.shop.customers.account.orders.view.before', ['order' => $order]) !!}

View File

@ -4,12 +4,15 @@
<?php
$filterAttributes = [];
$maxPrice = 0;
if (isset($category)) {
$products = $productRepository->getAll($category->id);
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
}
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}
if (! count($filterAttributes) > 0) {
$filterAttributes = $attributeRepository->getFilterAttributes();
@ -181,7 +184,7 @@
],
data: function() {
let maxPrice = '{{ core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category)) }}';
let maxPrice = @json($maxPrice);
maxPrice = maxPrice ? ((parseInt(maxPrice) !== 0 || maxPrice) ? parseInt(maxPrice) : 500) : 500;

View File

@ -27,11 +27,11 @@ $data = array();
if (empty($_POST['host_name']))
$errors['host_name'] = 'Host Name is required.';
if (empty($_POST['database_name']))
$errors['database_name'] = 'Database Name is required.';
// if (empty($_POST['database_name']))
// $errors['database_name'] = 'Database Name is required.';
if (empty($_POST['user_name']))
$errors['user_name'] = 'User Name is required.';
// if (empty($_POST['user_name']))
// $errors['user_name'] = 'User Name is required.';
if (empty($_POST['port_name']))
$errors['port_name'] = 'Port Name is required.';

View File

@ -1,8 +1,9 @@
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$cssUrl = $actual_link .'/'. 'css/style.css';
$cssUrl = $actual_link .'/'. 'CSS/style.css';
$logo = $actual_link .'/'. 'Images/logo.svg';
$jsURL = $actual_link .'/'. 'js/script.js';
?>
<!DOCTYPE html>
<html>
@ -115,11 +116,11 @@
include __DIR__ . '/Classes/Requirement.php';
// including php files
include __DIR__ . '/views/environment.blade.php';
include __DIR__ . '/views/migration.blade.php';
include __DIR__ . '/views/admin.blade.php';
include __DIR__ . '/views/email.blade.php';
include __DIR__ . '/views/finish.blade.php';
include __DIR__ . '/Views/environment.blade.php';
include __DIR__ . '/Views/migration.blade.php';
include __DIR__ . '/Views/admin.blade.php';
include __DIR__ . '/Views/email.blade.php';
include __DIR__ . '/Views/finish.blade.php';
// object creation
$requirement = new Requirement();
@ -143,6 +144,7 @@
<a href="https://bagisto.com/" target="_blank">Bagisto</a> a community project by <a href="https://webkul.com/" target="_blank">Webkul</a>
</div>
<script src="js/script.js"></script>
<script src="<?php echo $jsURL; ?>" ></script>
</body>
</html>