Page 1 of 1

[Solved] Asign second image of product to google_base image

Posted: Tue Mar 04, 2014 3:43 am
by Zarco
Hello !

I'm triying to do something but I can't... I hope somebody can help me !!

I've recibed an e-mail from Google where they tell me that the images I'm sending in the feed for Google Merchant Center, are inapropiated images...??? I call to Google support service and they tell me that they are wrong becouse I'm including the Product Brand in the image of the product and this is not allowed in google contitions policy.

I do not want to change this... becouse I want people in my shop can identify easy the brand of each of the products... but I also want to continue appearing in google shopping, becouse is a good deal, so the option I have thinked is to asign to the google feed, the second image of the product, and use the same image, totaly clean, without any brands, or marketing text...

I've been looking the file "google_base.php" and I think the code I have to modify is the following:

Code: Select all

   if ($product['image']) {
                      $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>';
Only need to know how to modify it... jajajaja... :laugh: please, anyone can help me !!!

Tanks a lot !!

Re: Asign the second image of the product to google_base ima

Posted: Tue Mar 04, 2014 4:05 am
by jgsw
Hellp Zarco,

you could try adding this before the code that you posted ...

Code: Select all

$additionalimages = $this->model_catalog_product->getProductImages($this->request->get[$product['product_id']]);

if (isset($additionalimages[0])) {
	$product['image'] = $additionalimages[0];
}
It's untested but is should be allong the right lines.

jgsw

Re: Asign the second image of the product to google_base ima

Posted: Fri Mar 07, 2014 3:13 am
by Zarco
Many thanks jgsw !!

I've tried it but I'm afraid it doesn't work... Still appear the normal image to google shoopping products, not the second image as I want !!

Any idea what could be wrong ??

Thanks

Re: Asign the second image of the product to google_base ima

Posted: Tue Mar 11, 2014 7:58 pm
by jgsw
Hi Zarco, It could e that google has cached your images. If you manually browse to your feed url are the file paths to the 2nd image?

jgsw

Re: Asign the second image of the product to google_base ima

Posted: Tue Mar 11, 2014 9:24 pm
by Zarco
Hi jgsw !

No ... it still appear the main image... and if I change the main image, it really changes in the google feed, so I supose it still assign the main image istead of the second.

Thanks

Re: Asign the second image of the product to google_base ima

Posted: Tue Mar 11, 2014 11:03 pm
by jgsw
Zarco,

this is what you need, tested and working :)

Code: Select all

			$additionalImages = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
			
			if (isset($additionalImages[0]['image'])) {
				$product['image'] = $additionalImages[0]['image'];		
			}
paste it before

Code: Select all

			if ($product['image']) {
jgsw

Re: Asign the second image of the product to google_base ima

Posted: Tue Mar 11, 2014 11:56 pm
by Zarco
I'm really sorry... but still doesn't work for me !
I changed the code and tried but the images do not change...
I try to change the main image to test, and it changes... so still is assigned the main image.

I think I should be doing something wrong !
The file I have modified is "catalog/controller/feed/google_base.php "
Is right ??
And I'm using Version 1.4.9.5 of opencart.

Thank you soo much for all your effort !

Re: Asign the second image of the product to google_base ima

Posted: Wed Mar 12, 2014 1:11 am
by jgsw
How about this Zarco...

Code: Select all

$additionalImages = $this->model_catalog_product->getProductImages($product['product_id']);
         
if (isset($additionalImages[0]['image'])) {
   $product['image'] = $additionalImages[0]['image'];      
}
jgsw

Re: Asign the second image of the product to google_base ima

Posted: Wed Mar 12, 2014 3:01 am
by Zarco
Yeeessss !!!

Is working good know !!

Soo many thanks jgsw... I've no words to thanks your help !!!!

Great job

Re: [Solved] Asign second image of product to google_base im

Posted: Wed Mar 12, 2014 4:22 am
by jgsw
No problem man! good luck with google base...

jgsw