auto trim description in google product description

  • Posts: 71
  • Thank you received: 1
7 years 8 months ago #265215

-- HikaShop version -- : 3.6.1

Hey,

Is it possible to automatic trim the text from the description that goes to google shopping with the Hikashop Google Products Plugin? If there are more then 5000 characters the product are not imported.

If that is not possible how can I modify the plugin while keeping the update possibilities for the rest of hikashop?

Best regards,

RG

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 8 months ago #265217

Hello,

I'm afraid that HikaShop 3.6.1 is not a valid version number.
Without knowing your version number, we can't know what version of the plugin you have.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 71
  • Thank you received: 1
7 years 8 months ago #265270

oops HikaShop Business: 3.0.1

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 8 months ago #265278

Hi,

You'll have to modify the code of the plugin in the file plugins/hikashop/google_products/google_products.php and change the code:

if(!empty($product->product_description)){
					if(@$plugin->params['preview']){
						 $xml .= "\t".'<g:description><![CDATA[ '.strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$product->product_description)).' ]]></g:description>'."\n";
					}else{
						$xml .= "\t".'<g:description><![CDATA[ '.strip_tags($product->product_description).' ]]></g:description>'."\n";
					}
				}

to the code:
if(!empty($product->product_description)){
					if(@$plugin->params['preview']){
						 $xml .= "\t".'<g:description><![CDATA[ '.substr(strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$product->product_description)),0,5000).' ]]></g:description>'."\n";
					}else{
						$xml .= "\t".'<g:description><![CDATA[ '.substr(strip_tags($product->product_description),0,500).' ]]></g:description>'."\n";
					}
				}

Last edit: 7 years 8 months ago by nicolas.
The following user(s) said Thank You: RG

Please Log in or Create an account to join the conversation.

  • Posts: 71
  • Thank you received: 1
7 years 7 months ago #266022

Ok thanks I changed it. Will you also change this behavior in the plugin? Or do I need to change it with every update of hikashop?

Best regards,
RG

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 7 months ago #266043

Hi,

It will be added yes since that is a requirement of the API as per support.google.com/merchants/answer/7052112?hl=en

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum