system/modules/Ecommerce/models/Category.php 1 location
|
@@ 119-128 (lines=10) @@
|
| 116 |
|
] |
| 117 |
|
]; |
| 118 |
|
|
| 119 |
|
public function getRoot() { |
| 120 |
|
$treePath = array_values(array_filter(explode('/', $this->tree_path))); |
| 121 |
|
if (!empty($treePath[0])) { |
| 122 |
|
$category = Category::get($treePath[0]); |
| 123 |
|
if ($category) { |
| 124 |
|
return $category; |
| 125 |
|
} |
| 126 |
|
} |
| 127 |
|
return $this; |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
public function beforeSave() { |
| 131 |
|
if ($this->id && $this->id == $this->parent_id) { |
system/modules/Materials/models/Category.php 1 location
|
@@ 85-94 (lines=10) @@
|
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
public function getRoot() { |
| 86 |
|
$treePath = array_values(array_filter(explode('/', $this->tree_path))); |
| 87 |
|
if (!empty($treePath[0])) { |
| 88 |
|
$category = Category::get($treePath[0]); |
| 89 |
|
if ($category) { |
| 90 |
|
return $category; |
| 91 |
|
} |
| 92 |
|
} |
| 93 |
|
return $this; |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
public function getHref() { |
| 97 |
|
$href = !empty(\App::$primary->config['defaultModule']) && \App::$primary->config['defaultModule'] == 'Materials' ? '/category' : '/materials/category'; |