Show price after login translation fixed

This commit is contained in:
Prashant Singh 2019-07-09 13:14:42 +05:30
parent 68bba4d7e2
commit 6afef120b9
7 changed files with 44 additions and 25 deletions

View File

@ -108,7 +108,26 @@ class CompanyController extends Controller
$primaryServerNameWithoutProtocol = explode('https://', $primaryServerName)[1];
}
$data['domain'] = strtolower($data['username']). '.' . $primaryServerNameWithoutProtocol;
$currentURL = $_SERVER['SERVER_NAME'];
if (substr_count($currentURL, '.') > 1) {
$primaryServerNameWithoutProtocol = explode('.', $primaryServerNameWithoutProtocol);
if ($data['username'] != $primaryServerNameWithoutProtocol[0]) {
$primaryServerNameWithoutProtocol[0] = $data['username'];
$primaryServeNameWithoutProtocol = implode('.', $primaryServerNameWithoutProtocol);
$data['domain'] = $primaryServeNameWithoutProtocol;
} else {
return response()->json([
'success' => false,
'errors' => ['Cannot keep same sub-domain as main domain']
], 403);
}
} else {
$data['domain'] = strtolower($data['username']). '.' . $primaryServerNameWithoutProtocol;
}
$validator = Validator::make($data, [
'domain' => 'required|unique:companies,domain'

View File

@ -2,42 +2,42 @@
return [
[
'key' => 'ShowPriceAfterLogin',
'name' => 'ShowPriceAfterLogin::app.showpriceafterlogin.name',
'key' => 'showpriceafterlogin',
'name' => 'showpriceafterlogin::app.showpriceafterlogin.name',
'sort' => 5
], [
'key' => 'ShowPriceAfterLogin.settings',
'name' => 'ShowPriceAfterLogin::app.showpriceafterlogin.settings',
'key' => 'showpriceafterlogin.settings',
'name' => 'showpriceafterlogin::app.showpriceafterlogin.settings',
'sort' => 1,
], [
'key' => 'ShowPriceAfterLogin.settings.settings',
'name' => 'ShowPriceAfterLogin::app.showpriceafterlogin.settings',
'key' => 'showpriceafterlogin.settings.settings',
'name' => 'showpriceafterlogin::app.showpriceafterlogin.settings',
'sort' => 1,
'fields' => [
[
'name' => 'enableordisable',
'title' => 'ShowPriceAfterLogin::app.showpriceafterlogin.toggle',
'title' => 'showpriceafterlogin::app.showpriceafterlogin.toggle',
'type' => 'boolean',
'channel_based' => true,
'locale_based' => false
], [
'name' => 'hide-shop-before-login',
'title' => 'ShowPriceAfterLogin::app.showpriceafterlogin.hide-shop-before-login',
'title' => 'showpriceafterlogin::app.showpriceafterlogin.hide-shop-before-login',
'type' => 'boolean',
'channel_based' => false,
'locale_based' => false
], [
'name' => 'selectfunction',
'title' => 'ShowPriceAfterLogin::app.showpriceafterlogin.select-function',
'title' => 'showpriceafterlogin::app.showpriceafterlogin.select-function',
'type' => 'select',
'options' => [
[
'name' => 'hide-buy-cart-guest',
'title' => 'ShowPriceAfterLogin::app.showpriceafterlogin.hide-buy-cart-guest',
'title' => 'showpriceafterlogin::app.showpriceafterlogin.hide-buy-cart-guest',
'value' => "hide-buy-cart-guest"
], [
'name' => 'hide-price-buy-cart',
'title' => 'ShowPriceAfterLogin::app.showpriceafterlogin.hide-price-buy-cart-guest',
'title' => 'showpriceafterlogin::app.showpriceafterlogin.hide-price-buy-cart-guest',
'value' => "hide-price-buy-cart-guest"
]
],

View File

@ -1,14 +1,14 @@
{!! view_render_event('bagisto.shop.products.add_to_cart.before', ['product' => $product]) !!}
@php
$status = core()->getConfigData('ShowPriceAfterLogin.settings.settings.enableordisable');
$status = core()->getConfigData('showpriceafterlogin.settings.settings.enableordisable');
$function = core()->getConfigData('ShowPriceAfterLogin.settings.settings.selectfunction');
$function = core()->getConfigData('showpriceafterlogin.settings.settings.selectfunction');
@endphp
@if (($status && ! auth()->guard('customer')->check()) && ($function == 'hide-buy-cart-guest' || $function == 'hide-price-buy-cart-guest'))
<div class="login-to-view-price">
<a class="btn btn-lg btn-primary addtocart" href="{{ route('customer.session.index') }}" style="width:100%;">
{{ __('ShowPriceAfterLogin::app.products.login-to-view-price') }}
{{ __('showpriceafterlogin::app.products.login-to-view-price') }}
</a>
</div>
@else

View File

@ -1,9 +1,9 @@
{!! view_render_event('bagisto.shop.products.buy_now.before', ['product' => $product]) !!}
@php
$status = core()->getConfigData('ShowPriceAfterLogin.settings.settings.enableordisable');
$status = core()->getConfigData('showpriceafterlogin.settings.settings.enableordisable');
$function = core()->getConfigData('ShowPriceAfterLogin.settings.settings.selectfunction');
$function = core()->getConfigData('showpriceafterlogin.settings.settings.selectfunction');
@endphp
@if (($status && ! auth()->guard('customer')->check()) && ($function == 'hide-buy-cart-guest' || $function == 'hide-price-buy-cart-guest'))

View File

@ -1,9 +1,9 @@
{!! view_render_event('bagisto.shop.products.list.card.before', ['product' => $product]) !!}
@php
$status = core()->getConfigData('ShowPriceAfterLogin.settings.settings.enableordisable');
$status = core()->getConfigData('showpriceafterlogin.settings.settings.enableordisable');
$function = core()->getConfigData('ShowPriceAfterLogin.settings.settings.selectfunction');
$function = core()->getConfigData('showpriceafterlogin.settings.settings.selectfunction');
@endphp
<div class="product-card">
@ -39,9 +39,9 @@
<div class="login-to-view-price">
<a class="btn btn-lg btn-primary addtocart" href="{{ route('customer.session.index') }}" style="width:100%;">
@if ($function == 'hide-buy-cart-guest')
{{ __('ShowPriceAfterLogin::app.products.login-to-buy') }}
{{ __('showpriceafterlogin::app.products.login-to-buy') }}
@else
{{ __('ShowPriceAfterLogin::app.products.login-to-view-price') }}
{{ __('showpriceafterlogin::app.products.login-to-view-price') }}
@endif
</a>
</div>

View File

@ -1,9 +1,9 @@
{!! view_render_event('bagisto.shop.products.price.before', ['product' => $product]) !!}
@php
$status = core()->getConfigData('ShowPriceAfterLogin.settings.settings.enableordisable');
$status = core()->getConfigData('showpriceafterlogin.settings.settings.enableordisable');
$function = core()->getConfigData('ShowPriceAfterLogin.settings.settings.selectfunction');
$function = core()->getConfigData('showpriceafterlogin.settings.settings.selectfunction');
@endphp
<div class="product-price">

View File

@ -1,6 +1,6 @@
@php
$status = core()->getConfigData('ShowPriceAfterLogin.settings.settings.enableordisable');
$function = core()->getConfigData('ShowPriceAfterLogin.settings.settings.selectfunction');
$status = core()->getConfigData('showpriceafterlogin.settings.settings.enableordisable');
$function = core()->getConfigData('showpriceafterlogin.settings.settings.selectfunction');
@endphp
@if(($status && ! auth()->guard('customer')->check()) && $function == 'hide-price-buy-cart-guest')