diff --git a/packages/Webkul/SAASCustomizer/src/Http/Controllers/CompanyController.php b/packages/Webkul/SAASCustomizer/src/Http/Controllers/CompanyController.php index 7ce9a2bb2..64c979b7f 100644 --- a/packages/Webkul/SAASCustomizer/src/Http/Controllers/CompanyController.php +++ b/packages/Webkul/SAASCustomizer/src/Http/Controllers/CompanyController.php @@ -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' diff --git a/packages/Webkul/ShowPriceAfterLogin/Config/system.php b/packages/Webkul/ShowPriceAfterLogin/Config/system.php index a91f79513..cd71e32d2 100644 --- a/packages/Webkul/ShowPriceAfterLogin/Config/system.php +++ b/packages/Webkul/ShowPriceAfterLogin/Config/system.php @@ -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" ] ], diff --git a/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/add-to-cart.blade.php b/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/add-to-cart.blade.php index b5b4b4e16..a3d6e82ce 100644 --- a/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/add-to-cart.blade.php +++ b/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/add-to-cart.blade.php @@ -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'))
@else diff --git a/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/buy-now.blade.php b/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/buy-now.blade.php index 0f7dcf1b8..c7fdb4225 100644 --- a/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/buy-now.blade.php +++ b/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/buy-now.blade.php @@ -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')) diff --git a/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/card.blade.php b/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/card.blade.php index dd754d56c..893b79ce2 100644 --- a/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/card.blade.php +++ b/packages/Webkul/ShowPriceAfterLogin/src/Resources/views/card.blade.php @@ -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