Post by straightlight » Fri Jul 29, 2016 11:55 pm

lfairban wrote:Thank you so much for your help.

Reverting back to original and swapping out the application for text did not get rid of the error.
According to this documentation, ® is not a recognized character in the table in order to be escaped from the regular expression: https://support.google.com/webmasters/answer/183668

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by lfairban » Sat Jul 30, 2016 12:03 am

Code: Select all

					$output .= '<image:caption>' . $product['name'] . '</image:caption>';
					$output .= '<image:title>' . $product['name'] . '</image:title>';
These two probably need to be changed too.

User avatar
New member

Posts

Joined
Fri Feb 28, 2014 5:01 am

Post by lfairban » Sat Jul 30, 2016 12:08 am

I commented out those two lines and finally got my sitemap.xml...

What should I change to make the "name" data acceptable?

User avatar
New member

Posts

Joined
Fri Feb 28, 2014 5:01 am

Post by straightlight » Sat Jul 30, 2016 12:15 am

Found on this topic is a fact that XML should rather be generated from tools rather than manually build a string: http://stackoverflow.com/questions/2570 ... e-xml-file .

However, by following the instructions from this page: https://www.google.com/schemas/sitemap-image/1.1 , the following:

Code: Select all

$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
should be replaced with:

Code: Select all

$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="https://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd">';
after reverting changes. Although, this portion cannot be accurately tested due to RFC compliance and IE outputting different results than other browsers.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Sat Jul 30, 2016 12:47 am

The last solution, according to above Google link sent regarding the RFC compliance with html special characters would be this modification:

Code: Select all

<?php
class ControllerExtensionFeedGoogleSitemap extends Controller {
	public function index() {
		if ($this->config->get('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><![CDATA[' . htmlspecialchars($this->url->link('product/product', 'product_id=' . $product['product_id']), ENT_QUOTES, 'UTF-8', true) . ']]></loc>';
					$output .= '<changefreq><![CDATA[weekly]]></changefreq>';
					$output .= '<lastmod><![CDATA[' . date('Y-m-d\TH:i:sP', strtotime($product['date_modified'])) . ']]></lastmod>';
					$output .= '<priority><![CDATA[1.0]]></priority>';
					$output .= '<image:image>';
					$output .= '<image:loc><![CDATA[' . $this->model_tool_image->resize($product['image'], $this->config->get($this->config->get('config_theme') . '_image_popup_width'), $this->config->get($this->config->get('config_theme') . '_image_popup_height')) . ']]></image:loc>';
					$output .= '<image:caption><![CDATA[' . htmlspecialchars($product['name'], ENT_QUOTES, 'UTF-8', true) . ']]></image:caption>';
					$output .= '<image:title><![CDATA[' . htmlspecialchars($product['name'], ENT_QUOTES, 'UTF-8', true) . ']]></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><![CDATA[' . htmlspecialchars($this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']), ENT_QUOTES, 'UTF-8', true) . ']]></loc>';
				$output .= '<changefreq><![CDATA[weekly]]></changefreq>';
				$output .= '<priority><![CDATA[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><![CDATA[' . htmlspecialchars($this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']), ENT_QUOTES, 'UTF-8', true) . ']]></loc>';
					$output .= '<changefreq><![CDATA[weekly]]></changefreq>';
					$output .= '<priority><![CDATA[1.0]]></priority>';
					$output .= '</url>';
				}
			}

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

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

			foreach ($informations as $information) {
				$output .= '<url>';
				$output .= '<loc>><![CDATA[' . htmlspecialchars($this->url->link('information/information', 'information_id=' . $information['information_id']), ENT_QUOTES, 'UTF-8', true) . ']]></loc>';
				$output .= '<changefreq><![CDATA[weekly]]></changefreq>';
				$output .= '<priority><![CDATA[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><![CDATA[' . htmlspecialchars($this->url->link('product/category', 'path=' . $new_path), ENT_QUOTES, 'UTF-8', true) . ']]></loc>';
			$output .= '<changefreq><![CDATA[weekly]]></changefreq>';
			$output .= '<priority><![CDATA[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><![CDATA[' . htmlspecialchars($this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']), ENT_QUOTES, 'UTF-8', true) . ']]></loc>';
				$output .= '<changefreq><![CDATA[weekly]]></changefreq>';
				$output .= '<priority><![CDATA[1.0]]></priority>';
				$output .= '</url>';
			}

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

		return $output;
	}
}
If none of those solutions above provides a result, then extensions would be considered in this case if no other solutions can be provided.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by lfairban » Thu Aug 04, 2016 12:07 am

Was this last solution a replacement of the entire Google feed code?

User avatar
New member

Posts

Joined
Fri Feb 28, 2014 5:01 am

Post by straightlight » Thu Aug 04, 2016 1:40 am

lfairban wrote:Was this last solution a replacement of the entire Google feed code?
Yes, the entire file.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by uksitebuilder » Thu Aug 04, 2016 3:59 pm

Easier to wrap the text content inside the tags in <![CDATA[ and ]]> tags

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by straightlight » Thu Aug 04, 2016 7:24 pm

uksitebuilder wrote:Easier to wrap the text content inside the tags in <![CDATA[ and ]]> tags
An interesting theory. Although, it seem that both answers, mine and the CDATA parsing would be incomplete solution according to this page on Stackoverflow: http://stackoverflow.com/questions/1282 ... s-vs-cdata .

I will make the change above and see if that fixes the issue officially.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Thu Aug 04, 2016 7:34 pm

Code edited on the above to match CDATA and HTML special chars.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by lfairban » Mon Aug 15, 2016 9:25 pm

Thanks,

Getting error on the page: class 'Controllerfeedgooglesitemap' not found ... line 43

Should it be "ControllerFeedGoogleSitemap" instead?

User avatar
New member

Posts

Joined
Fri Feb 28, 2014 5:01 am

Post by david.morrison » Fri Feb 24, 2017 5:47 pm

Hi All,

I am experiencing two issues with my search on my storefront.

I have product codes (Models) containing forward slash, hyphen and full stop (period). If I enter AQST52/13 for example...the search results displays the correct product at the top of the search results. However, the results also display any other product with "/13".

Ideally, I would like that when the user inputs a product code, then only that product will display as a result or if the user enters "AQST" then all products with that attribute are displayed. I believe the issue is with the values after the forward slash, hyphen or full stop.

The other problem I have is that if the user enters the product code in the incorrect case...then the product is not being listed as the first result but is instead being displayed further down the page.

Other than that, if a user searches by product name the search works well...but in the industry product codes are key.

To recap:

1.I would like case sensitivity turned off in relation to search by model

2.I require assistance in relation to product codes containing /,- and .

Please help....


Posts

Joined
Fri Feb 24, 2017 5:42 pm
Who is online

Users browsing this forum: No registered users and 33 guests