I would be interested in this as well. As a temporary fix, I had to comment out the includes statement in admin/includes/modules/update_product.php ~Line 95 so that my products would still publish even though twitter is down.
Printable View
Have just installed this in http://www.irishshopper.com but when I try to access the test file (testfile.php) I receive these error messages
Fatal error: Uncaught exception 'TwitterException' with message 'Status is a duplicate.' in /home2/irishisb/public_html/isa38/twitter/twitter.php:204 Stack trace: #0 /home2/irishisb/public_html/isa38/twitter/twitter.php(648): Twitter->doCall('statuses/update...', Array, true) #1 /home2/irishisb/public_html/isa38/twitter/testfile.php(21): Twitter->updateStatus('New Product Ava...') #2 {main} thrown in /home2/irishisb/public_html/isa38/twitter/twitter.php on line 204
Hi there. I take it the username and password are for Twitter do I ned them or an API key for a tinyURL account ?
I have just attempted to install this but I have a problem, in the latest download there is no "autoTweet.php" file in the admin folder....what to do?
I guess either the instructions need updating else someone forgot to put it in :P
Hi everyone, sorry for my absense, things got crazy with work .I'll be developing a new version of autoTweet here soon. I think the time-out catch is a good idea, and I'll double check the documentation to make sure it is up to date.
Sorry for any inconvenience,
Jamie
Just submitted autoTweet 2.0 should be up soon, in the meantime you can download it from my site @ http://htmyell.com/autotweet-2-0-now-available.
Change log v 2.0:
- Made install much easier (about 3 minutes)
- Added option to turn on/off price.
- Added twitter error checking set 10 second timeout so store doesn't break if twitter goes down.
- Added bit.ly error checking in case links don't shortening.
p.s. upgrading is super simple just fill in your current info, replace the update_product.php file, and you're done.
As always I will try my best to support these mods. Let me know how it works for you.
OK, sooooo... this is embarassing.
After making autoTweet 2, I stumbled upon the fact that the method twitter uses to make API calls is changing over to OAuth starting on August 16th, 2010. This change will be mandatory and effectively render autoTweet 2 useless.
So... that having been said... autoTweet 3 is now out!
It uses the required OAuth procedures as well as cURL to authenticate API calls.
Also, I've added message stack error reporting so you know what worked and what didn't after submitting your problem.
To reiterate, autoTweet 2 and below will not work after August 16th, 2010.
Update Now:
I've submitted the new version to Zen-Cart but in the meantime you can update now at my site via:
http://htmyell.com/autotweet-3-0
Hi Jamie,
I'm a bit confused. Your installation instructions says to enter the username and password for twitter on line 96 to 100, however that line has been replaced by:
$consumerKey = "Your twitter app consumer key"; //twitter app consumer key.
$consumerSecret = "Your twitter app consumer secret"; //twitter app consumer secret.
$oauthToken = "Your my access oauth token"; //twitter app "my access" token
$oauthTokenSecret = "Your my access oauth token secret"; //twitter app "my access" token secret.
$bitlyUsername = "your bitly username"; //bit.ly username
$bitApiKey = "Your bitly API key"; //bit.ly api key.
$storeUrl = "www.your-store.com"; //url to the homepage of your store.
$showprice = 0; // Show the product price? 0 = off, 1 = on. no quotes.
$timeout = 10; //seconds to wait for twitter & bit.ly. This can be left alone.
Is the username and pasword now replaced by the consumer key etal?
Also once this new module is uploaded do we just delete the old twitter folder?
Thanks for all the work!!
totalsam, what version of zencart are you using?
Using 1.3.9e for the first time in my life I think I'm completely up to date :D
Ok installed it and using 1.3.9e too, working ok. :) Thanks for a great mod!
Hey sorry, for some reason I didn't get an email about new thread comments.
Anyway, I'll update the instructions (that's what i get for copying the previous version's instructions and thinking i wouldn't miss something.)
To clarify, you no longer need your twitter username or password.
when you make an app you just need the app info.
sorry for the mix up.
Also: yes you can delete the old twitter folder.
Hi jamie what a great add on this is only thing i keep getting error message. it reads
Twitter could not be updated: 401 Unauthorized: Incorrect signature
To paste the code into twitter yourself use:
New product available: ABC Paper Piecing! Check it out now at http://bit.ly/bjKT3A
i am new to this sort of thing and just cant get it work any ideas would be greatly appreciated
thanks for taking time to read
john craftyhobbieuk.com
Sounds like you got the wrong $oauthTokenSecret Double check your twitter app "my access" token secret. And make sure all of the following are right;
PHP Code:
$consumerKey = "Your twitter app consumer key"; //twitter app consumer key.
$consumerSecret = "Your twitter app consumer secret"; //twitter app consumer secret.
$oauthToken = "Your my access oauth token"; //twitter app "my access" token
Remember; the username and pasword are now replaced by the consumer key, consumer secret, oauthToken, oauthTokenSecret, so if you're getting 'Unauthorized ' it's probably there.
Hi Jamie,
Nice mod, I have installed this add on.
I followed your instruction step by step. Ok, i now ready to add a new product , i can preview , But once i click the INSERT button on the preview page , i just got one blank page. Nothing else happened , the product hasnot been inserted either. What is wrong?
No other errors, Only a blank page.
Thanks, i really like your work.
BTW,i just upgrade zencart to 1.3.9f from 1.3.8a
Martin
Can you post your autofacebook code for me. (make sure you remove personal info i.e. app id, secret, token, etc).
Did you include the perion at the end of your page_token?
this is my error
Twitter could not be updated: 401 Unauthorized: Could not authenticate you.
To paste the code into twitter yourself use:
but i think it is asking for this
$oauthTokenSecret = "Your my access oauth token secret"; //twitter app "my access" token secret.
Could you please tell me what these fields are referred to in twitter. because i can not find a "my access" token secret anywhere.
thanks
Joey
:dontgetit :unsure::censored::frusty:
I am presently using: v1.3.9f
I am presently using PHP5
thanks for the help ... now for my even more bone head question ... how do i get the auto facebook and auto tweet to work at the same time
Just had this msg from Twitter in my mailbox:
Quote:
Over the coming weeks, we will be making two important updates that will impact how you interact with Twitter applications. We are sending this notice to all Twitter users to make sure you are aware of these changes.
What are applications?
There are over 250,000 applications built using the Twitter API. To use most applications, you first authorize the application to access your Twitter account, after which you can use it to read and post Tweets, discover new users and more. Applications come in many varieties, including desktop applications like TweetDeck, Seesmic, or EchoFon, websites such as TweetMeme, fflick, or Topsy, or mobile applications such as Twitter for iPhone, Twitter for Blackberry, or Foursquare.
Update 1: New authorization rules for applications
Starting August 31, all applications will be required to use “OAuth” to access your Twitter account.
What's OAuth?
OAuth is a technology that enables applications to access Twitter on your behalf with your approval without asking you directly for your password.
Desktop and mobile applications may still ask for your password once, but after that request, they are required to use OAuth in order to access your timeline or allow you to tweet.
What does this mean for me?
Applications are no longer allowed to store your password.
If you change your password, the applications will continue to work.
Some applications you have been using may require you to reauthorize them or may stop functioning at the time of this change.
All applications you have authorized will be listed at http://twitter.com/settings/connections.
You can revoke access to any application at any time from the list.
Update 2: t.co URL wrapping
In the coming weeks, we will be expanding the roll-out of our link wrapping service t.co, which wraps links in Tweets with a new, simplified link. Wrapped links are displayed in a way that is easier to read, with the actual domain and part of the URL showing, so that you know what you are clicking on. When you click on a wrapped link, your request will pass through the Twitter service to check if the destination site is known to contain malware, and we then will forward you on to the destination URL. All of that should happen in an instant.
You will start seeing these links on certain accounts that have opted-in to the service; we expect to roll this out to all users by the end of the year. When this happens, all links shared on Twitter.com or third-party apps will be wrapped with a t.co URL.
What does this mean for me?
A really long link such as http://www.amazon.com/Delivering-Hap.../dp/0446563048 might be wrapped as http://t.co/DRo0trj for display on SMS, but it could be displayed to web or application users as amazon.com/Delivering- or as the whole URL or page title.
You will start seeing links in a way that removes the obscurity of shortened links and lets you know where each link will take you.
When you click on these links from Twitter.com or a Twitter application, Twitter will log that click. We hope to use this data to provide better and more relevant content to you over time.
Thanks for reading this important update. Come and check what's new at http://twitter.com.
Thanks,
The Twitter Team
Will AutoTweet be affected by these changes?
I am using Zen cart 1.3.8.a
PHP Version 5.2.13
Autotweets has been working fine for over a month until this morning when I got this message trying to add a new product:
Fatal error: Uncaught exception 'TwitterException' with message 'Basic authentication is not supported' in /home/pro2move/public_html/webwinkel/admin/twitter/twitter.php:204 Stack trace: #0 /home/pro2move/public_html/webwinkel/admin/twitter/twitter.php(648): Twitter->doCall('statuses/update...', Array, true) #1 /home/pro2move/public_html/webwinkel/admin/twitter/autoTweet.php(21): Twitter->updateStatus('Nieuw artikel v...') #2 /home/pro2move/public_html/webwinkel/admin/includes/modules/update_product.php(88): include_once('/home/pro2move/...') #3 /home/pro2move/public_html/webwinkel/admin/product.php(62): require('/home/pro2move/...') #4 {main} thrown in /home/pro2move/public_html/webwinkel/admin/twitter/twitter.php on line 204
:
Any idea what might have caused this?
And now we wait for the updated mod to be made available. :cool:Quote:
Update 1: New authorization rules for applications
Starting August 31, all applications will be required to use “OAuth” to access your Twitter account.
What's OAuth?
OAuth is a technology that enables applications to access Twitter on your behalf with your approval without asking you directly for your password.
Desktop and mobile applications may still ask for your password once, but after that request, they are required to use OAuth in order to access your timeline or allow you to tweet.
What does this mean for me?
Applications are no longer allowed to store your password.
If you change your password, the applications will continue to work.
Some applications you have been using may require you to reauthorize them or may stop functioning at the time of this change.
All applications you have authorized will be listed at http://twitter.com/settings/connections.
You can revoke access to any application at any time from the list.
The new updates will not affect autoTweet 3 which is in compliance with the new oauth method of authentication.
If you are having errors, please update to version 3.0.
Hi there, I just downloaded version 3.0 and set up my api at Twitter as well as my bitly account.
Everything is great except for in your instructions you say:
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)
There are no references to the twitter username and password in that file - this is the code:
What do I do??Code:// start autoTweet 3.0
//User Settings.
$consumerKey = "3QVuGT5Uag08Z7rzbYmBJg"; //twitter app consumer key.
$consumerSecret = "IJ7dB3JcnrZpLfVCEktwrnQMGKohcmxfpvp5erdJeo"; //twitter app consumer secret.
$oauthToken = "37597468-9VXjZazZghrNFyK5kdCRgXEPFumExvjKq0LmFRsmo"; //twitter app "my access" token
$oauthTokenSecret = "N7gRdpHOBbXl2NLK3EFNEb4esnqbTgo2HNq85v2ag"; //twitter app "my access" token secret.
$bitlyUsername = "jojomart"; //bit.ly username
$bitApiKey = "R_9884425471a569adc50916e630c844dd"; //bit.ly api key.
$storeUrl = "www.joannes-digital-designs.com"; //url to the homepage of your store.
$showprice = 1; // Show the product price? 0 = off, 1 = on. no quotes.
$timeout = 10; //seconds to wait for twitter & bit.ly. This can be left alone.
Thanks,
Joanne
Yeah, that was an error in the documentation;
all you need is:
for twitter to work.Quote:
$consumerKey = "Your twitter app consumer key"; //twitter app consumer key.
$consumerSecret = "Your twitter app consumer secret"; //twitter app consumer secret.
$oauthToken = "Your my access oauth token"; //twitter app "my access" token
$oauthTokenSecret = "Your my access oauth token secret"; //twitter app "my access" token secret.
Just ignore the username and password stuff.
This all sounds far too complicated for me. Can anyone tell me what files I need to change to remove the OLD Autotweet facility and go back to the PRE Autotweet days.
Cannot remember what files I altered, possibly I did keep a copy of the original files before adding in any changes.
Just installed autoTweet 3.0 in one store (1.3.9f) and it works perfectly.
Then went to do the same in another store, also 1.3.9f (different token, URL etc of course) and I am getting
Double checked that I pasted the various codes ok: all good.Quote:
Error Twitter could not be updated: 401 Unauthorized: Read-only application cannot POST
To paste the code into twitter yourself use:
New product available: Test Product - please ignore! Check it out now at http://bit.ly/ahbPVY
Any ideas what could have gone wrong?
TIA
When you set up the twitter ap you set it as a read only application. There is a setting there if memeory serves me you need to change.
In your application settings at dev.twitter.com check the defautl access type isn't set to read only. :smile:
That's what I looked at in first place. But - it is set as Read / Write, just as in the other shop which works fine.
That error message is twitter saying your app does not have permission to write to twitter. Maybe something went wrong with the app at twitter. Have you tried creating a new one to see if error is replicated ??
^I agree
You'll need to re-authorize the app. The credentials are generated based on the type of app and were probably generated for the read only app, and not the read/write app. Some kind of security safe gaurd on twitter's end.
Anyway creating a new one will probably fix this issue.
I keep this error
Fatal error: Uncaught exception 'TwitterException' with message 'Basic authentication is not supported' in /home/content/25/5239325/html/admin/twitter/twitter.php:204 Stack trace: #0 /home/content/25/5239325/html/admin/twitter/twitter.php(648): Twitter->doCall('statuses/update...', Array, true) #1 /home/content/25/5239325/html/admin/twitter/autoTweet.php(21): Twitter->updateStatus('New Product Ava...') #2 /home/content/25/5239325/html/admin/includes/modules/update_product.php(89): include_once('/home/content/2...') #3 /home/content/25/5239325/html/admin/product.php(62): require('/home/content/2...') #4 {main} thrown in /home/content/25/5239325/html/admin/twitter/twitter.php on line 204
it just started and i havent changed anything since the last poduct i uploaded,and it worked then.....HELP....:wacko:
im using autotweet 1.01 and zencart 1.3.8
i upgraded to 3.0 and it works....Thank you, Thank you, Thank you
:clap:
Hi jamielife
How do you get Twitter Update stop re-updating to Twitter every time you click edit on a product. When I insert a product it post to Twitter, but if I have to go back and edit that product it will update and post it again no matter how many time I update that product. Thank You in advance
Hmmm the autoTweet code by default should fall between lines 90 and 157. If you have made any edits, or moved it (while trouble shooting (which could have been my fault)) either move it back to just those lines, or re-download autotweet and fill in your existing variable info.
Also, to anyone with the empty description/price/etc issue, I'm testing a fix for it now... hopefully this works.
Ok so this MIGHT fix it:
However, I can't recreate the problem so I am unable to test.
I think that it is server related and has to do with DNS/cURL settings. So if you're having a problem where something isn't getting posted to facebook (but just about everything else is) Download: http://htmyell.com/images/share/autoFacebook_fix.zip extract the included facebook.php file and replace the facebook.php file located on your server in: "admin/includes/modules/facebook/"
You don't need to change anything else, this will just change the core facebook api fille.
Once you replace it, hopefully everything will work.
...fingers crossed...
Please let me know.
NOTE: This is not an upgrade to the existing autoFacebook 2 mod, it is just a potential fix for those people having issues with the current mod. If everything works fine for you, you do not need to download this.
Thanks for pointing that out to me. I did move the code toward the bottom. I move it back up and now every things works like it should. I'm happy how autoTweet is posting. Not like autoFacebook.
New product available: Cape Cod Storage Console! Only $146.70. Check it out now at http://bit.ly/aHI6eE
To anyone using autoTweet that is having an issue with products description not posting to facebook, it is more than likey caused by another mod adding to your description field (such as: FCKeditor Plugin).
Adding
Below (line 105) where you see:PHP Code:
$prod_description = strip_tags($prod_description);
And that should fix it.PHP Code:
//$prod_description = implode(" ", $_POST['products_description']);
:oops:
Disregard that last post as well;
I think I'm starting to lose my mind...
to solve this with autoTweet 3 add:
Right below line 120 which should look like:PHP Code:
$message strip_tags($message);
Sorry again.PHP Code:
$message = "New product available: " . $_POST['products_name'][$_SESSION['languages_id']] . '!';
Hi, thanks for supporting this so far Jamie.
Does anyone else using Ultimate SEO urls have the Autotweet 3 working?
When i am inserting a new product, the url looks like this: http: //example.com/p-123.html, when it should be http: //example.com/product-name-p-123.html.
I double checked the install instructions, everything is in place and posting on Twitter.
When I remove the code for Autotweet 3 from the update product.php, the urls are fine. I also tried putting that code after the Autofacebook code, like in earlier versions of this mod. Urls are ok, but it stops posting on Twitter.
Any pointers much appreciated.
Again
it should be:
What does autoTwitter suppose to tweet.PHP Code:
$message = strip_tags($message);
Product name, price, and description, or just product name and price. If all three it still is not inserting the description for some reason. It looks likes this.
New product available: Angel Bible Storage Boxes! Only $27.90. Check it out now at then the prodUrl.
It might be working right and I am miss understanding......lol
that looks right
Twitter can only take in so much so its better to just let users know there's an update and give em a link to check it out.
You could change it to give the description but if the description is over 140 characters it would get cropped and there wouldnt be room for anything else, so i just left it that way
Got this to work and even integrated Autofacebook with it. It actually posts to both however, with twitter I get an error stating the login is incorrect so it uses my store URL without showing specific items.
Crazy me is going to crazy bed and will try to figure it out at a less crazy me time!!!
Facebook was successfully updated!
Warning URL was not shortened for Twitter: crystabellas.com was used instead. Reason: INVALID_LOGIN
Success Twitter Updated!
I've checked all the info more than once and the login is correct. Will try making a new app and see if that works
Didn't work. Still getting invalid login. I've used my login ID for Twitter and my email. What am I missing guys???
I have no idea where to go on this problem. Gonna take a break cause it's giving me a headache. Feel free to chime in if you have any idea why I keep getting the invalid login error!!
Tried adding Twitter login.....still invalid login. Checked to make sure it was the correct Twitter login and it is. Tried removing it completely...still IL. It loads a generic store url but no direct path to the item nor does it shorten the link.
Guess it isn't meant to be used by MOI!
After a couple of days of driving myself battier with this app....it hit me in the middle of one of my naps.:blink:So I checked and changed and reloaded....I FIXED IT!! :bigups::bigups::clap::clap: I B Bad!! uh huh uh huh!!!:laugh:
It is working like a charm now
great module.
problems for me the url doesn't get shortened and just posts the store home URL.
Can I easily change it to post the real link to the item rather than trying to shorten it?
Can I change the price from US$ to UK£
and finally is there anyway I can make it tweet a product that isn't new? most of my stock is added by CSV file so I don't actually create a new product, if it tweeted everytime I updated a product that would do as I could quickly edit each product and not actually change anything?
Am I a pain? - well yes probably :blush:
1. If you're using autoTweet3, when bitly fails it will automatically use your the real link instead. Check your bitly info, i've never heard of it failing. If you're using another mod that alters your URLs autoTweet wont work with those. If none of that works, then the answer is No, there is no easy way to do this.
2.Yes, on line 122 of update_product.php you should see
Just change the 'Only $' to: 'Only £' However, I get conflicting reports on the pound sign working so if it doesnt show for you I would either make it say 'Only ' which will make it read something like: 'new product only 9.99'PHP Code:
if ($showprice){ $message .= ' Only $' . $products_price . '.'; }
or
You can spell out pounds so that it would look something like 'new product only 9.99 pounds' or change the word pounds to 'GBP' or whatever you like by using:
3. Yes, move all the code from lines 90 through 157 (where you see the beginning and end of autoTweet) to line 176. This will tweet only when a product is updated (note: hasn't been fully tested but I have heard from the people who have tried it that it works.)PHP Code:
if ($showprice){ $message .= ' Only ' . $products_price . ' pounds.'; }
4. Yes, haha jk. :cool:
Hope that helps
I logged into bitly and reset the bit.ly api key and put the new one in the file and that's working great now :clap:
using the £ sign gives this error:
Twitter could not be updated: 400 Bad Request: Invalid Unicode value in one or more parameters
To paste the code into twitter yourself use:
and with either having it as just 'only' and/or adding GBP it adds 00 to the end of price so it gets displayed as only 9.9900. or 9.9900GBP. so think I'll just disable the price part and not use it :)
worked a treat, thanks for your time :hug:
on a side note the same problem happens with price on autofacebook - add £ no £ shows and 00 appears at end of price
Ok i've installed this and get no errors...
well, no error messages!
basically i add a product and the screen goes blank when i click to add.
if i remove the twitter folder then i can add products fine... re add the twitter folder and the cart messes up... so something is wrong.
if i click to go back then it sayd the product is in the catagory but it doesnt show up, and nothing gets posted to twitter...
I am getting this error
Twitter could not be updated: 401 Unauthorized: Invalid / used nonce
To paste the code into twitter yourself use:
Anyone have any idea why?
Jamie...luv you for a such a great addon...:clap:
One little tiny fix if you can?
1980's is showing up 1980\s.
Is this possible to fix this?
Installed and posted new product, received this error:
Twitter could not be updated: 401 Unauthorized: Incorrect signature
Jamie, are you around?
I need your help...please :blink:
Here's the code for AutoTweet
$prodUrl = urlencode(zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id));
//short url function.
function shortenUrl($user, $key, $shortenUrl){
$url = 'http://api.bit.ly/v3/shorten?login=' . $user .'&apiKey='. $key . '&longUrl=' . $shortenUrl . '&format=xml';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//use oAuth library
require_once 'twitteroauth/twitteroauth.php';
//function to shorten url
$shorten = shortenUrl($bitlyUsername, $bitApiKey, $prodUrl);
//start message w/ or w/out price
$message = "New product available: " . $_POST['products_name'][$_SESSION['languages_id']] . '!';
if ($showprice){ $message .= ' Only $' . $products_price . '.'; }
//if shorten fails use $storeUrl
$bitStatus = simplexml_load_string($shorten);
$http_code = $bitStatus->status_code;
$status_txt = $bitStatus->status_txt;
if ($http_code != 200){$shorten = $storeUrl;
$biterror = "URL was not shortened for Twitter: ";
$biterror .= $storeUrl . " was used instead.";
$biterror .= " Reason: " . $status_txt;
$messageStack->add_session($biterror, 'caution');
} else { $shorten = $bitStatus->data->url;}
//finish message.
$message .= ' Check it out now at ' . $shorten;
//the connection to twitter API
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$connection->timeout = $timeout;
$connection->connecttimeout = $timeout;
//send message
$tweet = $connection->post('statuses/update', array('status' => $message));
//error check
if ($connection->http_code != NULL){
if ($connection->http_code != 200){
$error = "Twitter could not be updated: " . $connection->http_header["status"] . ": ";
$error .= $tweet->error;
$error .= "<br />To paste the code into twitter yourself use: <br />" . $message;
$messageStack->add_session($error, 'error');
} else {
$messageStack->add_session('Twitter Updated!', 'success');
}
} else {
$error = "Twitter could not be updated: Could not connect or there was nothing to do once connected.<br />
Twitter may be down or over capacity. To paste the code into twitter yourself use: <br />";
$messageStack->add_session($error, 'error');
$messageStack->add_session($message, 'caution');
}
I am having a problem with the Title coming out
1960\s instead of 1960's
How do I fix this? :cry:
Thanks
i face a problem:
Twitter could not be updated: 401 Unauthorized: Incorrect signature
To paste the code into twitter yourself use:
New product available: 2010 End Offer sms @ 2 paisa! Only $4000. Check it out now at http://bit.ly/dSKuPE
i use:
zencard latest version and autotweet latest version.
how to change currency, i use indian rupees in my zencart but this is used USD ($)
how to change ?
Hi,
I have a problem with auto tweet. I currently have zen cart 1.3.9h and after installing and configuring auto tweet, when I add a product, it appears a page not found and if I click refresh it tells me that the product seemed empty.
Thanks in advance for your responses.
Solved it.
It was a setting from bit.ly. Share Settings and untick "Warn me if I try to share a message without a link or with only links."
Hi,
Thanks for this great mod. It works fine on new created products, however, we often use copy to create new products. If we copy a product it isn't send to twitter. is there a solution for this?
Problem solved :clap:
I copied all the stuff between start autoTweet 3.0 and eof autotweet to some rule below (see part of code)
PHP Code:
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
// reset products_price_sorter for searches etc.
zen_update_products_price_sorter((int)$products_id);
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
// start autoTweet 3.0
//User Settings.
$consumerKey = "xxxxxx"; //twitter app consumer key.
$consumerSecret = "xxxxxx"; //twitter app consumer secret.
$oauthToken = "xxxxxx"; //twitter app "my access" token
$oauthTokenSecret = "xxxxxx"; //twitter app "my access" token secret.
$bitlyUsername = "xxxxx"; //bit.ly username
$bitApiKey = "xxxxx"; //bit.ly api key.
$storeUrl = "xxxxx"; //url to the homepage of your store.
$showprice = 0; // Show the product price? 0 = off, 1 = on. no quotes.
Hi all
How hard would this be to create a checkbox within the product details page to post that product onto twitter?
My issues;
1. We add products and leave them offline while waiting for stock to arrive. These are autotweeted and we have to go and delete the tweet.
2. Sometimes old products are edited (new style or type) so we would like to tweet again.
3. Some products are added to hidden sections for newsletter subscribers only, these automatically get posted and we have to go deleting them.
Kind Regards
Dave
Hi,
I need some help I have added the autotweet module but I doesn't function? I don't get any errors when I add a product?
This is the code that I have put in I have change the key's and passwords for security but I wanted to check the basics are right.
// start autoTweet 3.0
//User Settings.
$consumerKey = "0gWLhuXHSzdImWWo9gE9qg"; //twitter app consumer key.
$consumerSecret = "0GiGSTVSwdhQEk9mr26dIkGgzSagwSy0yLz9KQ"; //twitter app consumer secret.
$oauthToken = "247733275-bwLM6B7o925J8f4ZPKWpoOfCGggz6HAtNUS8KuDU"; //twitter app "my access" token
$oauthTokenSecret = "NzrnYbuqv9LosZ1kwx9aWkgFSx4xdfDVYzVZZv7Xs4Y"; //twitter app "my access" token secret.
$twitUsername = "mobilegearuk";
$twitPassword = "******";
$bitlyUsername = "mobilegearuk"; //bit.ly username
$bitApiKey = "R_4c7acc2b6a341dfdf796fa414dd877f46"; //bit.ly api key.
$storeUrl = "http://www.mobile-gear.co.uk"; //url to the homepage of your store.
$showprice = 0; // Show the product price? 0 = off, 1 = on. no quotes.
$timeout = 10; //seconds to wait for twitter & bit.ly. This can be left alone.
//do not edit below this line.
Should I be able to see the module in my admin section under modules and do I need to turn it on?
Thanks in advance
Nick
Nick
I'm no expert but have this working, here is a copy of mine, try modifying this with your data.
Code:// start autoTweet 3.0
//User Settings.
$consumerKey = "xxxxxxxxxxxxxxx"; //twitter app consumer key.
$consumerSecret = "xxxxxxxxxxxxxx"; //twitter app consumer secret.
$oauthToken = "xxxxxxxxxxxxxxxxx"; //twitter app "my access" token
$oauthTokenSecret = "xxxxxxxxxxxxxxxx"; //twitter app "my access" token secret.
$bitlyUsername = "bitly2011"; //bit.ly username
$bitApiKey = "R_8888888888888888888888883"; //bit.ly api key.
$storeUrl = "www.domain.co.uk"; //url to the homepage of your store no http.
$showprice = 0; // Show the product price? 0 = off, 1 = on. no quotes.
$timeout = 10; //seconds to wait for twitter & bit.ly. This can be left alone.
//do not edit below this line.
$prodUrl = urlencode(zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id));
//short url function.
function shortenUrl($user, $key, $shortenUrl){
$url = 'http://api.bit.ly/v3/shorten?login=' . $user .'&apiKey='. $key . '&longUrl=' . $shortenUrl . '&format=xml';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//use oAuth library
require_once 'twitteroauth/twitteroauth.php';
//function to shorten url
$shorten = shortenUrl($bitlyUsername, $bitApiKey, $prodUrl);
//start message w/ or w/out price
$message = "New product available: " . $_POST['products_name'][$_SESSION['languages_id']] . '!';
if ($showprice){ $message .= ' Only $' . $products_price . '.'; }
//if shorten fails use $storeUrl
$bitStatus = simplexml_load_string($shorten);
$http_code = $bitStatus->status_code;
$status_txt = $bitStatus->status_txt;
if ($http_code != 200){$shorten = $storeUrl;
$biterror = "URL was not shortened for Twitter: ";
$biterror .= $storeUrl . " was used instead.";
$biterror .= " Reason: " . $status_txt;
$messageStack->add_session($biterror, 'caution');
} else { $shorten = $bitStatus->data->url;}
//finish message.
$message .= ' Check it out now at ' . $shorten;
//the connection to twitter API
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$connection->timeout = $timeout;
$connection->connecttimeout = $timeout;
//send message
$tweet = $connection->post('statuses/update', array('status' => $message));
//error check
if ($connection->http_code != NULL){
if ($connection->http_code != 200){
$error = "Twitter could not be updated: " . $connection->http_header["status"] . ": ";
$error .= $tweet->error;
$error .= "<br />To paste the code into twitter yourself use: <br />" . $message;
$messageStack->add_session($error, 'error');
} else {
$messageStack->add_session('Twitter Updated!', 'success');
}
} else {
$error = "Twitter could not be updated: Could not connect or there was nothing to do once connected.<br />
Twitter may be down or over capacity. To paste the code into twitter yourself use: <br />";
$messageStack->add_session($error, 'error');
$messageStack->add_session($message, 'caution');
}
// end autoTweet 3.0
Regards Dave
Hi did you ever solve the problem of Twitter could not be updated: 401 Unauthorized: Could not authenticate you.
I have it now and cannot find an answer
Anyone else? I was able to get the AutoFacebook working.
Is it possible to tweet products already in database?
Will Autotweet 3.0 work with Zencart 1.38a? I have followed instructions and it does nothing. Please help. Thanks
I tried to add this to my Zen Cart, thought I had done all correctly but am getting the error codes below:
Warning URL was not shortened for Twitter: http://www.comedyshirts.co.uk was used instead. Reason: INVALID_LOGIN
Error Twitter could not be updated: 401 Unauthorized: Read-only application cannot POST
To paste the code into twitter yourself use:
New product available: 'Your design' mug! Check it out now at http://www.comedyshirts.co.uk
Help would be much appreciated.
Thanks
Tony
Sounds like your Twitter app Access Level is set to Read Only
try log into Twitter dev https://dev.twitter.com/apps
Find your application, go to settings and Select 'Read and Write' from application type.
Hope that helps.
Also you will need to check your bit.ly api keys and tokens (ADMIN/INCLUDES>MODULES>update_product.php)
Sounds like it's mis-configured
https://bitly.com/
Hope that helps.
Hi Treefrog
Thanks for the advice.
I just set to read/write and had to enter the revised access codes.
Put a new item in the shop and got no error codes, but no confirmation either!
Should it tell you it has been twittered!
So far no tweet has come through.
Cheers
Tony
Hi,
you should get 'success' message at the top of the screen after update.
Note, standard set up of this Mod will only Tweet on New Products added, rather than upon product updated.
You can adjust to have it tweet on update though if needed,
I have set up to tweet on update with option to 'not tweet' (handy when you make a tiny change, or working on an 'offline' product)
Sorry if I sound a bit thick here, when you say you get a 'success' message at the top of the screen, where would this be?
My shop control panel?
The Dev Twitter?
It is quite new to me, so I am a complete novice with the php stuff!
Thanks for the explanation< I'm not getting that so I guess it's back to the drawing board!!
Will sleep on it and try tomorrow, otherwise the computer may be attacked