Skip to content

Commit

Permalink
Merge pull request #202 from vivek-webkul/patch-4
Browse files Browse the repository at this point in the history
[Updated: added module status check.]
  • Loading branch information
vivek-webkul authored Sep 27, 2021
2 parents a8f84ce + abf76cc commit f5dbeef
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/Config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
'sort' => 1,
'fields' => [
[
'name' => 'status',
'title' => 'pwa::app.admin.system.status',
'type' => 'boolean'
], [
'name' => 'name',
'title' => 'pwa::app.admin.system.name',
'type' => 'text',
Expand Down
16 changes: 9 additions & 7 deletions src/Helpers/AdminHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ public function __construct(
*/
public function storeCategoryIcon($category)
{
$data = request()->all();
if ( core()->getConfigData('pwa.settings.general.status') ) {
$data = request()->all();

if (! $category instanceof \Webkul\Category\Contracts\Category) {
$category = $this->categoryRepository->findOrFail($category);
}

$category->category_product_in_pwa = ($data['add_in_pwa'] ?? 0) == "1" ? 1 : 0;
$category->save();
if (! $category instanceof \Webkul\Category\Contracts\Category) {
$category = $this->categoryRepository->findOrFail($category);
}

$category->category_product_in_pwa = ($data['add_in_pwa'] ?? 0) == "1" ? 1 : 0;
$category->save();
}

return $category;
}
}
6 changes: 6 additions & 0 deletions src/Http/Controllers/SinglePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public function home()
*/
public function index()
{
if (! core()->getConfigData('pwa.settings.general.status') ) {
session()->flash('warning', trans('pwa::app.shop.home.enable-pwa-status'));

return redirect()->route('shop.home.index');
}

$parsedUrl = parse_url(config('app.url'));

$urlPath = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'admin' => [
'system' => [
'pwa' => 'PWA',
'status' => 'Status',
'btn-save' => 'Save',
'name' => 'Name',
'topic' => 'Topic',
Expand Down Expand Up @@ -64,5 +65,11 @@
'target-url' => 'Target URL',
'description' => 'Description',
]
],

'shop' => [
'home' => [
'enable-pwa-status' => 'Warning: Please enable pwa extension status from the configuration.',
]
]
];

0 comments on commit f5dbeef

Please sign in to comment.