| @@ 86-120 (lines=35) @@ | ||
| 83 | return $return; |
|
| 84 | } |
|
| 85 | ||
| 86 | function sitemap() |
|
| 87 | { |
|
| 88 | $map = []; |
|
| 89 | $zeroMaterials = \Materials\Material::getList(['where' => ['category_id', 0]]); |
|
| 90 | foreach ($zeroMaterials as $mat) { |
|
| 91 | $map[] = [ |
|
| 92 | 'name' => $mat->name, |
|
| 93 | 'url' => [ |
|
| 94 | 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($mat->getHref()) |
|
| 95 | ], |
|
| 96 | ]; |
|
| 97 | } |
|
| 98 | ||
| 99 | $categorys = \Materials\Category::getList(['where' => ['parent_id', 0]]); |
|
| 100 | $scan = function($category, $scan) { |
|
| 101 | $map = []; |
|
| 102 | ||
| 103 | foreach ($category->items as $mat) { |
|
| 104 | $map[] = [ |
|
| 105 | 'name' => $mat->name, |
|
| 106 | 'url' => [ |
|
| 107 | 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($mat->getHref()) |
|
| 108 | ], |
|
| 109 | ]; |
|
| 110 | } |
|
| 111 | foreach ($category->childs as $child) { |
|
| 112 | $map = array_merge($map, $scan($child, $scan)); |
|
| 113 | } |
|
| 114 | return $map; |
|
| 115 | }; |
|
| 116 | foreach ($categorys as $category) { |
|
| 117 | $map = array_merge($map, $scan($category, $scan)); |
|
| 118 | } |
|
| 119 | return $map; |
|
| 120 | } |
|
| 121 | ||
| 122 | } |
|
| 123 | ||
| @@ 509-543 (lines=35) @@ | ||
| 506 | return $cart; |
|
| 507 | } |
|
| 508 | ||
| 509 | function sitemap() { |
|
| 510 | $map = []; |
|
| 511 | $zeroItems = \Ecommerce\Item::getList(['where' => ['category_id', 0]]); |
|
| 512 | foreach ($zeroItems as $item) { |
|
| 513 | $map[] = [ |
|
| 514 | 'name' => $item->name, |
|
| 515 | 'url' => [ |
|
| 516 | 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref()) |
|
| 517 | ], |
|
| 518 | ]; |
|
| 519 | } |
|
| 520 | ||
| 521 | $categorys = \Ecommerce\Category::getList(['where' => ['parent_id', 0]]); |
|
| 522 | $scan = function($category, $scan) { |
|
| 523 | $map = []; |
|
| 524 | ||
| 525 | foreach ($category->items as $item) { |
|
| 526 | $map[] = [ |
|
| 527 | 'name' => $item->name, |
|
| 528 | 'url' => [ |
|
| 529 | 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref()) |
|
| 530 | ], |
|
| 531 | ]; |
|
| 532 | } |
|
| 533 | foreach ($category->catalogs as $child) { |
|
| 534 | $map = array_merge($map, $scan($child, $scan)); |
|
| 535 | } |
|
| 536 | return $map; |
|
| 537 | }; |
|
| 538 | foreach ($categorys as $category) { |
|
| 539 | $map = array_merge($map, $scan($category, $scan)); |
|
| 540 | } |
|
| 541 | return $map; |
|
| 542 | } |
|
| 543 | ||
| 544 | } |
|
| 545 | ||