Post by worldi2002 » Wed Apr 16, 2025 6:08 pm

Hello Everyone here

My XML Sitemap when i try to submit on google seach console i got error Invalid tag value: <lastmod> below is my sitemap link Version 3.0.3.8 need urgently help
https://www.gatesautomatic.com/sitemap.xml

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by nonnedelectari » Wed Apr 16, 2025 6:13 pm

worldi2002 wrote:
Wed Apr 16, 2025 6:08 pm
Hello Everyone here

My XML Sitemap when i try to submit on google seach console i got error Invalid tag value: <lastmod> below is my sitemap link Version 3.0.3.8 need urgently help
https://www.gatesautomatic.com/sitemap.xml

Code: Select all

<lastmod>-0001-11-30T00:00:00+03:41</lastmod>
yes, that is wrong.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by JNeuhoff » Wed Apr 16, 2025 7:37 pm

It should be something like this:

Code: Select all

<lastmod>2024-11-15T12:23:00+00:00</lastmod>
Check that this file isn't modified or corrupted: catalog/controller/information/sitemap.php

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by worldi2002 » Wed Apr 16, 2025 9:20 pm

<?php
class ControllerInformationSitemap extends Controller {
public function index() {
$this->load->language('information/sitemap');

$this->document->setTitle($this->language->get('heading_title'));

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home')
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('information/sitemap')
);

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

$data['categories'] = array();

$categories_1 = $this->model_catalog_category->getCategories(0);

foreach ($categories_1 as $category_1) {
$level_2_data = array();

$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);

foreach ($categories_2 as $category_2) {
$level_3_data = array();

$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);

foreach ($categories_3 as $category_3) {
$level_3_data[] = array(
'name' => $category_3['name'],
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}

$level_2_data[] = array(
'name' => $category_2['name'],
'children' => $level_3_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
);
}

$data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}

$data['special'] = $this->url->link('product/special');
$data['account'] = $this->url->link('account/account', '', true);
$data['edit'] = $this->url->link('account/edit', '', true);
$data['password'] = $this->url->link('account/password', '', true);
$data['address'] = $this->url->link('account/address', '', true);
$data['history'] = $this->url->link('account/order', '', true);
$data['download'] = $this->url->link('account/download', '', true);
$data['cart'] = $this->url->link('checkout/cart');
$data['checkout'] = $this->url->link('checkout/checkout', '', true);
$data['search'] = $this->url->link('product/search');
$data['contact'] = $this->url->link('information/contact');

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

$data['informations'] = array();

foreach ($this->model_catalog_information->getInformations() as $result) {
$data['informations'][] = array(
'title' => $result['title'],
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
);
}

$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');

$this->response->setOutput($this->load->view('information/sitemap', $data));
}
}



above is sitemap file can you check all is ok or anyone i will give admin access to correct it for me please

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by worldi2002 » Wed Apr 16, 2025 9:26 pm

worldi2002 wrote:
Wed Apr 16, 2025 6:08 pm
Hello Everyone here

My XML Sitemap when i try to submit on google seach console i got error Invalid tag value: <lastmod> below is my sitemap link Version 3.0.3.8 need urgently help
https://www.gatesautomatic.com/sitemap.xml
Hi can i give you my admin access can you fix this issue for me please

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by worldi2002 » Wed Apr 16, 2025 9:27 pm

JNeuhoff wrote:
Wed Apr 16, 2025 7:37 pm
It should be something like this:

Code: Select all

<lastmod>2024-11-15T12:23:00+00:00</lastmod>
Check that this file isn't modified or corrupted: catalog/controller/information/sitemap.php
can i give you admin access can you fix this problem for me please

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by worldi2002 » Wed Apr 16, 2025 9:30 pm

JNeuhoff wrote:
Wed Apr 16, 2025 7:37 pm
It should be something like this:

Code: Select all

<lastmod>2024-11-15T12:23:00+00:00</lastmod>
Check that this file isn't modified or corrupted: catalog/controller/information/sitemap.php
Hello sir waiting for your reply

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by worldi2002 » Wed Apr 16, 2025 10:33 pm

if anybody can do it let me know please i will pay some charges for this job thanks

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by by mona » Wed Apr 16, 2025 10:47 pm

Has anyone come back to you?
Check your private messages

That is the wrong sitemap - that produces a human friendly one
catalog/controller/extension/feed/google_sitemap.php

Code: Select all

