Merge pull request #939 from openclassify/m_alibaba

alibaba-theme is_buying area review
This commit is contained in:
Fatih Alp 2021-02-09 16:09:28 +03:00 committed by GitHub
commit cf04be536f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 2 deletions

View File

@ -21,7 +21,7 @@
{{ asset_add("theme.js", "visiosoft.theme.base::js/theme/search.js") }}
{{ asset_add("theme.js", "visiosoft.theme.base::js/theme/modal.js") }}
{{ asset_script("theme.js",['min']) }}
{{ asset_script("theme.js") }}
{{ addBlock('theme/partials/assets/additional-assets')|raw }}

View File

@ -20,7 +20,7 @@
<script src="{{ asset_path('visiosoft.theme.base::js/vendor/jquery.min.js') }}"></script>
{{ asset_script('visiosoft.theme.base::js/visiosoft.js') }}
{{ asset_style("theme.css",["min"]) }}
{{ asset_style("theme.css") }}
{% include "visiosoft.theme.base::partials/styles" %}

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\CatsModule\Category;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
use Illuminate\Support\Facades\DB;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
@ -108,4 +109,42 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
$this->model->deleteSubCategories($id);
}
}
public function getMainAndSubCats()
{
$dBName = 'default_cats_category';
$dBNamet = $dBName . '_translations';
$catsDB = DB::table((DB::raw($dBName . ' c1')))
->select(
DB::raw('c1.id'),
DB::raw('c1.slug'),
DB::raw('c1.parent_category_id'),
DB::raw('c1.icon_id'),
DB::raw('t1.name'),
DB::raw('c2.id as c2_id'),
DB::raw('c2.slug as c2_slug'),
DB::raw('c2.parent_category_id as c2_parent_category_id'),
DB::raw('t2.name as c2_name'),
DB::raw('file.id as file_id')
)
->leftJoin((DB::raw($dBName . ' c2')), DB::raw('c2.parent_category_id'), '=', DB::raw('c1.id'))
->leftJoin((DB::raw($dBNamet . ' t1')), DB::raw('c1.id'), '=', DB::raw('t1.entry_id'))
->leftJoin((DB::raw($dBNamet . ' t2')), DB::raw('c2.id'), '=', DB::raw('t2.entry_id'))
->leftJoin(DB::raw('default_files_files file'), DB::raw('c1.icon_id'), DB::raw('file.id'))
->where(DB::raw('t1.locale'), Request()->session()->get('_locale', setting_value('streams::default_locale')))
->where(DB::raw('t2.locale'), Request()->session()->get('_locale', setting_value('streams::default_locale')))
->where(DB::raw("c1.deleted_at"), NULL)
->where(DB::raw("c2.deleted_at"), NULL)
->whereNull(DB::raw("c1.parent_category_id"))
->orderBy(DB::raw("c1.sort_order"))
->orderBy(DB::raw("c2.sort_order"))
->get();
$cats = collect([]);
$cats->subcats = $catsDB;
$cats->maincats = $catsDB->unique('id');
return $cats;
}
}

View File

@ -21,4 +21,6 @@ interface CategoryRepositoryInterface extends EntryRepositoryInterface
public function getCategories();
public function DeleteCategories($id);
public function getMainAndSubCats();
}