Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Leaderboard

Popular Content

Showing content with the highest reputation on 09/05/2025 in Posts

  1. Зробив за допомогою цього модулю і "вайбкодингу" супершвидку і здається не погану Sitemap, кому треба, можете брати/доробляти і т.д., до речі, було б не погано мати карту сайту "з коробки" =) // headerXML $xml = '<?xml version="1.0" encoding="UTF-8"?>'; $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $xml = $this->unixml->exportToXml($startup, $xml, "start"); // headerXML // головна сторінка $xml .= '<url>'; $xml .= '<loc>' . htmlspecialchars($this->config->get('config_url')) . '</loc>'; $xml .= '<changefreq>daily</changefreq>'; $xml .= '<priority>1.0</priority>'; $xml .= '</url>'; // ====== Категорії з підкатегоріями ====== $this->load->model('catalog/category'); function addCategoryUrls($parent_id, $path, $model, &$xml, $url, $self) { $categories = $model->getCategories($parent_id); foreach ($categories as $category) { $new_path = $path ? $path . '_' . $category['category_id'] : $category['category_id']; $xml .= '<url>'; $xml .= '<loc>' . $url->link('product/category', 'path=' . $new_path) . '</loc>'; if (!empty($category['date_modified'])) { $xml .= '<lastmod>' . date('c', strtotime($category['date_modified'])) . '</lastmod>'; } $xml .= '<changefreq>weekly</changefreq>'; $xml .= '<priority>0.8</priority>'; $xml .= '</url>'; // рекурсія для підкатегорій addCategoryUrls($category['category_id'], $new_path, $model, $xml, $url, $self); } } addCategoryUrls(0, '', $this->model_catalog_category, $xml, $this->url, $this); // ====== /Категорії ====== // Виробники $this->load->model('catalog/manufacturer'); $manufacturers = $this->model_catalog_manufacturer->getManufacturers(); foreach ($manufacturers as $manufacturer) { $xml .= '<url>'; $xml .= '<loc>' . $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']) . '</loc>'; $xml .= '<changefreq>monthly</changefreq>'; $xml .= '<priority>0.5</priority>'; $xml .= '</url>'; } // Інформаційні сторінки $this->load->model('catalog/information'); $informations = $this->model_catalog_information->getInformations(); foreach ($informations as $information) { $xml .= '<url>'; $xml .= '<loc>' . $this->url->link('information/information', 'information_id=' . $information['information_id']) . '</loc>'; $xml .= '<changefreq>monthly</changefreq>'; $xml .= '<priority>0.5</priority>'; $xml .= '</url>'; } // Контакти $xml .= '<url>'; $xml .= '<loc>' . $this->url->link('information/contact') . '</loc>'; $xml .= '<changefreq>monthly</changefreq>'; $xml .= '<priority>0.5</priority>'; $xml .= '</url>'; // ====== Товари ====== for ($startup['iteration'] = 0; 1; $startup['iteration']++) { $controller_data = $this->load->controller($controller, $startup); $startup['stat'] = $controller_data['data']['stat']; if ($controller_data['products']) { foreach ($controller_data['products'] as $product_id => $product) { $xml .= '<url>'; $xml .= '<loc>' . $product['url'] . '</loc>'; if (!empty($product['date_modified'])) { $xml .= '<lastmod>' . date('c', strtotime($product['date_modified'])) . '</lastmod>'; } $xml .= '<changefreq>weekly</changefreq>'; $xml .= '<priority>0.7</priority>'; $xml .= '</url>'; } } else { break; } $xml = $this->unixml->exportToXml($controller_data['data'], $xml); } // ====== /Товари ====== // footerXML $xml .= '</urlset>'; $this->unixml->exportToXml($controller_data['data'], $xml, "finish"); // footerXML
    1 point
Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.