This has turned out to be a great mod. I was hesitant at first, as I would have liked what @sunflowertami was asking for as well. We have a restaurant, and there are several 'specials' we sometimes come back to due to popularity. Once we add a menu item, it would be great to go from RED to GREEN and have it tweet automatically without the extra step.

Originally Posted by
sunflowertami
Hmm...well thanks for trying! I think I'll just use the original php file. It will still tweet the stuff on my temp category and people will click on it to get to my site however it will say product not found.
It was tweeting immediately after I added a new menu item, even if status was 'out of stock' (RED).
I found the culprit that was creating the tweet bug.

Originally Posted by
jamielife
and replace just those 3 lines with:
PHP Code:
} elseif ($action == 'update_product') {
zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
// bof Auto Tweet.
if($_POST['products_status'] = "1"){
include 'twitter/twitter.php';
require_once 'twitter/bitly.php';
// CHANGE: path to your store (i.e. http://example.com/store
$myStoreUrl = 'http://www.example.com';
// CHANGE: Your stores Twitter username and password
$twitter = new Twitter("TwitterUsername","TwitterPassword");
// CHANGE: Your bit.ly Username and API Key
// API Key should be a long number starting with "R_"
// available free @ http://bit.ly/account/your_api_key
$bitly = new Bitly('myBITLYusername', 'R_321321321321321');
// ##### No need to change below this line #####
// URL for bitly.php to shorten
$shirturl = $myStoreUrl . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id ;
// send tweet.
$shirtname = $sql_data_array['products_name'];
$mytweet ='New Product Available: "' . $shirtname . '" Check it out at ' . $bitly->shorten($shirturl);
$twitter->updateStatus($mytweet);
}// eof Auto-Tweet
}
Follow @jamielife's directions above, but where...
PHP Code:
if($_POST['products_status'] = "1"){
change to...
PHP Code:
if($_POST['products_status'] == 1){
This should do the trick. it would still be nice for the action to perform when turning RED to GREEN, but this should solve it tweeting when inactive. Great mod @jamielife!
Bookmarks