facebook issue

  • Posts: 103
  • Thank you received: 2
11 years 10 months ago #86201

I dont know if this is a bug, but is happening in all the hikashop sites. When i make click to the facebook button like, and when i see how it looks in facebook, the name of the product is correct, but the image isnt (it takes what ever random image of the site), and the description of the product doesnt show: "No hay descripcion para este producto" that means, "there is not description of this product" and it repeats 3 or 4 times.

First, i thought that it was a facebook problem, so, i followed the facebook developer instructions and i solved the part of the image. But i have been working on fix the description issue for days, and i cant find the solution.

This is weird, because i remember that the like button worked perfectly at the beggining, in all my sites, and suddenly, one day, everything was wrong. I kind a think that this has something to do with the new hikashop version, but i am not sure, because is not clear to me if this problem is from before, or after my last update.

Anyway, i really hope someone can help me. I have days working on solve this, and i just cant.

Best Regards,

Sue.

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

  • Posts: 2334
  • Thank you received: 403
11 years 10 months ago #86334

Hi there,

It sounds like something we already fixed so I wonder if you have the very last version of Hikashop.
Try to update or reinstall and see if it fix the problem.
If it doesn't, you said you fixed the image issue, have you edited the plugin file to do so? I'm just curious.
If you could give us link to the page so we can a look to the generated code and see what's wrong?

The following user(s) said Thank You: melisari

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

  • Posts: 103
  • Thank you received: 2
11 years 10 months ago #86340

Of course! Is happening in all my websites, but there is one client that is a little mad about that, i did a little coding, but in the metatags of facebook, so, the photo still doesnt appear, just the logo of the site.

viernezotravez.com/

I made some other customization to this site, so i always afraid of make an update, maybe if i only change those files that correct the issue? Thank you so much again!

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

  • Posts: 103
  • Thank you received: 2
11 years 10 months ago #86341

Just checked, and the system said i have the last version :(

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

  • Posts: 2334
  • Thank you received: 403
11 years 10 months ago #86346

I just checked and you don't have the very last version (we made multiple release of tHikashop 2.0 but you couldn't know that :)).
The problem indeed looks like something I already fixed, if I'm right, Your main product doesn't have picture or description right?
Well you can either download the last package and reinstall (if you did your customization thanks to the Hikashop views editor you shouldn't lost anything) or download the same package and replace your current plugin (in plugins\content\hikashopsocial) by the one in the package (back/extensions/plg_content_hikashopsocial).

The following user(s) said Thank You: melisari

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

  • Posts: 103
  • Thank you received: 2
11 years 10 months ago #86347

I did customizations to the php files, so im going to do it manually :) Thank you so much! Wonderfull support like always!

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

  • Posts: 103
  • Thank you received: 2
11 years 10 months ago #86355

