Merge pull request #1045 from openclassify/dia

#3801 [store] Small bug
This commit is contained in:
Ozcan Durak 2021-04-19 15:28:56 +03:00 committed by GitHub
commit 8fad7e0106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{% set hideStandard = setting_value('visiosoft.module.advs::hide_listing_standard_price') %}
{% set listLocation = setting_value('visiosoft.module.location::list_page_location') %}
<div id="listing">
<div id="listing" class="w-100">
<table class="w-100 text-center">
<thead>
<tr class="text-white">

View File

@ -5,6 +5,44 @@ use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
{
public function getParentCats($id, $type = null, $noMainCat = true)
{
$cat = $this->getCat($id);
$catNames = array();
$cat_ids = array();
$catNames[] = $cat->name;
$cat_ids[] = $cat->id;
$subCat = $cat->parent_category_id;
if ($subCat != null) {
for ($i = 0; $i < 10; $i++) {
$parCat = $this->getCat($subCat);
if (isset($parCat)) {
if ($parCat->parent_category_id == "") {
if ($type == "add_main")
$catNames[] = $parCat->name;
if ($noMainCat) {
break;
}
}
$catNames[] = $parCat->name;
$cat_ids[] = $parCat->id;
$subCat = $parCat->parent_category_id;
}
}
}
if ($type == 'category_ids') {
return CategoryModel::query()
->whereIn('cats_category.id', $cat_ids)
->whereRaw('deleted_at IS NULL')
->orderBy('cats_category.id', 'asc')
->get();
}
if ($type == "parent_id") {
$cat_ids = array_reverse($cat_ids);
return $cat_ids[0];
}
return $catNames;
}
public function getMetaKeywords()
{

View File

@ -4,6 +4,8 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface CategoryInterface extends EntryInterface
{
public function getParentCats($id, $type = null, $noMainCat = true);
public function getMetaKeywords();
public function getMetaDescription();