0

I added a code to my zencart products page that is integrated into a facebook tab so that a user can "like" a product and it is posted on their wall with a picture of the product and a link back to the product (I copied the code from this site: http://www.navspan.com/ecommerce/facebook-like-twitter-google-zen-cart.htm#comment-305).

The problem is the link back to the product goes to the site but not within the facebook iframe (ie the tab)... it goes to my hosting account that I have the site setup on with a correct link to the product... but again not within facebook...

The two reasons I want it to stay within facebook is: first, the site is styled to be in the iframe and looks broken outside of it and second I want the users to move between their activity on facebook and buying the product on the fanpages tab seamlessly... So here is the code that I don't know how to modify:

<link rel="image_src" href="<?php echo "http://" . $_SERVER['HTTP_HOST'] . "/images/" . $products_image; ?>" />

Can I replace the "http://" with the unique facebook fanpage url? but I don't know how to get the fanpage url to go directly to the correct product...

Thoughts?

ristenk1
  • 425
  • 2
  • 6
  • 25
  • Here's the link in case you are curious... the facebook "like" that posts to the wall is on the product pages: https://www.facebook.com/TracyLoganDesigns/app_422210754456200 – ristenk1 May 17 '12 at 18:07

1 Answers1

1

To link to other pages within your Facebook app, your URLs will need to look something like this:

  http://facebook.com/YOUR_PAGE/YOUR_APP?app_data=UNIQUE_CONTENT_STRING

This app_data and several other pieces of data will be POSTed to your server whenever Facebook requests a page. You'll need to create a handler on your end to decode the signed_request extract the string from app_data and then make the appropriate queries on the back end to display the correct information to your user.

I found this example that might point you in the right direction.

I'm not too familiar with ZenCart, but this looks like it's going to be a pretty heavy-duty hack. It would definitely be worthwhile to spend some time looking for a Zen Cart plugin that might do this for you.

If you're going to do it yourself, you'll need to url_encode everything that would appear after the ? in one of your urls and pass this into app_data. So to link to the page that shows your Queen Collar Necklace, your URL would look something like this:

 http://www.facebook.com/TracyLoganDesigns/app_422210754456200?app_data=main_page%3Dproduct_info%26cPath%3D1_13%26products_id%3D2%26zenid%3D2e0d1920f964cc9887f74ea0c9b8903c%23.T7VEZsXi1j1

Good luck.

cpilko
  • 11,674
  • 2
  • 28
  • 45
  • Don't give up all hope. There is a way to do this. I was looking at the Live Nation Concert Calendar app last night. They are able to do this somehow, just not in a page tab. https://apps.facebook.com/concertcalendar/ – cpilko May 18 '12 at 13:53