Oh :( Is still happenning :( What can be?

The description doesnt appear :(

Attachments:

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

  • Posts: 2334
  • Thank you received: 403
11 years 10 months ago #86357

The problem may come from the Facebook data cache which doesn't update each time you like something.
You should try again in few days and see what happens.
Alors, I tried your url with the facebook debugger ( developers.facebook.com/tools/debug ) and it looks like your id is wrong.
I think you can solve your problem with these solution. The code in the page look way better now (if you inspect the source code you'll see the description is in the meta data :))

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

  • Posts: 103
  • Thank you received: 2
11 years 10 months ago #86358

The id is wrong... ¿how can i fix that? Oh my God there is so much i dont know, is just scaring. I been working on this facebook issue for days in the facebook developers and i can hardly understand the directions. Thank you so much for helping me.

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

  • Posts: 2334
  • Thank you received: 403
11 years 10 months ago #86427

Indeed, it looks like the facebook id is wrong.
Where did you get this id? It has to be your profile ID or page ID.
Try without the ID first or find yours and test with a valid ID :)

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

  • Posts: 69
  • Thank you received: 11
11 years 9 months ago #87511

I think the actual problem may be in the file:

plugins/content/hikashopsocial/hiskashopsocial.php - Line 261


In my configuration, I haven't setup the FB Admin ID. This returns the $html before the description tag is included. I commented out the description tag line and placed it before it returns when no FB Admin ID is found, it now renders the description properly.

                ...

		$this->meta['property="og:site_name"']='<meta property="og:site_name" content="'.htmlspecialchars($siteName, ENT_COMPAT,'UTF-8').'"/> ';
		
		// Moved the bellow line here to always include teh description. 
		$this->meta['property="og:description"']='<meta property="og:description" content="'.htmlspecialchars(strip_tags($product->product_description), ENT_COMPAT,'UTF-8').'"/> ';
		
		
		if(!empty($plugin->params['admin'])){
			$this->meta['property="fb:admins"']='<meta property="fb:admins" content="'.htmlspecialchars($plugin->params['admin'], ENT_COMPAT,'UTF-8').'" />'; }
		else{
			return $html;
		}

	//	$this->meta['property="og:description"']='<meta property="og:description" content="'.htmlspecialchars(strip_tags($product->product_description), ENT_COMPAT,'UTF-8').'"/> ';

		return $html;

I also had the following problem:



And I fixed it by modifying line 316 of the same file. It was always returning a blank URL because it was always finding a record in the DB.
                $queryImage = 'SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id='.$product_id.'  AND file_type=\'product\' ORDER BY file_ordering ASC, file_id ASC';
		$db->setQuery($queryImage);
		$image = $db->loadObject();
                // Commented the bellw line because it was alwasy returning an empty URL 
		//$imageUrl = ''; 
		$imageUrl=JURI::base().$this->main_uploadFolder_url.$image->file_path; // this is the replacement line
		if(empty($image)){
			$queryImage = 'SELECT * FROM '.hikashop_table('file').' as a LEFT JOIN '.hikashop_table('product').' as b ON a.file_ref_id=b.product_id  WHERE product_parent_id='.$product_id.'  AND file_type=\'product\' ORDER BY file_ordering ASC, file_id ASC';
			$db->setQuery($queryImage);
			$image = $db->loadObject();
			if(!empty($image))
				$imageUrl=JURI::base().$this->main_uploadFolder_url.$image->file_path;
		}
		return $imageUrl;

Result:



Elliot, is this fine or is there do I have something wrong in my config?


Eduardo Chongkan - Likan Development
http://likandevelopment.com
Last edit: 11 years 9 months ago by likandev.
The following user(s) said Thank You: Eliot

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

  • Posts: 2334
  • Thank you received: 403
11 years 9 months ago #87613

Indeed the first fix is a good one, I don't know why it was like this.
But the second fix is strange. If your product doesn't have any picture your current code will display an error message.
The original code was made in a way that if there was no image, we didn't add the image tag so facebook will just try to find an image on your website (the banner for example).
We may add an option to allow you choosing a image to display in case of no image found but your current code isn't a good solution.

EDIT: I just found the problem here is the solution:

function _getImageURL($product_id){
		$config =& hikashop_config();
		$uploadFolder = ltrim(JPath::clean(html_entity_decode($config->get('uploadfolder','media/com_hikashop/upload/'))),DS);
		$uploadFolder = rtrim($uploadFolder,DS).DS;
		$this->uploadFolder_url = str_replace(DS,'/',$uploadFolder);
		$this->main_uploadFolder_url = $this->uploadFolder_url;
		$db = JFactory::getDBO();
		$queryImage = 'SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id='.$product_id.'  AND file_type=\'product\' ORDER BY file_ordering ASC, file_id ASC';
		$db->setQuery($queryImage);
		$image = $db->loadObject();
		$imageUrl = '';
		if(empty($image)){
			$queryImage = 'SELECT * FROM '.hikashop_table('file').' as a LEFT JOIN '.hikashop_table('product').' as b ON a.file_ref_id=b.product_id  WHERE product_parent_id='.$product_id.'  AND file_type=\'product\' ORDER BY file_ordering ASC, file_id ASC';
			$db->setQuery($queryImage);
			$image = $db->loadObject();
		}
		if(!empty($image)){
				$imageUrl=JURI::base().$this->main_uploadFolder_url.$image->file_path;
		}
		return $imageUrl;
	}

For those who do want to edit the file, here is the fixed file to put in the folder plugins\content\hikashopsocial

File Attachment:

File Name: hikashopso...1-29.zip
File Size:4 KB

Attachments:
Last edit: 11 years 9 months ago by Eliot.
The following user(s) said Thank You: likandev

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

  • Posts: 69
  • Thank you received: 11
11 years 9 months ago #87693

Right, I didn't notice that becasue my product had an image.

Thanks!


Eduardo Chongkan - Likan Development
http://likandevelopment.com

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

Time to create page: 0.070 seconds
Powered by Kunena Forum