Htmyell
autoTweet3


You heard me right... autoTweet 3.0 is now out. I know what you're thinking;

"But Jamie, didn't you just release 2.0 like last week?"

Well, yeah but-

"So why 3.0 so soon?"

Good question.

When I finally sat down to make autoTweet 2.0 I unwittingly did so without the knowledge that twitter was doing away with their current method of making API calls (read more about this here: http://dev.twitter.com/announcements). The new method requires OAuth to make API calls and is basically going to render autoTweet useless. This does however make using twitter apps far more secure. Also, since it's  a new method I decided to go ahead and make it a 3.0 (i was never good with these naming conventions). Just be happy it's not 2.0.1.b R2 beta 4.

New Features
  • Uses OAuth to verify twitter user.
  • Added real time error reporting
  • Added ability to set twitter time out.
Requirements
  • php5+
  • JSON support
  • cURL
  • Zen Cart 1.3.8 or greater
Set up

Anyway to get started with the new twitter method we're going to have to create a web app via twitter that we can access using a single access token.

1. first you need to log into your store's twitter account and create an application on twitter http://dev.twitter.com/apps/new

2. Fill in the information boxes like so:

a. Application Name: Just use your store's name or URL. I simply used store's address: Htmyell.com

b. Description: You need to enter at least a 10 character description. Once again I used Htmyell.com

c. Application Website: your store's URL, i.e. http://www.htmyell.com

d. Application Type: Make sure you set this to "Browser" if it's not already set for you.

e. Callback URL: This isn't important to us, since we wont need to be making any requests. Just enter your store's URL again:

f. Make sure you set this to "Read & Write" if it is not already set for you.

g. Application Icon: Your logo, pic, etc.

Anything else you can fill in however you want, or leave blank. Note: you can come back and change this at any time.

Now prove you're real, click register application, then accept the terms.

3. Now you'll be redirected to you application details page. There you should be given two important things; your Consumer Key, and your Consumer Secret.

4. Extract everything the autoTweet3.zip. Open the included update_product.php from the in admin/includes/modules/ folder and edit the information you see between quotes on lines 92 and 93 with your information

5. Now back at your Application Details page you should see a link on the right hand side called "My Access Token", click on it. This page gives you your single access token of the twitter account that you created the application with.  Use this information to fill in lines 94 and 95 back in update_product.php.

6. Now edit lines 96 through 100 like so:

a. $twitUsername = your twitter user name.

b. $twitPassword = your twitter password.

c. $bitlyUsername = your bit.ly user name (available for free at www.bit.ly)

d. $bitApiKey = your bit.ly API Key, find it by logging in to bit.ly and clicking settings.

e. $storeUrl = The web address to your store's home page. (Might be something like www.mystore.com or www.myname.com/store) Note: the ""http://"" before the url is not needed here.

f. $showprice = If you want to show your product's price on twitter set this equal to 1 (with no quotes.) If you don't want to set your product's price set this equal to 0 (default).

g. $timeout = the amount of time (in seconds) to wait for twitter before moving on and just adding the product. This makes it so that your store doesn't break waiting for twitter. No quotes here either.

7. Save and Upload

Save the file. Now upload the contents of your autoTweet 3.0 admin folder to your store's admin folder. This will replace your existing update_product.php file with the new autoTweet version and add the twitteroauth folder. So if prompted, allow overwriting.

Download:

Download now from Zen-Cart.com

About Jamie Taylor

Lead Developer and Interactive Manager at kenmontdesigngroup.com, Owner and operator of Htmyell.com.
Comments (10) Trackbacks (1)
  1. Thanks Jamie. I’ve just added this to my site and it works great. Your clear instructions made it really easy.

    It’s currently set up to tweet the item price before tax. Is there a way I can modify the code to show the price with VAT and to restrict the output to two decimal places?

  2. Yeah, you could multiply it by .whatever the VAT is:

    So if VAT was 8% you would change line 122 to something like:

    $vat = .08;
    if ($showprice){ $message .= ‘ Only $’ . number_format(( $products_price + $products_price * $vat), 2, ‘.’, ”) . ‘!'; }

    also you can see that by wrapping the equation in the number_format() function above we’ve ensured that we show and restrict the price to decimals.

  3. Hi Jamie,

    Thanks for the addon for Zencart. Just 1 question. Will autotweet work with zencart 1.38a? As I have followed your instructions and it does nothing.

    Thanks.

  4. Hi One little tiny fix if you can?

    1980’s is showing up 1980\s.

    Is this possible to fix this?

    Thanks :)

  5. how do you fix 1980’s is showing up 1980\s.

    Is this possible to fix this?

  6. Sorry for the late response. I’m not sure actually, the older version of autotweet (which you can download at: http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1523 and scroll down) should work however, the instructions are outdated as facebook has changed the app process about a dozen time.

  7. Hi Jamie, I’m just getting to learn php and was trying your up date to make autotweet show prices +tax, as you posted a few months ago.
    I was wundering did this actually work for the tweets as when I added this to the php file it caused an error? More than likely it was me adding ti wrongly.

    I commented out the origional line

    //if ($showprice){ $message .= ‘ Only £’ . $products_price . ‘.'; }

    and replaced it with

    if ($showprice){ $message .= ‘ Only £’ . number_format(( $products_price + $products_price * $vat), 2, ‘.’, ”) . ‘!’; }
    It has started to throw up some parse error 6 or 7 at a time All related to line 126, which is the line in the code related to this change. Have I messed things up?

    It was all working befor I changed to show prices with TAX
    I will revert back to the origional file and await your answer.

  8. Make sure when copying from the web you’re changing the quotes to standard single quotes… a lot of times they copy over as an unrecognized character.

  9. also you may need to use the hex code for the ‘pound’ symbol as opposed to the actual symbol it’s self.

  10. Hi Jaime,

    I recently downloaded this module from zen cart and I am using version 1.5.1 when I look at the file I see that there isn’t an area to put in my twitter user name and password just bit.ly which in all honesty is confusing me. I went to bit.ly and signed up using my @atmospherebooks from twitter, is that my name. Also is this mod compatible with ZenCart 1.5.1?


Leave a comment

You must be logged in to post a comment.

Copyright © 2014 Htmyell.com