| @@ 515-549 (lines=35) @@ | ||
| 512 | return $cart; |
|
| 513 | } |
|
| 514 | ||
| 515 | function sitemap() |
|
| 516 | { |
|
| 517 | $map = []; |
|
| 518 | $zeroItems = \Ecommerce\Item::getList(['where' => ['category_id', 0]]); |
|
| 519 | foreach ($zeroItems as $item) { |
|
| 520 | $map[] = [ |
|
| 521 | 'name' => $item->name, |
|
| 522 | 'url' => [ |
|
| 523 | 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref()) |
|
| 524 | ], |
|
| 525 | ]; |
|
| 526 | } |
|
| 527 | ||
| 528 | $categorys = \Ecommerce\Category::getList(['where' => ['parent_id', 0]]); |
|
| 529 | $scan = function($category, $scan) { |
|
| 530 | $map = []; |
|
| 531 | ||
| 532 | foreach ($category->items as $item) { |
|
| 533 | $map[] = [ |
|
| 534 | 'name' => $item->name, |
|
| 535 | 'url' => [ |
|
| 536 | 'loc' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . INJI_DOMAIN_NAME . ($item->getHref()) |
|
| 537 | ], |
|
| 538 | ]; |
|
| 539 | } |
|
| 540 | foreach ($category->catalogs as $child) { |
|
| 541 | $map = array_merge($map, $scan($child, $scan)); |
|
| 542 | } |
|
| 543 | return $map; |
|
| 544 | }; |
|
| 545 | foreach ($categorys as $category) { |
|
| 546 | $map = array_merge($map, $scan($category, $scan)); |
|
| 547 | } |
|
| 548 | return $map; |
|
| 549 | } |
|
| 550 | ||
| 551 | } |
|
| 552 | ||
| @@ 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 | ||