config->get('feed_google_sitemap_fast_status')) { $time_start = microtime(true); $output = ''; $output .= ''; $this->load->model('tool/sitemap'); $products = $this->model_tool_sitemap->getProducts(); foreach($products as $product) { $output .= ''; $output .= '' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . ''; $output .= '' . $product['date'] . ''; $output .= 'weekly'; $output .= '1.0'; $output .= ''; } $this->categories = $this->model_tool_sitemap->getAllCategories(); $output .= $this->getAllCategories(0); $manufacturers = $this->model_tool_sitemap->getManufacturers(); foreach($manufacturers as $manufacturer) { $output .= ''; $output .= '' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']))) . ''; $output .= 'weekly'; $output .= '0.7'; $output .= ''; } $informations = $this->model_tool_sitemap->getInformations(); foreach($informations as $information) { $output .= ''; $output .= '' . str_replace('&', '&', str_replace('&', '&', $this->url->link('information/information', 'information_id=' . $information['information_id']))) . ''; $output .= 'weekly'; $output .= '0.5'; $output .= ''; } $output .= ''; $this->log->write(sprintf("Fast Sitemap Execution Time: %05.5f", (microtime(true) - $time_start))); $this->response->addHeader('Content-Type: application/xml'); $this->response->setOutput($output); } } protected function getAllCategories($parent_id = 0, $current_path = '') { $output = ''; if(array_key_exists($parent_id, $this->categories)) { $results = $this->categories[$parent_id]; foreach($results as $result) { if(!$current_path) { $new_path = $result['category_id']; } else { $new_path = $current_path . '_' . $result['category_id']; } $output .= ''; $output .= '' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/category', 'path=' . $new_path))) . ''; $output .= '' . $result['date'] . ''; $output .= 'weekly'; $output .= '0.7'; $output .= ''; if(!$current_path) { $new_path = $result['category_id']; } else { $new_path = $current_path . '_' . $result['category_id']; } $children = ''; if(array_key_exists($result['category_id'], $this->categories)) { $children = $this->getAllCategories($result['category_id'], $new_path); } $output .= $children; } } return $output; } } ?>