autoTweet 3.0


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. https://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

9 Responses to “autoTweet 3.0”

  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. Jamie Taylor

    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. lingerieholicnet

    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 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.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>