<?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) {
				$output .= '<url>';
				$output .= '  <loc>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</loc>';
				$output .= '  <changefreq>weekly</changefreq>';
				$output .= '  <lastmod>' . date('Y-m-d\TH:i:sP', strtotime($product['date_modified'])) . '</lastmod>';
				$output .= '  <priority>1.0</priority>';

				if ($product['image']) {
					$output .= '  <image:image>';
					$output .= '  <image:loc>' . $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')) . '</image:loc>';
					$output .= '  <image:caption>' . $product['name'] . '</image:caption>';
					$output .= '  <image:title>' . $product['name'] . '</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>' . $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']) . '</loc>';
				$output .= '  <changefreq>weekly</changefreq>';
				$output .= '  <priority>0.7</priority>';
				$output .= '</url>';
			}

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

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

			foreach ($informations as $information) {
				$output .= '<url>';
				$output .= '  <loc>' . $this->url->link('information/information', 'information_id=' . $information['information_id']) . '</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) {
		$output = '';

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

		foreach ($results as $result) {
			$output .= '<url>';
			$output .= '  <loc>' . $this->url->link('product/category', 'path=' . $result['category_id']) . '</loc>';
			$output .= '  <changefreq>weekly</changefreq>';
			$output .= '  <priority>0.7</priority>';
			$output .= '</url>';

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

		return $output;
	}
}

Attachments

OC 3.0.3.8 : catalog/controller/extension/feed/google_sitemap.php


DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by by mona » Wed Apr 16, 2025 10:58 pm

Looks to me like there is an issue with your date formatting.
Check your database and time zones both in Opencart Settings and in the database - possibly your database became corrupted?

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by khnaz35 » Thu Apr 17, 2025 12:20 am

You could do something like this

Code: Select all

<lastmod>' . date('c', strtotime($product['date_modified'])) . '</lastmod>
for example

Code: Select all

foreach ($products as $product) {
    $output .= '<url>';
    $output .= '<loc>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</loc>';
    $output .= '<lastmod>' . date('c', strtotime($product['date_modified'])) . '</lastmod>';
    $output .= '<changefreq>weekly</changefreq>';
    $output .= '<priority>1.0</priority>';
    $output .= '</url>';
}

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by worldi2002 » Thu Apr 17, 2025 2:40 pm

khnaz35 wrote:
Thu Apr 17, 2025 12:20 am
You could do something like this

Code: Select all

<lastmod>' . date('c', strtotime($product['date_modified'])) . '</lastmod>
for example

Code: Select all

foreach ($products as $product) {
    $output .= '<url>';
    $output .= '<loc>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</loc>';
    $output .= '<lastmod>' . date('c', strtotime($product['date_modified'])) . '</lastmod>';
    $output .= '<changefreq>weekly</changefreq>';
    $output .= '<priority>1.0</priority>';
    $output .= '</url>';
}
Not yet still the same i need urgent helf someone i will give them access they will do it directly

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by worldi2002 » Thu Apr 17, 2025 3:10 pm

by mona wrote:
Wed Apr 16, 2025 10:47 pm
Has anyone come back to you?
Check your private messages

That is the wrong sitemap - that produces a human friendly one
catalog/controller/extension/feed/google_sitemap.php

Code: Select all

<?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) {
				$output .= '<url>';
				$output .= '  <loc>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</loc>';
				$output .= '  <changefreq>weekly</changefreq>';
				$output .= '  <lastmod>' . date('Y-m-d\TH:i:sP', strtotime($product['date_modified'])) . '</lastmod>';
				$output .= '  <priority>1.0</priority>';

				if ($product['image']) {
					$output .= '  <image:image>';
					$output .= '  <image:loc>' . $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')) . '</image:loc>';
					$output .= '  <image:caption>' . $product['name'] . '</image:caption>';
					$output .= '  <image:title>' . $product['name'] . '</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>' . $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']) . '</loc>';
				$output .= '  <changefreq>weekly</changefreq>';
				$output .= '  <priority>0.7</priority>';
				$output .= '</url>';
			}

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

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

			foreach ($informations as $information) {
				$output .= '<url>';
				$output .= '  <loc>' . $this->url->link('information/information', 'information_id=' . $information['information_id']) . '</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) {
		$output = '';

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

		foreach ($results as $result) {
			$output .= '<url>';
			$output .= '  <loc>' . $this->url->link('product/category', 'path=' . $result['category_id']) . '</loc>';
			$output .= '  <changefreq>weekly</changefreq>';
			$output .= '  <priority>0.7</priority>';
			$output .= '</url>';

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

		return $output;
	}
}
I need someone to do it for me direclty i dont understand it.

Newbie

Posts

Joined
Sat Jul 29, 2017 7:36 pm

Post by by mona » Thu Apr 17, 2025 4:17 pm

If you have access to ftp you can check if your file at the location
catalog/controller/extension/feed/google_sitemap.php

is the same as the original file (as per download above and post) at the location
catalog/controller/extension/feed/google_sitemap.php

Your theme or SEO module may change it so again
you can go to the file
LOCATION OF MODIFICATION FOLDER => modifications/catalog/controller/extension/feed/google_sitemap.php
and check that it has not been edited.

Ftp details would be required for a developer to check

Since it is possible the issue is in your database
Database access would also be required.

Again you can check if that is correct by going to your database and checking the product table in the column DATE_MODIFIED

You can also post in the commercial section viewforum.php?f=88
Last edited by by mona on Thu Apr 17, 2025 4:18 pm, edited 1 time in total.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by khnaz35 » Thu Apr 17, 2025 4:18 pm

Hi Drop me email happy to take on it.

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by paulfeakins » Tue Apr 22, 2025 7:27 pm

khnaz35 wrote:
Thu Apr 17, 2025 4:18 pm
Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*
If you try to fail, but end up succeeding, which did you actually do?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: khnaz35, paulfeakins and 66 guests