autoFacebook 2.0

Please note there is an update to this plugin at: https://htmyell.com/autofacebook-2-1/

autoFacebook 2.0

By: Jamie Taylor
Htmyell.com


What’s New:

  • Added oauth 2.0 authorization to integrate with Facebook’s new Graph API calls.
  • Added Zen Cart integrated error checking and status alerts.

Requirements:

  • Zencart 1.3.9+
  • php 5+
  • cURL
  • JSON

License:

This Zen Cart modification is licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl-3.0.txt

Getting Help:

Help is available via the Zen Cart forums @ http://www.zen-cart.com/forum/showthread.php?t=153528 or at https://htmyell.com/autofacebook-2-0


Installation:

New Users:

1. Log in to your facebook account and go to http://www.facebook.com/developers and click the “+ Set up New Application” button.

2. Name your application. I suggest something like “MyStoreDomain.com” but it can be whatever you like. Agree to the terms and click “Create Application.” On the next page, if required fill in the security check and click “Submit.”
Note: if an error occurs simply go back you should see your application was created anyway. If so, click “edit settings” otherwise, try again.

3. Now you should see your new Application settings. You can come back and edit these later though it’s not required (I’d suggest atleast uploading an Icon image once everything is working).

4. For now we need to click “Web Site” on the left and edit our “Site URL” and our “Site Domain”.
The Site URL is simply your store’s web address followed by a ‘/’ forward slash. So it should look something like “http://mystore.com/”
Your Site Domain is just your domain name ‘dot’ whatever and could look like “mystore.com”. No “http://”, no “www.”, and no “/”

5. Now click “Facebook Integration” on the left. Towards the bottom you should see “Installable to?”. Uncheck “Users” and add a check next to “Facebook Pages” instead.

6. Now click “Save Changes”. If all goes well you should see your app on the My Applications page, along your app settings. We’ll need to use the “Application ID” and “Application Secret”.

7. Now that we’re done with our app open up the included facebook_authorization.php file and edit lines 4 and 5 with your App information.
Note: facebook_authorization.php is a simple file that we’re going to upload to our server and run from our browser to authorize our application to do things for us like post to our page’s wall. After if gives us certain information it is no longer needed and should be deleted.

So on line 6 where you see: $app_location = “http://yoursite/facebook/facebook_authorization.php”; This is simply the URL to where you plan to upload facebook_authorization.php. I suggest making a temporary folder on your folder called “facebook”. However, where ever you plan to upload it, it must be on the same server you specified in Step 4 and make sure you reflect it’s location on line 6. Once you’re done editing lines 4-6 save and upload it to where ever you specified in your $app_location.

8. Once uploaded run the file in your browser and you will be taken to facebook’s Permission Request prompt to authorize your app. Click “Allow.”

9. You should now see a Success page with your page’s ID and Page’s Token. We need those for our next step.
Note: if you see a period (or any other punctuation) at the end of your page’s Token consider it part of the token.

10. Open up the included update_product.php file in the admin/includes/modules folder and edit lines 90 through 97 with your Application Info and the Info given from the last step (Step 9). Note: $store_url needs to be the full url to your store without the trailing (‘/’). So it should look like “http://www.mystore.com” or “http://www.mystore.com/store”. Alos: lines 96 and 97 can be personallized or just left as they are.

11. Now upload the the new update_procut.php and the facebook folder to your store’s admin/includes/modules folder on your server (or just drag the admin folder from autoFacebook2 folder to your zencart root directoy)

12. Now when you add a new product to your store your facebook will automatically be updated with the new product info. Note: you may now delete the facebook_authorization.php uploaded in step 6 as well as the temporary folder from your server.

Existing Users:

If all is fine with your old version of autofacebook, there really isn’t any major improvements with this version. This version mainly address facebook’s changing of the user authorization process for people who did not create their application before july 1st.
However if you want to upgrade be aware of the following:

  • You will have to create a new Application since the methods have changed
  • I am unable to test this on any live sites running the old version of autoFacebook so to be safe and ensure maximum compatibility:

1. Delete the “facebook” folder in your admin folder.

2. Start at step 1 for new users.

Adding to autoFacebook to autoTweet.

to add to autoTweet just complete steps 1 – 10 but istead of uploading update_product.php copy lines 89 – 132 of the autoFacebook 2.0 update_product.php and paste them above line 90 (above “// start autoTweet 3.0”) of your current update_product.php

Adding autoTweet to autoFacebook

copy lines 90 – 157 of your autoTweet update_product.php and paste them just below line 132 (where you see “//end of autoFacebook”)


For more info and to give feedback check the forums.

Hope ya like it

Download:

Available for download at Zen-Cart.com

8 Responses to “autoFacebook 2.0”

  1. There is a change in Developement section in Facebook How to proceed with step 5 in your guide – 5. Now click “Facebook Integration” on the left. Towards the bottom you should see “Installable to?”. Uncheck “Users” and add a check next to “Facebook Pages” instead. There is no such option “Installable to”

    • Jamie Taylor

      Facebook changes too often for me to keep up. You should only need to add your domain and url now to complete the app process.

  2. zanemiester

    Jamie
    Thanks for a g8 plugin!
    I have combined as per your instrucations facebook and twitter without an issue.
    I wish to also show updated products through this plugin. Are you able to help?
    Also I think being able to set a “$Tax” variable may help with pricing? Just a thought.
    Regards
    Zane

    • Jamie Taylor

      I will be adding tax as well as currency soon. in the mean time, i believe there are instruction in the forum for configuring tax.

  3. gbliang

    first,thank you.i install the plugins ,and when I upload a new product,it show “Success Facebook was successfully updated!” on the top of admin area.
    But I can’t found the product on facebook,can I find it ? and when I install,I can’t do step 5,I can’t find the “Facebook Integration”

  4. tinnywinny

    i install the plugins ,and when I upload a new product,it show “Success Facebook was successfully updated!” on the top of admin area.
    But I can’t found the product on facebook,can I find it ? and when I install,I can’t do step 5,I can’t find the “Facebook Integration”
    plz guide me