Code Duplication    Length = 29-29 lines in 2 locations

application/modules/sitemap/sitemap.php 2 locations

@@ 541-569 (lines=29) @@
538
    /**
539
     * Get products brands
540
     */
541
    private function getShopBrands() {
542
543
        // Get Shop Brands
544
        $shop_brands = $this->sitemap_model->get_shop_brands();
545
546
        // Add Shop Brand to Site Map
547
        foreach ($shop_brands as $shopbr) {
548
549
            $localeSegment = $shopbr['locale'] == self::defaultLocale() ? '' : $shopbr['locale'] . '/';
550
551
            $url = site_url($localeSegment . 'shop/brand/' . $shopbr['url']);
552
            if ($this->not_blocked_url($localeSegment . 'shop/brand/' . $shopbr['url'])) {
553
                if (!$this->robotsCheck($url)) {
554
                    // create date
555
                    if ($shopbr['updated'] > 0) {
556
                        $date = date('Y-m-d', $shopbr['updated']);
557
                    } else {
558
                        $date = date('Y-m-d', $shopbr['created']);
559
                    }
560
                    $this->items[] = [
561
                        'loc' => $url,
562
                        'changefreq' => $this->brands_changefreq,
563
                        'priority' => $this->brands_priority,
564
                        'lastmod' => $date
565
                    ];
566
                }
567
            }
568
        }
569
    }
570
571
    /**
572
     * Get products
@@ 574-602 (lines=29) @@
571
    /**
572
     * Get products
573
     */
574
    private function getShopProducts() {
575
576
        // Get Shop products
577
        $shop_products = $this->sitemap_model->get_shop_products();
578
579
        // Add Shop products to Site Map
580
        foreach ($shop_products as $shopprod) {
581
            if ($this->sitemap_model->categoryIsActive($shopprod['category_id'])) {
582
583
                $localeSegment = $shopprod['locale'] == self::defaultLocale() ? '' : $shopprod['locale'] . '/';
584
                $url = site_url($localeSegment . 'shop/product/' . $shopprod['url']);
585
                if ($this->not_blocked_url($localeSegment . 'shop/product/' . $shopprod['url'])) {
586
                    if (!$this->robotsCheck($url)) {
587
                        if ($shopprod['updated'] > 0) {
588
                            $date = date('Y-m-d', $shopprod['updated']);
589
                        } else {
590
                            $date = date('Y-m-d', $shopprod['created']);
591
                        }
592
                        $this->items[] = [
593
                            'loc' => $url,
594
                            'changefreq' => $this->products_changefreq,
595
                            'priority' => $this->products_priority,
596
                            'lastmod' => $date
597
                        ];
598
                    }
599
                }
600
            }
601
        }
602
    }
603
604
    /**
605
     * Generate xml