Post by barnettgs » Mon Aug 22, 2022 11:45 pm

Hello, I haven't used Google product feeds for few years until just now when I decided to get it fixed.

I have just managed to get the feed working but all products are displaying incorrect image url - it goes like that, without the base url and http (without the 's')

Code: Select all

http://image/cache/catalog/product/Greetings/xmascard-500x500.jpg
What is the cause for this? I have double-checked everything but could not find anything wrong? A suggestion would be appreciated!

EDITED: Forgot to mention that you can see /cache/ so could vqcache vqmod be an issue? I couldn't find any information related to vqcache.

New member

Posts

Joined
Thu Sep 16, 2010 3:01 am

Post by ADD Creative » Tue Aug 23, 2022 4:04 am

What version of OpenCart and PHP? Check for errors in both your OpenCart and PHP error logs.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by barnettgs » Tue Aug 23, 2022 4:22 pm

ADD Creative wrote:
Tue Aug 23, 2022 4:04 am
What version of OpenCart and PHP? Check for errors in both your OpenCart and PHP error logs.
It is 2.2.0.0 and the PHP version is 7.4

The only error log I got this via admin section of opencart, I do not see any in FTP client:

Code: Select all

2022-08-18 23:59:34 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 174
2022-08-18 23:59:34 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 349
2022-08-18 23:59:34 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 349
2022-08-18 23:59:34 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 349
2022-08-18 23:59:34 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 357
2022-08-18 23:59:34 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 361
2022-08-21 5:28:54 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 174
2022-08-21 5:28:54 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 349
2022-08-21 5:28:54 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 349
2022-08-21 5:28:54 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 349
2022-08-21 5:28:54 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 357
2022-08-21 5:28:54 - PHP Warning:  A non-numeric value encountered in /public_html/shop/catalog/controller/product/category.php on line 361
The shop is working fine as normally but the only issue is incorrect image url at Google Merchant Center - without the base url. I had removed the old feed and set up new feed, putting in google base url from opencart.

New member

Posts

Joined
Thu Sep 16, 2010 3:01 am

Post by ADD Creative » Tue Aug 23, 2022 6:08 pm

Check your config.php has all the correct URLs set. Check the multi-store config if using a multi-store.

Check the catalog/controller/feed/google_base.php file for any modifications, OCMOD, vQmod, etc.

Check the catalog/model/tool/image.php file for any modifications, OCMOD, vQmod, etc.

Make sure you request the https version of your feed and check the URLs in the XML data.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by barnettgs » Tue Aug 23, 2022 8:05 pm

ADD Creative wrote:
Tue Aug 23, 2022 6:08 pm
Check your config.php has all the correct URLs set. Check the multi-store config if using a multi-store.

Check the catalog/controller/feed/google_base.php file for any modifications, OCMOD, vQmod, etc.

Check the catalog/model/tool/image.php file for any modifications, OCMOD, vQmod, etc.

Make sure you request the https version of your feed and check the URLs in the XML data.
All set to correct URLS and it is a single store.

No modifications on google_base file. However, just opened the image.php file and here it is:

Code: Select all

<?php
class ModelToolImage extends Model {
	public function resize($filename, $width, $height) {
		if (!is_file(DIR_IMAGE . $filename)) {
			return;
		}

		$extension = pathinfo($filename, PATHINFO_EXTENSION);

		$old_image = $filename;
		$new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;

		if (!is_file(DIR_IMAGE . $new_image) || (filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image))) {
			$path = '';

			$directories = explode('/', dirname(str_replace('../', '', $new_image)));

			foreach ($directories as $directory) {
				$path = $path . '/' . $directory;

				if (!is_dir(DIR_IMAGE . $path)) {
					@mkdir(DIR_IMAGE . $path, 0777);
				}
			}

			list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);

			if ($width_orig != $width || $height_orig != $height) {
				$image = new Image(DIR_IMAGE . $old_image);
				$image->resize($width, $height);
				$image->save(DIR_IMAGE . $new_image);
			} else {
				copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
			}
		}

		if ($this->request->server['HTTPS']) {
			return $this->config->get('config_ssl') . 'image/' . $new_image;
		} else {
			return $this->config->get('config_url') . 'image/' . $new_image;
		}
	}
}
So I think the last few lines of code needs to be updated, to add base url? Because in the source code from the shop, all images start with url: 'image/cache/....' without the base url.

New member

Posts

Joined
Thu Sep 16, 2010 3:01 am

Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by barnettgs » Wed Aug 24, 2022 4:22 pm

Thanks, the image urls are now showing full urls! So that did the job.

However, the feed for google merchant center is still showing images without the base url and non-secure http. I guess that is down to google_base.php file?

Flushed out the cache etc

EDITED: The feed is now working! I had to select 'fetch' rather than re-process! Many thanks for your help! :)

New member

Posts

Joined
Thu Sep 16, 2010 3:01 am

Post by barnettgs » Wed Aug 24, 2022 4:55 pm

Well I spoke too early! The image url warnings disappeared when I re-processed the feed after fetching and I thought that was it.

However, under All Products - still showing missing images and http://images... . I'm not sure what it is even though the warnings disappeared.

New member

Posts

Joined
Thu Sep 16, 2010 3:01 am

Post by barnettgs » Wed Aug 24, 2022 5:58 pm

Removing the feed and then re-create new feed seemed to have solved this problem so all is good now! ;)

New member

Posts

Joined
Thu Sep 16, 2010 3:01 am
Who is online

Users browsing this forum: No registered users and 43 guests