Page 1 of 1

Sitemap error

Posted: Fri Aug 25, 2017 9:39 pm
by hardy5215
Hey Everyone.

Opencart 2.0.3.0
I am getting an error when trying any of the links below

gameskeysaustralia.com/sitemap.xml
https://gameskeysaustralia.com/index.ph ... le_sitemap

Error is

Warning: mysqli::query(): (21000/1242): Subquery returns more than 1 row in /home/gameskey/public_html/system/library/db/mysqli.php on line 18

Any one know how I will be able to fix this?

TIA

Re: Sitemap error

Posted: Mon Aug 28, 2017 2:05 am
by rjcalifornia
Is that a third party mod? If so, you need to either ask the developer or use another mod

Re: Sitemap error

Posted: Mon Aug 28, 2017 6:53 pm
by webcorvo
The problem is the module google site map

Re: Sitemap error

Posted: Wed Aug 30, 2017 10:17 am
by rjcalifornia
It might not be compatible with your OpenCart version (3.0)

Contact the developer of the mod

Re: Sitemap error

Posted: Wed Sep 27, 2017 8:04 pm
by dadams
Guys sorry I am new here and could not find an option to start a new subject. Wonder if someone can help me to remove google map on my home page at the bottom ("Contact Us") please.

Re: Sitemap error

Posted: Thu Sep 28, 2017 7:12 pm
by straightlight
In your catalog/view/theme/your_theme/template/common/footer.twig file,

find:

Code: Select all

<li><a href="{{ sitemap }}">{{ text_sitemap }}</a></li>
either comment with:

Code: Select all

<!--<li><a href="{{ sitemap }}">{{ text_sitemap }}</a></li>-->
or remove the line.

Re: Sitemap error

Posted: Sun Aug 05, 2018 4:25 am
by straightlight
See this solution: https://github.com/opencart/opencart/pu ... e007255b4b . Then, apply these steps before noticing the results on the google sitemap page: viewtopic.php?f=176&p=731004#p718325

Re: Sitemap error

Posted: Sun Aug 05, 2018 6:01 pm
by leeburgess
Sadly still the same.

This page contains the following errors:
error on line 1 at column 14: Extra content at the end of the document
Below is a rendering of the page up to the first error.
Notice

Re: Sitemap error

Posted: Sun Aug 05, 2018 6:02 pm
by leeburgess
<?php
class ControllerExtensionFeedGoogleSitemap extends Controller {
public function index() {
if ($this->config->get('feed_google_sitemap_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';

$this->load->model('catalog/product');
$this->load->model('tool/image');

$products = $this->model_catalog_product->getProducts();

foreach ($products as $product) {
if ($product['image']) {
$output .= '<url>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&product_id=' . $product['product_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <lastmod>' . date('Y-m-d\TH:i:sP', strtotime($product['date_modified'])) . '</lastmod>';
$output .= ' <priority>1.0</priority>';
$output .= ' <image:image>';
$output .= ' <image:loc>' . htmlspecialchars($this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')), ENT_COMPAT | ENT_XML1) . '</image:loc>';
$output .= ' <image:caption>' . htmlspecialchars($product['name'], ENT_COMPAT | ENT_XML1) . '</image:caption>';
$output .= ' <image:title>' . htmlspecialchars($product['name'], ENT_COMPAT | ENT_XML1) . '</image:title>';
$output .= ' </image:image>';
$output .= '</url>';
}
}

$this->load->model('catalog/category');

$output .= $this->getCategories(0);

$this->load->model('catalog/manufacturer');

$manufacturers = $this->model_catalog_manufacturer->getManufacturers();

foreach ($manufacturers as $manufacturer) {
$output .= '<url>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/manufacturer/info', 'language=' . $this->config->get('config_language') . '&manufacturer_id=' . $manufacturer['manufacturer_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.7</priority>';
$output .= '</url>';

$products = $this->model_catalog_product->getProducts(array('filter_manufacturer_id' => $manufacturer['manufacturer_id']));

foreach ($products as $product) {
$output .= '<url>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>1.0</priority>';
$output .= '</url>';
}
}

$this->load->model('catalog/information');

$informations = $this->model_catalog_information->getInformations();

foreach ($informations as $information) {
$output .= '<url>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('information/information', 'language=' . $this->config->get('config_language') . '&information_id=' . $information['information_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.5</priority>';
$output .= '</url>';
}

$output .= '</urlset>';

$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($output);
}
}

protected function getCategories($parent_id, $current_path = '') {
$output = '';

$results = $this->model_catalog_category->getCategories($parent_id);

foreach ($results as $result) {
if (!$current_path) {
$new_path = $result['category_id'];
} else {
$new_path = $current_path . '_' . $result['category_id'];
}

$output .= '<url>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/category', 'language=' . $this->config->get('config_language') . '&path=' . $new_path), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.7</priority>';
$output .= '</url>';

$products = $this->model_catalog_product->getProducts(array('filter_category_id' => $result['category_id']));

foreach ($products as $product) {
$output .= '<url>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&path=' . $new_path . '&product_id=' . $product['product_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>1.0</priority>';
$output .= '</url>';
}

$output .= $this->getCategories($result['category_id'], $new_path);
}

return $output;
}
}

Re: Sitemap error

Posted: Sun Aug 05, 2018 8:50 pm
by straightlight
Did you cleared the cache as mentioned on my previous post? If so, please provide the error / server access logs.

Re: Sitemap error

Posted: Mon Aug 06, 2018 1:09 am
by leeburgess
I did :) error says
This page contains the following errors:
error on line 1 at column 14: Extra content at the end of the document
Below is a rendering of the page up to the first error.
Notice
straightlight wrote:
Sun Aug 05, 2018 8:50 pm
Did you cleared the cache as mentioned on my previous post? If so, please provide the error / server access logs.

Re: Sitemap error

Posted: Mon Aug 06, 2018 1:19 am
by straightlight
Solution provided here: viewtopic.php?f=202&t=206176#p731152 . There is no need to double-post the same issue on different topics which this strategy is not excluded from the forum rules.